CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
argparse.HelpFormatter Class Reference
Inheritance diagram for argparse.HelpFormatter:
argparse.ArgumentDefaultsHelpFormatter argparse.RawDescriptionHelpFormatter argparse.RawTextHelpFormatter

Classes

class  _Section
 

Public Member Functions

def __init__
 
def add_argument
 
def add_arguments
 
def add_text
 
def add_usage
 
def end_section
 
def format_help
 
def start_section
 

Private Member Functions

def _add_item
 
def _dedent
 
def _expand_help
 
def _fill_text
 
def _format_action
 
def _format_action_invocation
 
def _format_actions_usage
 
def _format_args
 
def _format_text
 
def _format_usage
 
def _get_help_string
 
def _indent
 
def _iter_indented_subactions
 
def _join_parts
 
def _metavar_formatter
 
def _split_lines
 

Private Attributes

 _action_max_length
 
 _current_indent
 
 _current_section
 
 _indent_increment
 
 _level
 
 _long_break_matcher
 
 _max_help_position
 
 _prog
 
 _root_section
 
 _whitespace_matcher
 
 _width
 

Detailed Description

Formatter for generating usage messages and argument help strings.

Only the name of this class is considered a public API. All the methods
provided by the class are considered an implementation detail.

Definition at line 177 of file argparse.py.

Constructor & Destructor Documentation

def argparse.HelpFormatter.__init__ (   self,
  prog,
  indent_increment = 2,
  max_help_position = 24,
  width = None 
)

Definition at line 188 of file argparse.py.

189  width=None):
190 
191  # default setting for width
192  if width is None:
193  try:
194  width = int(_os.environ['COLUMNS'])
195  except (KeyError, ValueError):
196  width = 80
197  width -= 2
199  self._prog = prog
200  self._indent_increment = indent_increment
201  self._max_help_position = max_help_position
202  self._width = width
205  self._level = 0
206  self._action_max_length = 0
208  self._root_section = self._Section(self, None)
209  self._current_section = self._root_section
211  self._whitespace_matcher = _re.compile(r'\s+')
212  self._long_break_matcher = _re.compile(r'\n\n\n+')

Member Function Documentation

def argparse.HelpFormatter._add_item (   self,
  func,
  args 
)
private

Definition at line 258 of file argparse.py.

Referenced by argparse.HelpFormatter.add_argument(), argparse.HelpFormatter.add_text(), argparse.HelpFormatter.add_usage(), and argparse.HelpFormatter.start_section().

259  def _add_item(self, func, args):
260  self._current_section.items.append((func, args))
def argparse.HelpFormatter._dedent (   self)
private

Definition at line 220 of file argparse.py.

References argparse.HelpFormatter._current_indent, python.rootplot.argparse.HelpFormatter._current_indent, argparse.HelpFormatter._indent_increment, python.rootplot.argparse.HelpFormatter._indent_increment, PGeometricDet::Item._level, RPCMuonExtraStruct._level, TrackerGeometryCompare._level, MuonGeometryArrange._level, argparse.HelpFormatter._level, and python.rootplot.argparse.HelpFormatter._level.

Referenced by argparse.HelpFormatter._iter_indented_subactions(), and argparse.HelpFormatter.end_section().

221  def _dedent(self):
223  assert self._current_indent >= 0, 'Indent decreased below 0.'
224  self._level -= 1
def argparse.HelpFormatter._expand_help (   self,
  action 
)
private

Definition at line 610 of file argparse.py.

References argparse.HelpFormatter._get_help_string(), python.rootplot.argparse.HelpFormatter._get_help_string(), python.rootplot.argparse.ArgumentDefaultsHelpFormatter._get_help_string(), argparse.HelpFormatter._prog, python.rootplot.argparse.HelpFormatter._prog, cmsPerfStripChart.dict, join(), and list().

Referenced by argparse.HelpFormatter._format_action().

611  def _expand_help(self, action):
612  params = dict(vars(action), prog=self._prog)
613  for name in list(params):
614  if params[name] is SUPPRESS:
615  del params[name]
616  if params.get('choices') is not None:
617  choices_str = ', '.join([str(c) for c in params['choices']])
618  params['choices'] = choices_str
619  return self._get_help_string(action) % params
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def argparse.HelpFormatter._fill_text (   self,
  text,
  width,
  indent 
)
private

Definition at line 635 of file argparse.py.

Referenced by argparse.HelpFormatter._format_text().

636  def _fill_text(self, text, width, indent):
637  text = self._whitespace_matcher.sub(' ', text).strip()
638  return _textwrap.fill(text, width, initial_indent=indent,
639  subsequent_indent=indent)
def argparse.HelpFormatter._format_action (   self,
  action 
)
private

Definition at line 507 of file argparse.py.

References argparse.HelpFormatter._action_max_length, python.rootplot.argparse.HelpFormatter._action_max_length, argparse.HelpFormatter._current_indent, python.rootplot.argparse.HelpFormatter._current_indent, argparse.HelpFormatter._expand_help(), python.rootplot.argparse.HelpFormatter._expand_help(), argparse.HelpFormatter._format_action(), python.rootplot.argparse.HelpFormatter._format_action(), argparse.HelpFormatter._format_action_invocation(), python.rootplot.argparse.HelpFormatter._format_action_invocation(), argparse.HelpFormatter._iter_indented_subactions(), python.rootplot.argparse.HelpFormatter._iter_indented_subactions(), argparse.HelpFormatter._join_parts(), python.rootplot.argparse.HelpFormatter._join_parts(), argparse.HelpFormatter._max_help_position, python.rootplot.argparse.HelpFormatter._max_help_position, extend_argparse.HelpFormatterRespectNewlines._split_lines(), argparse.HelpFormatter._split_lines(), python.rootplot.argparse.HelpFormatter._split_lines(), python.rootplot.argparse.RawTextHelpFormatter._split_lines(), Vispa.Main.RotatingIcon.RotatingIcon._width, Vispa.Gui.VispaWidget.TextField._width, TFitConstraintMGaus._width, argparse.HelpFormatter._width, python.rootplot.argparse.HelpFormatter._width, and min().

Referenced by argparse.HelpFormatter._format_action(), and argparse.HelpFormatter.add_argument().

508  def _format_action(self, action):
509  # determine the required width and the entry label
510  help_position = min(self._action_max_length + 2,
511  self._max_help_position)
512  help_width = self._width - help_position
513  action_width = help_position - self._current_indent - 2
514  action_header = self._format_action_invocation(action)
515 
516  # ho nelp; start on same line and add a final newline
517  if not action.help:
518  tup = self._current_indent, '', action_header
519  action_header = '%*s%s\n' % tup
520 
521  # short action name; start on the same line and pad two spaces
522  elif len(action_header) <= action_width:
523  tup = self._current_indent, '', action_width, action_header
524  action_header = '%*s%-*s ' % tup
525  indent_first = 0
526 
527  # long action name; start on the next line
528  else:
529  tup = self._current_indent, '', action_header
530  action_header = '%*s%s\n' % tup
531  indent_first = help_position
532 
533  # collect the pieces of the action help
534  parts = [action_header]
535 
536  # if there was help for the action, add lines of help text
537  if action.help:
538  help_text = self._expand_help(action)
539  help_lines = self._split_lines(help_text, help_width)
540  parts.append('%*s%s\n' % (indent_first, '', help_lines[0]))
541  for line in help_lines[1:]:
542  parts.append('%*s%s\n' % (help_position, '', line))
543 
544  # or add a newline if the description doesn't end with one
545  elif not action_header.endswith('\n'):
546  parts.append('\n')
547 
548  # if there are any sub-actions, add their help as well
549  for subaction in self._iter_indented_subactions(action):
550  parts.append(self._format_action(subaction))
551 
552  # return a single string
553  return self._join_parts(parts)
T min(T a, T b)
Definition: MathUtil.h:58
def argparse.HelpFormatter._format_action_invocation (   self,
  action 
)
private

Definition at line 554 of file argparse.py.

References argparse.HelpFormatter._format_args(), python.rootplot.argparse.HelpFormatter._format_args(), argparse.HelpFormatter._metavar_formatter(), python.rootplot.argparse.HelpFormatter._metavar_formatter(), and join().

Referenced by argparse.HelpFormatter._format_action(), and argparse.HelpFormatter.add_argument().

555  def _format_action_invocation(self, action):
556  if not action.option_strings:
557  metavar, = self._metavar_formatter(action, action.dest)(1)
558  return metavar
559 
560  else:
561  parts = []
562 
563  # if the Optional doesn't take a value, format is:
564  # -s, --long
565  if action.nargs == 0:
566  parts.extend(action.option_strings)
567 
568  # if the Optional takes a value, format is:
569  # -s ARGS, --long ARGS
570  else:
571  default = action.dest.upper()
572  args_string = self._format_args(action, default)
573  for option_string in action.option_strings:
574  parts.append('%s %s' % (option_string, args_string))
575 
576  return ', '.join(parts)
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def argparse.HelpFormatter._format_actions_usage (   self,
  actions,
  groups 
)
private

Definition at line 412 of file argparse.py.

References argparse.HelpFormatter._format_args(), python.rootplot.argparse.HelpFormatter._format_args(), argparse._set, argparse._sorted, and join().

Referenced by argparse.HelpFormatter._format_usage().

413  def _format_actions_usage(self, actions, groups):
414  # find group indices and identify actions in groups
415  group_actions = _set()
416  inserts = {}
417  for group in groups:
418  try:
419  start = actions.index(group._group_actions[0])
420  except ValueError:
421  continue
422  else:
423  end = start + len(group._group_actions)
424  if actions[start:end] == group._group_actions:
425  for action in group._group_actions:
426  group_actions.add(action)
427  if not group.required:
428  inserts[start] = '['
429  inserts[end] = ']'
430  else:
431  inserts[start] = '('
432  inserts[end] = ')'
433  for i in range(start + 1, end):
434  inserts[i] = '|'
435 
436  # collect all actions format strings
437  parts = []
438  for i, action in enumerate(actions):
439 
440  # suppressed arguments are marked with None
441  # remove | separators for suppressed arguments
442  if action.help is SUPPRESS:
443  parts.append(None)
444  if inserts.get(i) == '|':
445  inserts.pop(i)
446  elif inserts.get(i + 1) == '|':
447  inserts.pop(i + 1)
448 
449  # produce all arg strings
450  elif not action.option_strings:
451  part = self._format_args(action, action.dest)
452 
453  # if it's in a group, strip the outer []
454  if action in group_actions:
455  if part[0] == '[' and part[-1] == ']':
456  part = part[1:-1]
457 
458  # add the action string to the list
459  parts.append(part)
460 
461  # produce the first way to invoke the option in brackets
462  else:
463  option_string = action.option_strings[0]
464 
465  # if the Optional doesn't take a value, format is:
466  # -s or --long
467  if action.nargs == 0:
468  part = '%s' % option_string
469 
470  # if the Optional takes a value, format is:
471  # -s ARGS or --long ARGS
472  else:
473  default = action.dest.upper()
474  args_string = self._format_args(action, default)
475  part = '%s %s' % (option_string, args_string)
476 
477  # make it look optional if it's not required or in a group
478  if not action.required and action not in group_actions:
479  part = '[%s]' % part
480 
481  # add the action string to the list
482  parts.append(part)
483 
484  # insert things at the necessary indices
485  for i in _sorted(inserts, reverse=True):
486  parts[i:i] = [inserts[i]]
487 
488  # join all the action items with spaces
489  text = ' '.join([item for item in parts if item is not None])
490 
491  # clean up separators for mutually exclusive groups
492  open = r'[\[(]'
493  close = r'[\])]'
494  text = _re.sub(r'(%s) ' % open, r'\1', text)
495  text = _re.sub(r' (%s)' % close, r'\1', text)
496  text = _re.sub(r'%s *%s' % (open, close), r'', text)
497  text = _re.sub(r'\(([^|]*)\)', r'\1', text)
498  text = text.strip()
499 
500  # return the text
501  return text
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def argparse.HelpFormatter._format_args (   self,
  action,
  default_metavar 
)
private

Definition at line 593 of file argparse.py.

References argparse.HelpFormatter._metavar_formatter(), python.rootplot.argparse.HelpFormatter._metavar_formatter(), and join().

Referenced by argparse.HelpFormatter._format_action_invocation(), and argparse.HelpFormatter._format_actions_usage().

594  def _format_args(self, action, default_metavar):
595  get_metavar = self._metavar_formatter(action, default_metavar)
596  if action.nargs is None:
597  result = '%s' % get_metavar(1)
598  elif action.nargs == OPTIONAL:
599  result = '[%s]' % get_metavar(1)
600  elif action.nargs == ZERO_OR_MORE:
601  result = '[%s [%s ...]]' % get_metavar(2)
602  elif action.nargs == ONE_OR_MORE:
603  result = '%s [%s ...]' % get_metavar(2)
604  elif action.nargs is PARSER:
605  result = '%s ...' % get_metavar(1)
606  else:
607  formats = ['%s' for _ in range(action.nargs)]
608  result = ' '.join(formats) % get_metavar(action.nargs)
609  return result
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def argparse.HelpFormatter._format_text (   self,
  text 
)
private

Definition at line 502 of file argparse.py.

References argparse.HelpFormatter._current_indent, python.rootplot.argparse.HelpFormatter._current_indent, argparse.HelpFormatter._fill_text(), python.rootplot.argparse.HelpFormatter._fill_text(), python.rootplot.argparse.RawDescriptionHelpFormatter._fill_text(), Vispa.Main.RotatingIcon.RotatingIcon._width, Vispa.Gui.VispaWidget.TextField._width, TFitConstraintMGaus._width, argparse.HelpFormatter._width, and python.rootplot.argparse.HelpFormatter._width.

Referenced by argparse.HelpFormatter.add_text().

503  def _format_text(self, text):
504  text_width = self._width - self._current_indent
505  indent = ' ' * self._current_indent
506  return self._fill_text(text, text_width, indent) + '\n\n'
def argparse.HelpFormatter._format_usage (   self,
  usage,
  actions,
  groups,
  prefix 
)
private

Definition at line 320 of file argparse.py.

References argparse.HelpFormatter._current_indent, python.rootplot.argparse.HelpFormatter._current_indent, argparse.HelpFormatter._format_actions_usage(), python.rootplot.argparse.HelpFormatter._format_actions_usage(), argparse.HelpFormatter._prog, python.rootplot.argparse.HelpFormatter._prog, Vispa.Main.RotatingIcon.RotatingIcon._width, TFitConstraintMGaus._width, Vispa.Gui.VispaWidget.TextField._width, argparse.HelpFormatter._width, python.rootplot.argparse.HelpFormatter._width, cmsPerfStripChart.dict, and join().

Referenced by argparse.HelpFormatter.add_usage().

321  def _format_usage(self, usage, actions, groups, prefix):
322  if prefix is None:
323  prefix = _('usage: ')
324 
325  # if usage is specified, use that
326  if usage is not None:
327  usage = usage % dict(prog=self._prog)
328 
329  # if no optionals or positionals are available, usage is just prog
330  elif usage is None and not actions:
331  usage = '%(prog)s' % dict(prog=self._prog)
332 
333  # if optionals and positionals are available, calculate usage
334  elif usage is None:
335  prog = '%(prog)s' % dict(prog=self._prog)
336 
337  # split optionals from positionals
338  optionals = []
339  positionals = []
340  for action in actions:
341  if action.option_strings:
342  optionals.append(action)
343  else:
344  positionals.append(action)
345 
346  # build full usage string
347  format = self._format_actions_usage
348  action_usage = format(optionals + positionals, groups)
349  usage = ' '.join([s for s in [prog, action_usage] if s])
350 
351  # wrap the usage parts if it's too long
352  text_width = self._width - self._current_indent
353  if len(prefix) + len(usage) > text_width:
354 
355  # break usage into wrappable parts
356  part_regexp = r'\(.*?\)+|\[.*?\]+|\S+'
357  opt_usage = format(optionals, groups)
358  pos_usage = format(positionals, groups)
359  opt_parts = _re.findall(part_regexp, opt_usage)
360  pos_parts = _re.findall(part_regexp, pos_usage)
361  assert ' '.join(opt_parts) == opt_usage
362  assert ' '.join(pos_parts) == pos_usage
363 
364  # helper for wrapping lines
365  def get_lines(parts, indent, prefix=None):
366  lines = []
367  line = []
368  if prefix is not None:
369  line_len = len(prefix) - 1
370  else:
371  line_len = len(indent) - 1
372  for part in parts:
373  if line_len + 1 + len(part) > text_width:
374  lines.append(indent + ' '.join(line))
375  line = []
376  line_len = len(indent) - 1
377  line.append(part)
378  line_len += len(part) + 1
379  if line:
380  lines.append(indent + ' '.join(line))
381  if prefix is not None:
382  lines[0] = lines[0][len(indent):]
383  return lines
384 
385  # if prog is short, follow it with optionals or positionals
386  if len(prefix) + len(prog) <= 0.75 * text_width:
387  indent = ' ' * (len(prefix) + len(prog) + 1)
388  if opt_parts:
389  lines = get_lines([prog] + opt_parts, indent, prefix)
390  lines.extend(get_lines(pos_parts, indent))
391  elif pos_parts:
392  lines = get_lines([prog] + pos_parts, indent, prefix)
393  else:
394  lines = [prog]
395 
396  # if prog is long, put it on its own line
397  else:
398  indent = ' ' * len(prefix)
399  parts = opt_parts + pos_parts
400  lines = get_lines(parts, indent)
401  if len(lines) > 1:
402  lines = []
403  lines.extend(get_lines(opt_parts, indent))
404  lines.extend(get_lines(pos_parts, indent))
405  lines = [prog] + lines
406 
407  # join lines into usage
408  usage = '\n'.join(lines)
409 
410  # prefix with 'usage:'
411  return '%s%s\n\n' % (prefix, usage)
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def argparse.HelpFormatter._get_help_string (   self,
  action 
)
private

Definition at line 640 of file argparse.py.

Referenced by argparse.HelpFormatter._expand_help().

641  def _get_help_string(self, action):
642  return action.help
643 
def argparse.HelpFormatter._indent (   self)
private

Definition at line 216 of file argparse.py.

References argparse.HelpFormatter._current_indent, python.rootplot.argparse.HelpFormatter._current_indent, argparse.HelpFormatter._indent_increment, python.rootplot.argparse.HelpFormatter._indent_increment, PGeometricDet::Item._level, RPCMuonExtraStruct._level, TrackerGeometryCompare._level, MuonGeometryArrange._level, argparse.HelpFormatter._level, and python.rootplot.argparse.HelpFormatter._level.

Referenced by argparse.HelpFormatter._iter_indented_subactions(), and argparse.HelpFormatter.start_section().

217  def _indent(self):
219  self._level += 1
def argparse.HelpFormatter._iter_indented_subactions (   self,
  action 
)
private

Definition at line 620 of file argparse.py.

References argparse.HelpFormatter._dedent(), python.rootplot.argparse.HelpFormatter._dedent(), argparse.HelpFormatter._indent(), and python.rootplot.argparse.HelpFormatter._indent().

Referenced by argparse.HelpFormatter._format_action(), and argparse.HelpFormatter.add_argument().

621  def _iter_indented_subactions(self, action):
622  try:
623  get_subactions = action._get_subactions
624  except AttributeError:
625  pass
626  else:
627  self._indent()
628  for subaction in get_subactions():
629  yield subaction
630  self._dedent()
def argparse.HelpFormatter._join_parts (   self,
  part_strings 
)
private

Definition at line 315 of file argparse.py.

References join().

Referenced by argparse.HelpFormatter._format_action().

316  def _join_parts(self, part_strings):
317  return ''.join([part
318  for part in part_strings
319  if part and part is not SUPPRESS])
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def argparse.HelpFormatter._metavar_formatter (   self,
  action,
  default_metavar 
)
private

Definition at line 577 of file argparse.py.

References cmsPerfStripChart.format, and join().

Referenced by argparse.HelpFormatter._format_action_invocation(), and argparse.HelpFormatter._format_args().

578  def _metavar_formatter(self, action, default_metavar):
579  if action.metavar is not None:
580  result = action.metavar
581  elif action.choices is not None:
582  choice_strs = [str(choice) for choice in action.choices]
583  result = '{%s}' % ','.join(choice_strs)
584  else:
585  result = default_metavar
586 
587  def format(tuple_size):
588  if isinstance(result, tuple):
589  return result
590  else:
591  return (result, ) * tuple_size
592  return format
string format
Some error handling for the usage.
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def argparse.HelpFormatter._split_lines (   self,
  text,
  width 
)
private

Definition at line 631 of file argparse.py.

Referenced by argparse.HelpFormatter._format_action().

632  def _split_lines(self, text, width):
633  text = self._whitespace_matcher.sub(' ', text).strip()
634  return _textwrap.wrap(text, width)
def argparse.HelpFormatter.add_argument (   self,
  action 
)

Definition at line 283 of file argparse.py.

References argparse.HelpFormatter._action_max_length, python.rootplot.argparse.HelpFormatter._action_max_length, argparse.HelpFormatter._add_item(), python.rootplot.argparse.HelpFormatter._add_item(), argparse.HelpFormatter._current_indent, python.rootplot.argparse.HelpFormatter._current_indent, argparse.HelpFormatter._format_action(), python.rootplot.argparse.HelpFormatter._format_action(), argparse.HelpFormatter._format_action_invocation(), python.rootplot.argparse.HelpFormatter._format_action_invocation(), argparse.HelpFormatter._iter_indented_subactions(), python.rootplot.argparse.HelpFormatter._iter_indented_subactions(), and bookConverter.max.

Referenced by argparse.HelpFormatter.add_arguments().

284  def add_argument(self, action):
285  if action.help is not SUPPRESS:
286 
287  # find all invocations
288  get_invocation = self._format_action_invocation
289  invocations = [get_invocation(action)]
290  for subaction in self._iter_indented_subactions(action):
291  invocations.append(get_invocation(subaction))
292 
293  # update the maximum item length
294  invocation_length = max([len(s) for s in invocations])
295  action_length = invocation_length + self._current_indent
297  action_length)
298 
299  # add the item to the list
300  self._add_item(self._format_action, [action])
def argparse.HelpFormatter.add_arguments (   self,
  actions 
)

Definition at line 301 of file argparse.py.

References argparse.HelpFormatter.add_argument(), python.rootplot.argparse.HelpFormatter.add_argument(), and python.rootplot.argparse._ActionsContainer.add_argument().

302  def add_arguments(self, actions):
303  for action in actions:
304  self.add_argument(action)
def argparse.HelpFormatter.add_text (   self,
  text 
)

Definition at line 274 of file argparse.py.

References argparse.HelpFormatter._add_item(), python.rootplot.argparse.HelpFormatter._add_item(), argparse.HelpFormatter._format_text(), and python.rootplot.argparse.HelpFormatter._format_text().

275  def add_text(self, text):
276  if text is not SUPPRESS and text is not None:
277  self._add_item(self._format_text, [text])
def argparse.HelpFormatter.add_usage (   self,
  usage,
  actions,
  groups,
  prefix = None 
)

Definition at line 278 of file argparse.py.

References argparse.HelpFormatter._add_item(), python.rootplot.argparse.HelpFormatter._add_item(), argparse.HelpFormatter._format_usage(), and python.rootplot.argparse.HelpFormatter._format_usage().

279  def add_usage(self, usage, actions, groups, prefix=None):
280  if usage is not SUPPRESS:
281  args = usage, actions, groups, prefix
282  self._add_item(self._format_usage, args)
def argparse.HelpFormatter.end_section (   self)

Definition at line 270 of file argparse.py.

References argparse.HelpFormatter._current_section, python.rootplot.argparse.HelpFormatter._current_section, argparse.HelpFormatter._dedent(), and python.rootplot.argparse.HelpFormatter._dedent().

271  def end_section(self):
272  self._current_section = self._current_section.parent
273  self._dedent()
def argparse.HelpFormatter.format_help (   self)

Definition at line 308 of file argparse.py.

Referenced by argparse.ArgumentParser.print_help().

309  def format_help(self):
310  help = self._root_section.format_help()
311  if help:
312  help = self._long_break_matcher.sub('\n\n', help)
313  help = help.strip('\n') + '\n'
314  return help
def argparse.HelpFormatter.start_section (   self,
  heading 
)

Definition at line 264 of file argparse.py.

References argparse.HelpFormatter._add_item(), python.rootplot.argparse.HelpFormatter._add_item(), argparse.HelpFormatter._current_section, python.rootplot.argparse.HelpFormatter._current_section, argparse.HelpFormatter._indent(), and python.rootplot.argparse.HelpFormatter._indent().

265  def start_section(self, heading):
266  self._indent()
267  section = self._Section(self, self._current_section, heading)
268  self._add_item(section.format_help, [])
269  self._current_section = section

Member Data Documentation

argparse.HelpFormatter._action_max_length
private

Definition at line 205 of file argparse.py.

Referenced by argparse.HelpFormatter._format_action(), and argparse.HelpFormatter.add_argument().

argparse.HelpFormatter._current_indent
private

Definition at line 203 of file argparse.py.

Referenced by argparse.HelpFormatter._dedent(), argparse.HelpFormatter._format_action(), argparse.HelpFormatter._format_text(), argparse.HelpFormatter._format_usage(), argparse.HelpFormatter._indent(), and argparse.HelpFormatter.add_argument().

argparse.HelpFormatter._current_section
private

Definition at line 208 of file argparse.py.

Referenced by argparse.HelpFormatter.end_section(), and argparse.HelpFormatter.start_section().

argparse.HelpFormatter._indent_increment
private

Definition at line 199 of file argparse.py.

Referenced by argparse.HelpFormatter._dedent(), and argparse.HelpFormatter._indent().

argparse.HelpFormatter._level
private

Definition at line 204 of file argparse.py.

Referenced by argparse.HelpFormatter._dedent(), and argparse.HelpFormatter._indent().

argparse.HelpFormatter._long_break_matcher
private

Definition at line 211 of file argparse.py.

argparse.HelpFormatter._max_help_position
private

Definition at line 200 of file argparse.py.

Referenced by argparse.HelpFormatter._format_action().

argparse.HelpFormatter._prog
private

Definition at line 198 of file argparse.py.

Referenced by argparse.HelpFormatter._expand_help(), and argparse.HelpFormatter._format_usage().

argparse.HelpFormatter._root_section
private

Definition at line 207 of file argparse.py.

argparse.HelpFormatter._whitespace_matcher
private

Definition at line 210 of file argparse.py.

argparse.HelpFormatter._width
private

Definition at line 201 of file argparse.py.

Referenced by argparse.HelpFormatter._format_action(), argparse.HelpFormatter._format_text(), and argparse.HelpFormatter._format_usage().