Method: flask.cli._set_debug
Calls: 22, Exceptions: 0, Paths: 1Back
Path 1: 22 calls (1.0)
Context (22)
Option (22)
False (22)
None (22)
1def _set_debug(ctx: click.Context, param: click.Option, value: bool) -> bool | None:
2 # If the flag isn't provided, it will default to False. Don't use
3 # that, let debug be set by env in that case.
4 source = ctx.get_parameter_source(param.name) # type: ignore[arg-type]
5
6 if source is not None and source in (
7 ParameterSource.DEFAULT,
8 ParameterSource.DEFAULT_MAP,
9 ):
10 return None
11
12 # Set with env var instead of ScriptInfo.load so that it can be
13 # accessed early during a factory function.
14 os.environ["FLASK_DEBUG"] = "1" if value else "0"
15 return value