@@ -65,16 +65,16 @@ def __call__(self, class_type: Type[ClassType], *args, **kwargs) -> ClassType:
6565applied_instantiation_links : ContextVar [Optional [set ]] = ContextVar ("applied_instantiation_links" , default = None )
6666
6767
68- parser_context_vars = dict (
69- parent_parser = parent_parser ,
70- parser_capture = parser_capture ,
71- defaults_cache = defaults_cache ,
72- lenient_check = lenient_check ,
73- load_value_mode = load_value_mode ,
74- class_instantiators = class_instantiators ,
75- nested_links = nested_links ,
76- applied_instantiation_links = applied_instantiation_links ,
77- )
68+ parser_context_vars = {
69+ " parent_parser" : parent_parser ,
70+ " parser_capture" : parser_capture ,
71+ " defaults_cache" : defaults_cache ,
72+ " lenient_check" : lenient_check ,
73+ " load_value_mode" : load_value_mode ,
74+ " class_instantiators" : class_instantiators ,
75+ " nested_links" : nested_links ,
76+ " applied_instantiation_links" : applied_instantiation_links ,
77+ }
7878
7979
8080@contextmanager
@@ -91,10 +91,10 @@ def parser_context(**kwargs):
9191 context_var .reset (token )
9292
9393
94- parsing_settings = dict (
95- validate_defaults = False ,
96- parse_optionals_as_positionals = False ,
97- )
94+ parsing_settings = {
95+ " validate_defaults" : False ,
96+ " parse_optionals_as_positionals" : False ,
97+ }
9898
9999
100100def set_parsing_settings (
@@ -270,7 +270,7 @@ def __init__(self, instantiators: InstantiatorsDictType) -> None:
270270 def __call__ (self , class_type : Type [ClassType ], * args , ** kwargs ) -> ClassType :
271271 for (cls , subclasses ), instantiator in self .instantiators .items ():
272272 if class_type is cls or (subclasses and is_subclass (class_type , cls )):
273- param_names = set (inspect .signature (instantiator ).parameters . keys () )
273+ param_names = set (inspect .signature (instantiator ).parameters )
274274 if "applied_instantiation_links" in param_names :
275275 applied_links = applied_instantiation_links .get () or set ()
276276 kwargs ["applied_instantiation_links" ] = {
@@ -316,7 +316,7 @@ def setup_default_logger(data, level, caller):
316316def parse_logger (logger : Union [bool , str , dict , logging .Logger ], caller ):
317317 if not isinstance (logger , (bool , str , dict , logging .Logger )):
318318 raise ValueError (f"Expected logger to be an instance of (bool, str, dict, logging.Logger), but got { logger } ." )
319- if isinstance (logger , dict ) and len (set (logger . keys () ) - {"name" , "level" }) > 0 :
319+ if isinstance (logger , dict ) and len (set (logger ) - {"name" , "level" }) > 0 :
320320 value = {k : v for k , v in logger .items () if k not in {"name" , "level" }}
321321 raise ValueError (f"Unexpected data to configure logger: { value } ." )
322322 if logger is False :
@@ -384,6 +384,6 @@ class Action(LoggerProperty, argparse.Action):
384384
385385 def _check_type_ (self , value , ** kwargs ):
386386 if not hasattr (self , "_check_type_kwargs" ):
387- self ._check_type_kwargs = set (inspect .signature (self ._check_type ).parameters . keys () )
387+ self ._check_type_kwargs = set (inspect .signature (self ._check_type ).parameters )
388388 kwargs = {k : v for k , v in kwargs .items () if k in self ._check_type_kwargs }
389389 return self ._check_type (value , ** kwargs )
0 commit comments