MCPcopy Index your code
hub / github.com/python/cpython / format_option_strings

Method format_option_strings

Lib/optparse.py:337–354  ·  view source on GitHub ↗

Return a comma-separated list of option strings & metavariables.

(self, option)

Source from the content-addressed store, hash-verified

335 self.help_width = max(self.width - self.help_position, 11)
336
337 def format_option_strings(self, option):
338 """Return a comma-separated list of option strings & metavariables."""
339 if option.takes_value():
340 metavar = option.metavar or option.dest.upper()
341 short_opts = [self._short_opt_fmt % (sopt, metavar)
342 for sopt in option._short_opts]
343 long_opts = [self._long_opt_fmt % (lopt, metavar)
344 for lopt in option._long_opts]
345 else:
346 short_opts = option._short_opts
347 long_opts = option._long_opts
348
349 if self.short_first:
350 opts = short_opts + long_opts
351 else:
352 opts = long_opts + short_opts
353
354 return ", ".join(opts)
355
356class IndentedHelpFormatter (HelpFormatter):
357 """Format help with indented section bodies.

Callers 1

store_option_stringsMethod · 0.95

Calls 3

takes_valueMethod · 0.80
upperMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected