MCPcopy Create free account
hub / github.com/apache/madlib / _format_action_invocation

Method _format_action_invocation

src/madpack/argparse.py:561–582  ·  view source on GitHub ↗
(self, action)

Source from the content-addressed store, hash-verified

559 return self._join_parts(parts)
560
561 def _format_action_invocation(self, action):
562 if not action.option_strings:
563 metavar, = self._metavar_formatter(action, action.dest)(1)
564 return metavar
565
566 else:
567 parts = []
568
569 # if the Optional doesn't take a value, format is:
570 # -s, --long
571 if action.nargs == 0:
572 parts.extend(action.option_strings)
573
574 # if the Optional takes a value, format is:
575 # -s ARGS, --long ARGS
576 else:
577 default = action.dest.upper()
578 args_string = self._format_args(action, default)
579 for option_string in action.option_strings:
580 parts.append('%s %s' % (option_string, args_string))
581
582 return ', '.join(parts)
583
584 def _metavar_formatter(self, action, default_metavar):
585 if action.metavar is not None:

Callers 1

_format_actionMethod · 0.95

Calls 2

_metavar_formatterMethod · 0.95
_format_argsMethod · 0.95

Tested by

no test coverage detected