Method: flask.cli.FlaskGroup.__init__
Calls: 14, Exceptions: 0, Paths: 1Back
Path 1: 14 calls (1.0)
True (14)
TestRoutes.invoke.
True (14)
True (14)
True (13) False (1)
{} (9) dict (3) {'name': 'flask', 'help': "A general utility script for Flask applications.\n\nAn application to load must be given with the '--app' o...
1def __init__(
2 self,
3 add_default_commands: bool = True,
4 create_app: t.Callable[..., Flask] | None = None,
5 add_version_option: bool = True,
6 load_dotenv: bool = True,
7 set_debug_flag: bool = True,
8 **extra: t.Any,
9 ) -> None:
10 params = list(extra.pop("params", None) or ())
11 # Processing is done with option callbacks instead of a group
12 # callback. This allows users to make a custom group callback
13 # without losing the behavior. --env-file must come first so
14 # that it is eagerly evaluated before --app.
15 params.extend((_env_file_option, _app_option, _debug_option))
16
17 if add_version_option:
18 params.append(version_option)
19
20 if "context_settings" not in extra:
21 extra["context_settings"] = {}
22
23 extra["context_settings"].setdefault("auto_envvar_prefix", "FLASK")
24
25 super().__init__(params=params, **extra)
26
27 self.create_app = create_app
28 self.load_dotenv = load_dotenv
29 self.set_debug_flag = set_debug_flag
30
31 if add_default_commands:
32 self.add_command(run_command)
33 self.add_command(shell_command)
34 self.add_command(routes_command)
35
36 self._loaded_plugin_commands = False