MCPcopy Index your code
hub / github.com/RustPython/RustPython / _get_action_name

Function _get_action_name

Lib/argparse.py:773–793  ·  view source on GitHub ↗
(argument)

Source from the content-addressed store, hash-verified

771# =====================
772
773def _get_action_name(argument):
774 if argument is None:
775 return None
776 elif argument.option_strings:
777 return '/'.join(argument.option_strings)
778 elif argument.metavar not in (None, SUPPRESS):
779 metavar = argument.metavar
780 if not isinstance(metavar, tuple):
781 return metavar
782 if argument.nargs == ZERO_OR_MORE and len(metavar) == 2:
783 return '%s[, %s]' % metavar
784 elif argument.nargs == ONE_OR_MORE:
785 return '%s[, %s]' % metavar
786 else:
787 return ', '.join(metavar)
788 elif argument.dest not in (None, SUPPRESS):
789 return argument.dest
790 elif argument.choices:
791 return '{%s}' % ','.join(map(str, argument.choices))
792 else:
793 return None
794
795
796class ArgumentError(Exception):

Callers 3

__init__Method · 0.85
take_actionMethod · 0.85
_parse_known_argsMethod · 0.85

Calls 3

isinstanceFunction · 0.85
lenFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected