How to use the asgiref.compatibility.is_double_callable function in asgiref

To help you get started, we’ve selected a few asgiref examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github django / asgiref / tests / test_compatibility.py View on Github external
def test_is_double_callable():
    """
    Tests that the signature matcher works as expected.
    """
    assert is_double_callable(double_application_function) == True
    assert is_double_callable(DoubleApplicationClass) == True
    assert is_double_callable(DoubleApplicationClassNestedFunction()) == True
    assert is_double_callable(single_application_function) == False
    assert is_double_callable(SingleApplicationClass()) == False
github django / asgiref / tests / test_compatibility.py View on Github external
def test_is_double_callable():
    """
    Tests that the signature matcher works as expected.
    """
    assert is_double_callable(double_application_function) == True
    assert is_double_callable(DoubleApplicationClass) == True
    assert is_double_callable(DoubleApplicationClassNestedFunction()) == True
    assert is_double_callable(single_application_function) == False
    assert is_double_callable(SingleApplicationClass()) == False
github django / asgiref / tests / test_compatibility.py View on Github external
def test_is_double_callable():
    """
    Tests that the signature matcher works as expected.
    """
    assert is_double_callable(double_application_function) == True
    assert is_double_callable(DoubleApplicationClass) == True
    assert is_double_callable(DoubleApplicationClassNestedFunction()) == True
    assert is_double_callable(single_application_function) == False
    assert is_double_callable(SingleApplicationClass()) == False
github django / asgiref / tests / test_compatibility.py View on Github external
def test_is_double_callable():
    """
    Tests that the signature matcher works as expected.
    """
    assert is_double_callable(double_application_function) == True
    assert is_double_callable(DoubleApplicationClass) == True
    assert is_double_callable(DoubleApplicationClassNestedFunction()) == True
    assert is_double_callable(single_application_function) == False
    assert is_double_callable(SingleApplicationClass()) == False
github django / asgiref / tests / test_compatibility.py View on Github external
def test_is_double_callable():
    """
    Tests that the signature matcher works as expected.
    """
    assert is_double_callable(double_application_function) == True
    assert is_double_callable(DoubleApplicationClass) == True
    assert is_double_callable(DoubleApplicationClassNestedFunction()) == True
    assert is_double_callable(single_application_function) == False
    assert is_double_callable(SingleApplicationClass()) == False
github django / daphne / daphne / cli.py View on Github external
# If verbosity is 1 or greater, or they told us explicitly, set up access log
        access_log_stream = None
        if args.access_log:
            if args.access_log == "-":
                access_log_stream = sys.stdout
            else:
                access_log_stream = open(args.access_log, "a", 1)
        elif args.verbosity >= 1:
            access_log_stream = sys.stdout
        # Import application
        sys.path.insert(0, ".")
        application = import_by_path(args.application)

        asgi_protocol = args.asgi_protocol
        if asgi_protocol == "auto":
            asgi_protocol = "asgi2" if is_double_callable(application) else "asgi3"

        if asgi_protocol == "asgi3":
            application = ASGI3Middleware(application)

        # Set up port/host bindings
        if not any(
            [
                args.host,
                args.port is not None,
                args.unix_socket,
                args.file_descriptor is not None,
                args.socket_strings,
            ]
        ):
            # no advanced binding options passed, patch in defaults
            args.host = DEFAULT_HOST