Home / Function/ __init__() — flask Function Reference

__init__() — flask Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e9361747_7510_50a9_29c5_1934b7b46b16["__init__()"]
  ee9fbc8f_42bd_3ef5_a80f_72abfe054c0b["FlaskGroup"]
  e9361747_7510_50a9_29c5_1934b7b46b16 -->|defined in| ee9fbc8f_42bd_3ef5_a80f_72abfe054c0b
  style e9361747_7510_50a9_29c5_1934b7b46b16 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/cli.py lines 563–598

    def __init__(
        self,
        add_default_commands: bool = True,
        create_app: t.Callable[..., Flask] | None = None,
        add_version_option: bool = True,
        load_dotenv: bool = True,
        set_debug_flag: bool = True,
        **extra: t.Any,
    ) -> None:
        params: list[click.Parameter] = list(extra.pop("params", None) or ())
        # Processing is done with option callbacks instead of a group
        # callback. This allows users to make a custom group callback
        # without losing the behavior. --env-file must come first so
        # that it is eagerly evaluated before --app.
        params.extend((_env_file_option, _app_option, _debug_option))

        if add_version_option:
            params.append(version_option)

        if "context_settings" not in extra:
            extra["context_settings"] = {}

        extra["context_settings"].setdefault("auto_envvar_prefix", "FLASK")

        super().__init__(params=params, **extra)

        self.create_app = create_app
        self.load_dotenv = load_dotenv
        self.set_debug_flag = set_debug_flag

        if add_default_commands:
            self.add_command(run_command)
            self.add_command(shell_command)
            self.add_command(routes_command)

        self._loaded_plugin_commands = False

Subdomains

Defined In

Frequently Asked Questions

What does __init__() do?
__init__() is a function in the flask codebase, defined in src/flask/cli.py.
Where is __init__() defined?
__init__() is defined in src/flask/cli.py at line 563.

Analyze Your Own Codebase

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

Try Supermodel Free