Home / Function/ is_coroutine_callable() — fastapi Function Reference

is_coroutine_callable() — fastapi Function Reference

Architecture documentation for the is_coroutine_callable() function in models.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  3b576417_6926_33b0_dca2_959f7f5317eb["is_coroutine_callable()"]
  575d42b6_61a5_5351_210d_0e7a8dd0084f["Dependant"]
  3b576417_6926_33b0_dca2_959f7f5317eb -->|defined in| 575d42b6_61a5_5351_210d_0e7a8dd0084f
  8fd8a24b_4153_63d9_a368_0de559b55839["_impartial()"]
  3b576417_6926_33b0_dca2_959f7f5317eb -->|calls| 8fd8a24b_4153_63d9_a368_0de559b55839
  1e3f2d0b_134b_ca9f_27b7_1847fce256de["_unwrapped_call()"]
  3b576417_6926_33b0_dca2_959f7f5317eb -->|calls| 1e3f2d0b_134b_ca9f_27b7_1847fce256de
  style 3b576417_6926_33b0_dca2_959f7f5317eb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/dependencies/models.py lines 158–185

    def is_coroutine_callable(self) -> bool:
        if self.call is None:
            return False  # pragma: no cover
        if inspect.isroutine(_impartial(self.call)) and iscoroutinefunction(
            _impartial(self.call)
        ):
            return True
        if inspect.isroutine(_unwrapped_call(self.call)) and iscoroutinefunction(
            _unwrapped_call(self.call)
        ):
            return True
        if inspect.isclass(_unwrapped_call(self.call)):
            return False
        dunder_call = getattr(_impartial(self.call), "__call__", None)  # noqa: B004
        if dunder_call is None:
            return False  # pragma: no cover
        if iscoroutinefunction(_impartial(dunder_call)) or iscoroutinefunction(
            _unwrapped_call(dunder_call)
        ):
            return True
        dunder_unwrapped_call = getattr(_unwrapped_call(self.call), "__call__", None)  # noqa: B004
        if dunder_unwrapped_call is None:
            return False  # pragma: no cover
        if iscoroutinefunction(
            _impartial(dunder_unwrapped_call)
        ) or iscoroutinefunction(_unwrapped_call(dunder_unwrapped_call)):
            return True
        return False

Subdomains

Frequently Asked Questions

What does is_coroutine_callable() do?
is_coroutine_callable() is a function in the fastapi codebase, defined in fastapi/dependencies/models.py.
Where is is_coroutine_callable() defined?
is_coroutine_callable() is defined in fastapi/dependencies/models.py at line 158.
What does is_coroutine_callable() call?
is_coroutine_callable() calls 2 function(s): _impartial, _unwrapped_call.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free