@@ -367,19 +367,20 @@ def _register_arguments(cls, subparser):
367367 if 'bool' in typemap [arg ]:
368368 kwargs ['action' ] = FlagAction
369369
370- if hasattr (cls , '_{}_type' .format (arg )):
371- # If the docstring *contains* the word float or int,
372- # parsing will fail for things not of that type
373- # even if a custom loader will eventually be used.
374- # Let's check for custom loaders here and set the type
375- # to str.
376- kwargs ['type' ] = str
377370 else :
378- basic_types = {'str' : str , 'float' : float , 'int' : int }
379- for basic_type in basic_types :
380- if basic_type in typemap [arg ]:
381- kwargs ['type' ] = basic_types [basic_type ]
382- break
371+ if hasattr (cls , '_{}_type' .format (arg )):
372+ # If the docstring *contains* the word float or int,
373+ # parsing will fail for things not of that type
374+ # even if a custom loader will eventually be used.
375+ # Let's check for custom loaders here and set the type
376+ # to str.
377+ kwargs ['type' ] = str
378+ else :
379+ basic_types = {'str' : str , 'float' : float , 'int' : int }
380+ for basic_type in basic_types :
381+ if basic_type in typemap [arg ]:
382+ kwargs ['type' ] = basic_types [basic_type ]
383+ break
383384
384385 group .add_argument ('--{}' .format (arg ), ** kwargs )
385386
0 commit comments