Skip to content

is_bind_arg

faststream.cli.utils.parser.is_bind_arg #

is_bind_arg(arg)

Determine whether the received argument refers to --bind.

bind arguments are like: 0.0.0.0:8000, [::]:8000, fd://2, /tmp/socket.sock

Source code in faststream/cli/utils/parser.py
def is_bind_arg(arg: str) -> bool:
    """Determine whether the received argument refers to --bind.

    bind arguments are like: 0.0.0.0:8000, [::]:8000, fd://2, /tmp/socket.sock

    """
    bind_regex = re.compile(r":\d+$|:/+\d|:/[a-zA-Z0-9._-]+/[a-zA-Z0-9._-]+")
    return bool(bind_regex.search(arg))