4242 LifecycleOptions ,
4343 LifecycleValues ,
4444)
45- from .logging import configure_logger , log_invocation
45+ from .logging import _CONFIGURED_LOG_LEVELS , configure_logger , log_invocation
4646from .paths import (
4747 current_working_dir ,
4848 normalize_cli_name ,
@@ -279,7 +279,7 @@ def _default_log_file(layout: Any, configured_log_file: Path | None) -> Path:
279279def _parameter_source_was_supplied (source : Any ) -> bool :
280280 """Return whether Click resolved an option from an explicit input source."""
281281
282- return getattr (source , "name" , None ) in { "COMMANDLINE" , "PROMPT" , "ENVIRONMENT" , "DEFAULT_MAP" }
282+ return _parameter_source_rank (source ) >= 2
283283
284284
285285def _configured_stream_level (
@@ -299,14 +299,7 @@ def _configured_stream_level(
299299 elif level == "debug" :
300300 level = "info"
301301 if _parameter_source_was_supplied (quiet_source ) and quiet :
302- rank = {
303- "debug" : logging .DEBUG ,
304- "info" : logging .INFO ,
305- "warning" : logging .WARNING ,
306- "error" : logging .ERROR ,
307- "critical" : logging .CRITICAL ,
308- }
309- if level is None or rank .get (level , logging .INFO ) < logging .WARNING :
302+ if level is None or _CONFIGURED_LOG_LEVELS .get (level , logging .INFO ) < logging .WARNING :
310303 level = "warning"
311304 return level
312305
@@ -1146,7 +1139,8 @@ def _create_context(
11461139 self ,
11471140 standard : dict [str , Any ],
11481141 dry_run : bool = False ,
1149- option_sources : Mapping [str , Any ] | None = None ,
1142+ * ,
1143+ option_sources : Mapping [str , Any ],
11501144 ) -> Context [dict [str , Any ], Any , Any ]:
11511145 project = self .profile .discover_project (current_working_dir ())
11521146 manifest_path = project .manifest if project is not None else None
@@ -1178,7 +1172,7 @@ def _create_context(
11781172 or "dev"
11791173 )
11801174 log_level = framework_config .log_level if framework_config is not None else None
1181- sources = option_sources or {}
1175+ sources = option_sources
11821176 debug_source = sources .get ("debug" )
11831177 quiet_source = sources .get ("quiet" )
11841178 keep_temp_source = sources .get ("keep_temp" )
@@ -1190,7 +1184,7 @@ def _create_context(
11901184 quiet = bool (standard .get ("quiet" ))
11911185 if framework_config is None or _parameter_source_was_supplied (keep_temp_source ):
11921186 keep_temp = bool (standard .get ("keep_temp" ))
1193- elif "keep_temp" in config_provenance or framework_config . keep_temp :
1187+ elif "keep_temp" in config_provenance :
11941188 keep_temp = framework_config .keep_temp
11951189 else :
11961190 keep_temp = bool (standard .get ("keep_temp" ))
0 commit comments