Home / Function/ __init__() — fastapi Function Reference

__init__() — fastapi Function Reference

Architecture documentation for the __init__() function in oauth2.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  09c5b92b_43dd_bfe6_dd93_f94e762da840["__init__()"]
  416e637a_6fc2_b0ac_63a4_25b01b3770b8["SecurityScopes"]
  09c5b92b_43dd_bfe6_dd93_f94e762da840 -->|defined in| 416e637a_6fc2_b0ac_63a4_25b01b3770b8
  style 09c5b92b_43dd_bfe6_dd93_f94e762da840 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/security/oauth2.py lines 666–693

    def __init__(
        self,
        scopes: Annotated[
            Optional[list[str]],
            Doc(
                """
                This will be filled by FastAPI.
                """
            ),
        ] = None,
    ):
        self.scopes: Annotated[
            list[str],
            Doc(
                """
                The list of all the scopes required by dependencies.
                """
            ),
        ] = scopes or []
        self.scope_str: Annotated[
            str,
            Doc(
                """
                All the scopes required by all the dependencies in a single string
                separated by spaces, as defined in the OAuth2 specification.
                """
            ),
        ] = " ".join(self.scopes)

Domain

Subdomains

Frequently Asked Questions

What does __init__() do?
__init__() is a function in the fastapi codebase, defined in fastapi/security/oauth2.py.
Where is __init__() defined?
__init__() is defined in fastapi/security/oauth2.py at line 666.

Analyze Your Own Codebase

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

Try Supermodel Free