Method: flask.cli.FlaskGroup.get_command
Calls: 26, Exceptions: 1, Paths: 3Back
Path 1: 24 calls (0.92)
Context (24)
'routes' (14) 'test' (3) 'run' (3) 'shell' (3) 'show' (1)
Command (24)
1def get_command(self, ctx, name):
2 self._load_plugin_commands()
3 # Look up built-in and plugin commands, which should be
4 # available even if the app fails to load.
5 rv = super().get_command(ctx, name)
6
7 if rv is not None:
8 return rv
9
10 info = ctx.ensure_object(ScriptInfo)
11
12 # Look up commands provided by the app, showing an error and
13 # continuing if the app couldn't be loaded.
14 try:
15 app = info.load_app()
16 except NoAppException as e:
17 click.secho(f"Error: {e.format_message()}\n", err=True, fg="red")
18 return None
19
20 # Push an app context for the loaded app unless it is already
21 # active somehow. This makes the context available to parameter
22 # and command callbacks without needing @with_appcontext.
23 if not current_app or current_app._get_current_object() is not app:
24 ctx.with_resource(app.app_context())
25
26 return app.cli.get_command(ctx, name)
Path 2: 1 calls (0.04)
Context (1)
'check' (1)
Command (1)
1def get_command(self, ctx, name):
2 self._load_plugin_commands()
3 # Look up built-in and plugin commands, which should be
4 # available even if the app fails to load.
5 rv = super().get_command(ctx, name)
6
7 if rv is not None:
8 return rv
9
10 info = ctx.ensure_object(ScriptInfo)
11
12 # Look up commands provided by the app, showing an error and
13 # continuing if the app couldn't be loaded.
14 try:
15 app = info.load_app()
16 except NoAppException as e:
17 click.secho(f"Error: {e.format_message()}\n", err=True, fg="red")
18 return None
19
20 # Push an app context for the loaded app unless it is already
21 # active somehow. This makes the context available to parameter
22 # and command callbacks without needing @with_appcontext.
23 if not current_app or current_app._get_current_object() is not app:
24 ctx.with_resource(app.app_context())
25
26 return app.cli.get_command(ctx, name)
Path 3: 1 calls (0.04)
Context (1)
'missing' (1)
None (1)
NoAppException (1)
1def get_command(self, ctx, name):
2 self._load_plugin_commands()
3 # Look up built-in and plugin commands, which should be
4 # available even if the app fails to load.
5 rv = super().get_command(ctx, name)
6
7 if rv is not None:
8 return rv
9
10 info = ctx.ensure_object(ScriptInfo)
11
12 # Look up commands provided by the app, showing an error and
13 # continuing if the app couldn't be loaded.
14 try:
15 app = info.load_app()
16 except NoAppException as e:
17 click.secho(f"Error: {e.format_message()}\n", err=True, fg="red")
18 return None
19
20 # Push an app context for the loaded app unless it is already
21 # active somehow. This makes the context available to parameter
22 # and command callbacks without needing @with_appcontext.
23 if not current_app or current_app._get_current_object() is not app:
24 ctx.with_resource(app.app_context())
25
26 return app.cli.get_command(ctx, name)