Home / Function/ is_bytes_or_nonable_bytes_annotation() — fastapi Function Reference

is_bytes_or_nonable_bytes_annotation() — fastapi Function Reference

Architecture documentation for the is_bytes_or_nonable_bytes_annotation() function in shared.py from the fastapi codebase.

Function python FastAPI Responses calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  f02e93f6_c9f3_2f06_52c9_e35e989f355c["is_bytes_or_nonable_bytes_annotation()"]
  3e898b29_4dd8_c417_2d9b_a84d867423b4["shared.py"]
  f02e93f6_c9f3_2f06_52c9_e35e989f355c -->|defined in| 3e898b29_4dd8_c417_2d9b_a84d867423b4
  7902a3e7_b475_cc3f_95dd_6266d428706b["is_bytes_sequence_annotation()"]
  7902a3e7_b475_cc3f_95dd_6266d428706b -->|calls| f02e93f6_c9f3_2f06_52c9_e35e989f355c
  eda91ac5_1bd0_0d8b_6e77_6b82c2f46ce9["lenient_issubclass()"]
  f02e93f6_c9f3_2f06_52c9_e35e989f355c -->|calls| eda91ac5_1bd0_0d8b_6e77_6b82c2f46ce9
  style f02e93f6_c9f3_2f06_52c9_e35e989f355c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/_compat/shared.py lines 128–136

def is_bytes_or_nonable_bytes_annotation(annotation: Any) -> bool:
    if lenient_issubclass(annotation, bytes):
        return True
    origin = get_origin(annotation)
    if origin is Union or origin is UnionType:
        for arg in get_args(annotation):
            if lenient_issubclass(arg, bytes):
                return True
    return False

Domain

Subdomains

Frequently Asked Questions

What does is_bytes_or_nonable_bytes_annotation() do?
is_bytes_or_nonable_bytes_annotation() is a function in the fastapi codebase, defined in fastapi/_compat/shared.py.
Where is is_bytes_or_nonable_bytes_annotation() defined?
is_bytes_or_nonable_bytes_annotation() is defined in fastapi/_compat/shared.py at line 128.
What does is_bytes_or_nonable_bytes_annotation() call?
is_bytes_or_nonable_bytes_annotation() calls 1 function(s): lenient_issubclass.
What calls is_bytes_or_nonable_bytes_annotation()?
is_bytes_or_nonable_bytes_annotation() is called by 1 function(s): is_bytes_sequence_annotation.

Analyze Your Own Codebase

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

Try Supermodel Free