Home / Function/ __init__() — flask Function Reference

__init__() — flask Function Reference

Architecture documentation for the __init__() function in blueprints.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  98006bb3_985f_40a2_29d1_c25b4f5b82cc["__init__()"]
  e57fb048_2e7e_7939_8012_b7bdd3145ba8["BlueprintSetupState"]
  98006bb3_985f_40a2_29d1_c25b4f5b82cc -->|defined in| e57fb048_2e7e_7939_8012_b7bdd3145ba8
  cd459c23_b1c5_45ac_a393_26c2ff268367["get()"]
  98006bb3_985f_40a2_29d1_c25b4f5b82cc -->|calls| cd459c23_b1c5_45ac_a393_26c2ff268367
  style 98006bb3_985f_40a2_29d1_c25b4f5b82cc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/sansio/blueprints.py lines 41–85

    def __init__(
        self,
        blueprint: Blueprint,
        app: App,
        options: t.Any,
        first_registration: bool,
    ) -> None:
        #: a reference to the current application
        self.app = app

        #: a reference to the blueprint that created this setup state.
        self.blueprint = blueprint

        #: a dictionary with all options that were passed to the
        #: :meth:`~flask.Flask.register_blueprint` method.
        self.options = options

        #: as blueprints can be registered multiple times with the
        #: application and not everything wants to be registered
        #: multiple times on it, this attribute can be used to figure
        #: out if the blueprint was registered in the past already.
        self.first_registration = first_registration

        subdomain = self.options.get("subdomain")
        if subdomain is None:
            subdomain = self.blueprint.subdomain

        #: The subdomain that the blueprint should be active for, ``None``
        #: otherwise.
        self.subdomain = subdomain

        url_prefix = self.options.get("url_prefix")
        if url_prefix is None:
            url_prefix = self.blueprint.url_prefix
        #: The prefix that should be used for all URLs defined on the
        #: blueprint.
        self.url_prefix = url_prefix

        self.name = self.options.get("name", blueprint.name)
        self.name_prefix = self.options.get("name_prefix", "")

        #: A dictionary with URL defaults that is added to each and every
        #: URL that was defined with the blueprint.
        self.url_defaults = dict(self.blueprint.url_values_defaults)
        self.url_defaults.update(self.options.get("url_defaults", ()))

Subdomains

Calls

Frequently Asked Questions

What does __init__() do?
__init__() is a function in the flask codebase, defined in src/flask/sansio/blueprints.py.
Where is __init__() defined?
__init__() is defined in src/flask/sansio/blueprints.py at line 41.
What does __init__() call?
__init__() calls 1 function(s): get.

Analyze Your Own Codebase

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

Try Supermodel Free