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

Method format_option_strings

Lib/optparse.py:339–356  ·  view source on GitHub ↗

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

(self, option)

Source from the content-addressed store, hash-verified

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