CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
python.rootplot.argparse.ArgumentParser Class Reference
Inheritance diagram for python.rootplot.argparse.ArgumentParser:
python.rootplot.argparse._AttributeHolder python.rootplot.argparse._ActionsContainer

Public Member Functions

def __init__
 
def add_subparsers
 
def convert_arg_line_to_args
 
def error
 
def exit
 
def format_help
 
def format_usage
 
def format_version
 
def parse_args
 
def parse_known_args
 
def print_help
 
def print_usage
 
def print_version
 
- Public Member Functions inherited from python.rootplot.argparse._AttributeHolder
def __repr__
 
- Public Member Functions inherited from python.rootplot.argparse._ActionsContainer
def __init__
 
def add_argument
 
def add_argument_group
 
def add_mutually_exclusive_group
 
def get_default
 
def register
 
def set_defaults
 

Public Attributes

 add_help
 
 epilog
 
 formatter_class
 
 fromfile_prefix_chars
 
 prog
 
 usage
 
 version
 
- Public Attributes inherited from python.rootplot.argparse._ActionsContainer
 argument_default
 
 conflict_handler
 
 description
 
 prefix_chars
 

Private Member Functions

def _add_action
 
def _check_value
 
def _get_formatter
 
def _get_kwargs
 
def _get_nargs_pattern
 
def _get_option_tuples
 
def _get_optional_actions
 
def _get_positional_actions
 
def _get_value
 
def _get_values
 
def _match_argument
 
def _match_arguments_partial
 
def _parse_known_args
 
def _parse_optional
 
def _print_message
 
def _read_args_from_files
 

Private Attributes

 _optionals
 
 _positionals
 
 _subparsers
 

Detailed Description

Object for parsing command line strings into Python objects.

Keyword Arguments:
    - prog -- The name of the program (default: sys.argv[0])
    - usage -- A usage message (default: auto-generated from arguments)
    - description -- A description of what the program does
    - epilog -- Text following the argument descriptions
    - parents -- Parsers whose arguments should be copied into this one
    - formatter_class -- HelpFormatter class for printing help messages
    - prefix_chars -- Characters that prefix optional arguments
    - fromfile_prefix_chars -- Characters that prefix files containing
        additional arguments
    - argument_default -- The default value for all arguments
    - conflict_handler -- String indicating how to handle conflicts
    - add_help -- Add a -h/-help option

Definition at line 1538 of file argparse.py.

Constructor & Destructor Documentation

def python.rootplot.argparse.ArgumentParser.__init__ (   self,
  prog = None,
  usage = None,
  description = None,
  epilog = None,
  version = None,
  parents = [],
  formatter_class = HelpFormatter,
  prefix_chars = '-',
  fromfile_prefix_chars = None,
  argument_default = None,
  conflict_handler = 'error',
  add_help = True 
)

Definition at line 1568 of file argparse.py.

1569  add_help=True):
1570 
1571  if version is not None:
1572  import warnings
1573  warnings.warn(
1574  """The "version" argument to ArgumentParser is deprecated. """
1575  """Please use """
1576  """"add_argument(..., action='version', version="N", ...)" """
1577  """instead""", DeprecationWarning)
1578 
1579  superinit = super(ArgumentParser, self).__init__
1580  superinit(description=description,
1581  prefix_chars=prefix_chars,
1582  argument_default=argument_default,
1583  conflict_handler=conflict_handler)
1584 
1585  # default setting for prog
1586  if prog is None:
1587  prog = _os.path.basename(_sys.argv[0])
1589  self.prog = prog
1590  self.usage = usage
1591  self.epilog = epilog
1592  self.version = version
1593  self.formatter_class = formatter_class
1594  self.fromfile_prefix_chars = fromfile_prefix_chars
1595  self.add_help = add_help
1596 
1597  add_group = self.add_argument_group
1598  self._positionals = add_group(_('positional arguments'))
1599  self._optionals = add_group(_('optional arguments'))
1600  self._subparsers = None
1601 
1602  # register types
1603  def identity(string):
1604  return string
1605  self.register('type', None, identity)
1606 
1607  # add help and version arguments if necessary
1608  # (using explicit default to override global argument_default)
1609  if self.add_help:
1610  self.add_argument(
1611  '-h', '--help', action='help', default=SUPPRESS,
1612  help=_('show this help message and exit'))
1613  if self.version:
1614  self.add_argument(
1615  '-v', '--version', action='version', default=SUPPRESS,
1616  version=self.version,
1617  help=_("show program's version number and exit"))
1618 
1619  # add parent arguments and defaults
1620  for parent in parents:
1621  self._add_container_actions(parent)
1622  try:
1623  defaults = parent._defaults
1624  except AttributeError:
1625  pass
1626  else:
1627  self._defaults.update(defaults)

Member Function Documentation

def python.rootplot.argparse.ArgumentParser._add_action (   self,
  action 
)
private

Definition at line 1677 of file argparse.py.

1678  def _add_action(self, action):
1679  if action.option_strings:
1680  self._optionals._add_action(action)
1681  else:
1682  self._positionals._add_action(action)
1683  return action
def python.rootplot.argparse.ArgumentParser._check_value (   self,
  action,
  value 
)
private

Definition at line 2256 of file argparse.py.

References join(), and python.multivaluedict.map().

Referenced by python.rootplot.argparse.ArgumentParser._get_values().

2257  def _check_value(self, action, value):
2258  # converted value must be one of the choices (if specified)
2259  if action.choices is not None and value not in action.choices:
2260  tup = value, ', '.join(map(repr, action.choices))
2261  msg = _('invalid choice: %r (choose from %s)') % tup
2262  raise ArgumentError(action, msg)
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def python.rootplot.argparse.ArgumentParser._get_formatter (   self)
private

Definition at line 2305 of file argparse.py.

References argparse.ArgumentParser.formatter_class, python.rootplot.argparse.ArgumentParser.formatter_class, argparse.ArgumentParser.prog, and python.rootplot.argparse.ArgumentParser.prog.

Referenced by argparse._ActionsContainer.add_argument(), python.rootplot.argparse.ArgumentParser.add_subparsers(), python.rootplot.argparse.ArgumentParser.format_help(), python.rootplot.argparse.ArgumentParser.format_usage(), and python.rootplot.argparse.ArgumentParser.format_version().

2306  def _get_formatter(self):
2307  return self.formatter_class(prog=self.prog)
def python.rootplot.argparse.ArgumentParser._get_kwargs (   self)
private

Definition at line 1631 of file argparse.py.

1632  def _get_kwargs(self):
1633  names = [
1634  'prog',
1635  'usage',
1636  'description',
1637  'version',
1638  'formatter_class',
1639  'conflict_handler',
1640  'add_help',
1641  ]
1642  return [(name, getattr(self, name)) for name in names]
def python.rootplot.argparse.ArgumentParser._get_nargs_pattern (   self,
  action 
)
private

Definition at line 2138 of file argparse.py.

References join().

Referenced by python.rootplot.argparse.ArgumentParser._match_argument(), and python.rootplot.argparse.ArgumentParser._match_arguments_partial().

2139  def _get_nargs_pattern(self, action):
2140  # in all examples below, we have to allow for '--' args
2141  # which are represented as '-' in the pattern
2142  nargs = action.nargs
2143 
2144  # the default (None) is assumed to be a single argument
2145  if nargs is None:
2146  nargs_pattern = '(-*A-*)'
2147 
2148  # allow zero or one arguments
2149  elif nargs == OPTIONAL:
2150  nargs_pattern = '(-*A?-*)'
2151 
2152  # allow zero or more arguments
2153  elif nargs == ZERO_OR_MORE:
2154  nargs_pattern = '(-*[A-]*)'
2155 
2156  # allow one or more arguments
2157  elif nargs == ONE_OR_MORE:
2158  nargs_pattern = '(-*A[A-]*)'
2159 
2160  # allow any number of options or arguments
2161  elif nargs == REMAINDER:
2162  nargs_pattern = '([-AO]*)'
2163 
2164  # allow one argument followed by any number of options or arguments
2165  elif nargs == PARSER:
2166  nargs_pattern = '(-*A[-AO]*)'
2167 
2168  # all others should be integers
2169  else:
2170  nargs_pattern = '(-*%s-*)' % '-*'.join('A' * nargs)
2171 
2172  # if this is an optional action, -- is not allowed
2173  if action.option_strings:
2174  nargs_pattern = nargs_pattern.replace('-*', '')
2175  nargs_pattern = nargs_pattern.replace('-', '')
2176 
2177  # return the pattern
2178  return nargs_pattern
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def python.rootplot.argparse.ArgumentParser._get_option_tuples (   self,
  option_string 
)
private

Definition at line 2094 of file argparse.py.

References argparse._ActionsContainer._option_string_actions, python.rootplot.argparse._ActionsContainer._option_string_actions, argparse._ArgumentGroup._option_string_actions, MomentumConstraint.error, pat::MHT.error(), BinomialProbability.error(), EcalUncalibRecHitRatioMethodAlgo< C >::Ratio.error, CSCPairConstraint.error(), Measurement1DFloat.error(), EcalUncalibRecHitRatioMethodAlgo< C >::Tmax.error, SiStripLaserRecHit2D.error, SaxToDom.error(), Measurement1D.error(), SamplingAnalysis.error(), SaxToDom2.error(), pat::LookupTableRecord.error(), FedTimingAnalysis.error(), ApvTimingAnalysis.error(), CSCPairResidualsConstraint.error(), edm::HLTGlobalStatus.error(), edm::HLTPathStatus.error(), edm::TriggerResultsByName.error(), PhysicsTools::Calibration::Histogram< Value_t, Axis_t >.error(), PTrajectoryStateOnDet.error(), cscdqm::XMLFileErrorHandler.error(), lhef::LHERunInfo::XSec.error(), PhysicsTools::Calibration::Histogram2D< Value_t, AxisX_t, AxisY_t >.error(), MuonErrorMatrix.error, DDLSAX2Handler.error(), PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >.error(), SimpleSAXParser::ParserError.error(), reco::Vertex.error(), CSCDCCExaminer.error(), reco::TrackBase.error(), MatacqTBRawEvent.error, MatacqRawEvent.error, TiXmlDocument.error, argparse.ArgumentParser.error(), python.rootplot.argparse.ArgumentParser.error(), argparse._ActionsContainer.prefix_chars, and python.rootplot.argparse._ActionsContainer.prefix_chars.

Referenced by python.rootplot.argparse.ArgumentParser._parse_optional().

2095  def _get_option_tuples(self, option_string):
2096  result = []
2097 
2098  # option strings starting with two prefix characters are only
2099  # split at the '='
2100  chars = self.prefix_chars
2101  if option_string[0] in chars and option_string[1] in chars:
2102  if '=' in option_string:
2103  option_prefix, explicit_arg = option_string.split('=', 1)
2104  else:
2105  option_prefix = option_string
2106  explicit_arg = None
2107  for option_string in self._option_string_actions:
2108  if option_string.startswith(option_prefix):
2109  action = self._option_string_actions[option_string]
2110  tup = action, option_string, explicit_arg
2111  result.append(tup)
2112 
2113  # single character options can be concatenated with their arguments
2114  # but multiple character options always have to have their argument
2115  # separate
2116  elif option_string[0] in chars and option_string[1] not in chars:
2117  option_prefix = option_string
2118  explicit_arg = None
2119  short_option_prefix = option_string[:2]
2120  short_explicit_arg = option_string[2:]
2121 
2122  for option_string in self._option_string_actions:
2123  if option_string == short_option_prefix:
2124  action = self._option_string_actions[option_string]
2125  tup = action, option_string, short_explicit_arg
2126  result.append(tup)
2127  elif option_string.startswith(option_prefix):
2128  action = self._option_string_actions[option_string]
2129  tup = action, option_string, explicit_arg
2130  result.append(tup)
2131 
2132  # shouldn't ever get here
2133  else:
2134  self.error(_('unexpected option string: %s') % option_string)
2135 
2136  # return the collected option tuples
2137  return result
def python.rootplot.argparse.ArgumentParser._get_optional_actions (   self)
private

Definition at line 1684 of file argparse.py.

References argparse._ActionsContainer._actions, python.rootplot.argparse._ActionsContainer._actions, and argparse._ArgumentGroup._actions.

1685  def _get_optional_actions(self):
1686  return [action
1687  for action in self._actions
1688  if action.option_strings]
def python.rootplot.argparse.ArgumentParser._get_positional_actions (   self)
private

Definition at line 1689 of file argparse.py.

References argparse._ActionsContainer._actions, python.rootplot.argparse._ActionsContainer._actions, and argparse._ArgumentGroup._actions.

Referenced by python.rootplot.argparse.ArgumentParser._parse_known_args(), and python.rootplot.argparse.ArgumentParser.add_subparsers().

1690  def _get_positional_actions(self):
1691  return [action
1692  for action in self._actions
1693  if not action.option_strings]
def python.rootplot.argparse.ArgumentParser._get_value (   self,
  action,
  arg_string 
)
private

Definition at line 2231 of file argparse.py.

References python.rootplot.argparse._callable(), argparse._ActionsContainer._registry_get(), and python.rootplot.argparse._ActionsContainer._registry_get().

Referenced by python.rootplot.argparse.ArgumentParser._get_values(), and python.rootplot.argparse.ArgumentParser.parse_known_args().

2232  def _get_value(self, action, arg_string):
2233  type_func = self._registry_get('type', action.type, action.type)
2234  if not _callable(type_func):
2235  msg = _('%r is not callable')
2236  raise ArgumentError(action, msg % type_func)
2237 
2238  # convert the value to the appropriate type
2239  try:
2240  result = type_func(arg_string)
2241 
2242  # ArgumentTypeErrors indicate errors
2243  except ArgumentTypeError:
2244  name = getattr(action.type, '__name__', repr(action.type))
2245  msg = str(_sys.exc_info()[1])
2246  raise ArgumentError(action, msg)
2247 
2248  # TypeErrors or ValueErrors also indicate errors
2249  except (TypeError, ValueError):
2250  name = getattr(action.type, '__name__', repr(action.type))
2251  msg = _('invalid %s value: %r')
2252  raise ArgumentError(action, msg % (name, arg_string))
2253 
2254  # return the converted value
2255  return result
def python.rootplot.argparse.ArgumentParser._get_values (   self,
  action,
  arg_strings 
)
private

Definition at line 2182 of file argparse.py.

References argparse.ArgumentParser._check_value(), python.rootplot.argparse.ArgumentParser._check_value(), argparse.ArgumentParser._get_value(), and python.rootplot.argparse.ArgumentParser._get_value().

Referenced by python.rootplot.argparse.ArgumentParser._parse_known_args().

2183  def _get_values(self, action, arg_strings):
2184  # for everything but PARSER args, strip out '--'
2185  if action.nargs not in [PARSER, REMAINDER]:
2186  arg_strings = [s for s in arg_strings if s != '--']
2187 
2188  # optional argument produces a default when not present
2189  if not arg_strings and action.nargs == OPTIONAL:
2190  if action.option_strings:
2191  value = action.const
2192  else:
2193  value = action.default
2194  if isinstance(value, _basestring):
2195  value = self._get_value(action, value)
2196  self._check_value(action, value)
2197 
2198  # when nargs='*' on a positional, if there were no command-line
2199  # args, use the default if it is anything other than None
2200  elif (not arg_strings and action.nargs == ZERO_OR_MORE and
2201  not action.option_strings):
2202  if action.default is not None:
2203  value = action.default
2204  else:
2205  value = arg_strings
2206  self._check_value(action, value)
2207 
2208  # single argument or optional argument produces a single value
2209  elif len(arg_strings) == 1 and action.nargs in [None, OPTIONAL]:
2210  arg_string, = arg_strings
2211  value = self._get_value(action, arg_string)
2212  self._check_value(action, value)
2213 
2214  # REMAINDER arguments convert all values, checking none
2215  elif action.nargs == REMAINDER:
2216  value = [self._get_value(action, v) for v in arg_strings]
2217 
2218  # PARSER arguments convert all values, but check only the first
2219  elif action.nargs == PARSER:
2220  value = [self._get_value(action, v) for v in arg_strings]
2221  self._check_value(action, value[0])
2222 
2223  # all other types of nargs produce a list
2224  else:
2225  value = [self._get_value(action, v) for v in arg_strings]
2226  for v in value:
2227  self._check_value(action, v)
2228 
2229  # return the converted value
2230  return value
def python.rootplot.argparse.ArgumentParser._match_argument (   self,
  action,
  arg_strings_pattern 
)
private

Definition at line 2002 of file argparse.py.

References argparse.ArgumentParser._get_nargs_pattern(), and python.rootplot.argparse.ArgumentParser._get_nargs_pattern().

Referenced by python.rootplot.argparse.ArgumentParser._parse_known_args().

2003  def _match_argument(self, action, arg_strings_pattern):
2004  # match the pattern for this action to the arg strings
2005  nargs_pattern = self._get_nargs_pattern(action)
2006  match = _re.match(nargs_pattern, arg_strings_pattern)
2007 
2008  # raise an exception if we weren't able to find a match
2009  if match is None:
2010  nargs_errors = {
2011  None: _('expected one argument'),
2012  OPTIONAL: _('expected at most one argument'),
2013  ONE_OR_MORE: _('expected at least one argument'),
2014  }
2015  default = _('expected %s argument(s)') % action.nargs
2016  msg = nargs_errors.get(action.nargs, default)
2017  raise ArgumentError(action, msg)
2018 
2019  # return the number of arguments matched
2020  return len(match.group(1))
def python.rootplot.argparse.ArgumentParser._match_arguments_partial (   self,
  actions,
  arg_strings_pattern 
)
private

Definition at line 2021 of file argparse.py.

References argparse.ArgumentParser._get_nargs_pattern(), python.rootplot.argparse.ArgumentParser._get_nargs_pattern(), and join().

Referenced by python.rootplot.argparse.ArgumentParser._parse_known_args().

2022  def _match_arguments_partial(self, actions, arg_strings_pattern):
2023  # progressively shorten the actions list by slicing off the
2024  # final actions until we find a match
2025  result = []
2026  for i in range(len(actions), 0, -1):
2027  actions_slice = actions[:i]
2028  pattern = ''.join([self._get_nargs_pattern(action)
2029  for action in actions_slice])
2030  match = _re.match(pattern, arg_strings_pattern)
2031  if match is not None:
2032  result.extend([len(string) for string in match.groups()])
2033  break
2034 
2035  # return the list of arg string counts
2036  return result
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def python.rootplot.argparse.ArgumentParser._parse_known_args (   self,
  arg_strings,
  namespace 
)
private

Definition at line 1735 of file argparse.py.

References argparse._ActionsContainer._actions, python.rootplot.argparse._ActionsContainer._actions, argparse._ArgumentGroup._actions, python.rootplot.argparse._get_action_name(), argparse.ArgumentParser._get_positional_actions(), python.rootplot.argparse.ArgumentParser._get_positional_actions(), argparse.ArgumentParser._get_values(), python.rootplot.argparse.ArgumentParser._get_values(), argparse.ArgumentParser._match_argument(), python.rootplot.argparse.ArgumentParser._match_argument(), argparse.ArgumentParser._match_arguments_partial(), python.rootplot.argparse.ArgumentParser._match_arguments_partial(), argparse._ActionsContainer._mutually_exclusive_groups, python.rootplot.argparse._ActionsContainer._mutually_exclusive_groups, argparse._ArgumentGroup._mutually_exclusive_groups, argparse._ActionsContainer._option_string_actions, python.rootplot.argparse._ActionsContainer._option_string_actions, argparse._ArgumentGroup._option_string_actions, argparse.ArgumentParser._parse_optional(), python.rootplot.argparse.ArgumentParser._parse_optional(), argparse.ArgumentParser._read_args_from_files(), python.rootplot.argparse.ArgumentParser._read_args_from_files(), python.rootplot.argparse._set, python.rootplot.argparse.action, MomentumConstraint.error, pat::MHT.error(), BinomialProbability.error(), EcalUncalibRecHitRatioMethodAlgo< C >::Ratio.error, CSCPairConstraint.error(), Measurement1DFloat.error(), EcalUncalibRecHitRatioMethodAlgo< C >::Tmax.error, SiStripLaserRecHit2D.error, Measurement1D.error(), SaxToDom.error(), SamplingAnalysis.error(), pat::LookupTableRecord.error(), SaxToDom2.error(), FedTimingAnalysis.error(), ApvTimingAnalysis.error(), CSCPairResidualsConstraint.error(), edm::HLTGlobalStatus.error(), edm::HLTPathStatus.error(), edm::TriggerResultsByName.error(), PhysicsTools::Calibration::Histogram< Value_t, Axis_t >.error(), PTrajectoryStateOnDet.error(), cscdqm::XMLFileErrorHandler.error(), lhef::LHERunInfo::XSec.error(), PhysicsTools::Calibration::Histogram2D< Value_t, AxisX_t, AxisY_t >.error(), MuonErrorMatrix.error, DDLSAX2Handler.error(), PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >.error(), SimpleSAXParser::ParserError.error(), reco::Vertex.error(), CSCDCCExaminer.error(), reco::TrackBase.error(), MatacqTBRawEvent.error, MatacqRawEvent.error, TiXmlDocument.error, argparse.ArgumentParser.error(), python.rootplot.argparse.ArgumentParser.error(), argparse.ArgumentParser.fromfile_prefix_chars, python.rootplot.argparse.ArgumentParser.fromfile_prefix_chars, join(), max(), min, argparse._ActionsContainer.prefix_chars, and python.rootplot.argparse._ActionsContainer.prefix_chars.

Referenced by python.rootplot.argparse.ArgumentParser.parse_known_args().

1736  def _parse_known_args(self, arg_strings, namespace):
1737  # replace arg strings that are file references
1738  if self.fromfile_prefix_chars is not None:
1739  arg_strings = self._read_args_from_files(arg_strings)
1740 
1741  # map all mutually exclusive arguments to the other arguments
1742  # they can't occur with
1743  action_conflicts = {}
1744  for mutex_group in self._mutually_exclusive_groups:
1745  group_actions = mutex_group._group_actions
1746  for i, mutex_action in enumerate(mutex_group._group_actions):
1747  conflicts = action_conflicts.setdefault(mutex_action, [])
1748  conflicts.extend(group_actions[:i])
1749  conflicts.extend(group_actions[i + 1:])
1750 
1751  # find all option indices, and determine the arg_string_pattern
1752  # which has an 'O' if there is an option at an index,
1753  # an 'A' if there is an argument, or a '-' if there is a '--'
1754  option_string_indices = {}
1755  arg_string_pattern_parts = []
1756  arg_strings_iter = iter(arg_strings)
1757  for i, arg_string in enumerate(arg_strings_iter):
1758 
1759  # all args after -- are non-options
1760  if arg_string == '--':
1761  arg_string_pattern_parts.append('-')
1762  for arg_string in arg_strings_iter:
1763  arg_string_pattern_parts.append('A')
1764 
1765  # otherwise, add the arg to the arg strings
1766  # and note the index if it was an option
1767  else:
1768  option_tuple = self._parse_optional(arg_string)
1769  if option_tuple is None:
1770  pattern = 'A'
1771  else:
1772  option_string_indices[i] = option_tuple
1773  pattern = 'O'
1774  arg_string_pattern_parts.append(pattern)
1775 
1776  # join the pieces together to form the pattern
1777  arg_strings_pattern = ''.join(arg_string_pattern_parts)
1778 
1779  # converts arg strings to the appropriate and then takes the action
1780  seen_actions = _set()
1781  seen_non_default_actions = _set()
1782 
1783  def take_action(action, argument_strings, option_string=None):
1784  seen_actions.add(action)
1785  argument_values = self._get_values(action, argument_strings)
1786 
1787  # error if this argument is not allowed with other previously
1788  # seen arguments, assuming that actions that use the default
1789  # value don't really count as "present"
1790  if argument_values is not action.default:
1791  seen_non_default_actions.add(action)
1792  for conflict_action in action_conflicts.get(action, []):
1793  if conflict_action in seen_non_default_actions:
1794  msg = _('not allowed with argument %s')
1795  action_name = _get_action_name(conflict_action)
1796  raise ArgumentError(action, msg % action_name)
1797 
1798  # take the action if we didn't receive a SUPPRESS value
1799  # (e.g. from a default)
1800  if argument_values is not SUPPRESS:
1801  action(self, namespace, argument_values, option_string)
1802 
1803  # function to convert arg_strings into an optional action
1804  def consume_optional(start_index):
1805 
1806  # get the optional identified at this index
1807  option_tuple = option_string_indices[start_index]
1808  action, option_string, explicit_arg = option_tuple
1809 
1810  # identify additional optionals in the same arg string
1811  # (e.g. -xyz is the same as -x -y -z if no args are required)
1812  match_argument = self._match_argument
1813  action_tuples = []
1814  while True:
1815 
1816  # if we found no optional action, skip it
1817  if action is None:
1818  extras.append(arg_strings[start_index])
1819  return start_index + 1
1820 
1821  # if there is an explicit argument, try to match the
1822  # optional's string arguments to only this
1823  if explicit_arg is not None:
1824  arg_count = match_argument(action, 'A')
1825 
1826  # if the action is a single-dash option and takes no
1827  # arguments, try to parse more single-dash options out
1828  # of the tail of the option string
1829  chars = self.prefix_chars
1830  if arg_count == 0 and option_string[1] not in chars:
1831  action_tuples.append((action, [], option_string))
1832  for char in self.prefix_chars:
1833  option_string = char + explicit_arg[0]
1834  explicit_arg = explicit_arg[1:] or None
1835  optionals_map = self._option_string_actions
1836  if option_string in optionals_map:
1837  action = optionals_map[option_string]
1838  break
1839  else:
1840  msg = _('ignored explicit argument %r')
1841  raise ArgumentError(action, msg % explicit_arg)
1842 
1843  # if the action expect exactly one argument, we've
1844  # successfully matched the option; exit the loop
1845  elif arg_count == 1:
1846  stop = start_index + 1
1847  args = [explicit_arg]
1848  action_tuples.append((action, args, option_string))
1849  break
1850 
1851  # error if a double-dash option did not use the
1852  # explicit argument
1853  else:
1854  msg = _('ignored explicit argument %r')
1855  raise ArgumentError(action, msg % explicit_arg)
1856 
1857  # if there is no explicit argument, try to match the
1858  # optional's string arguments with the following strings
1859  # if successful, exit the loop
1860  else:
1861  start = start_index + 1
1862  selected_patterns = arg_strings_pattern[start:]
1863  arg_count = match_argument(action, selected_patterns)
1864  stop = start + arg_count
1865  args = arg_strings[start:stop]
1866  action_tuples.append((action, args, option_string))
1867  break
1868 
1869  # add the Optional to the list and return the index at which
1870  # the Optional's string args stopped
1871  assert action_tuples
1872  for action, args, option_string in action_tuples:
1873  take_action(action, args, option_string)
1874  return stop
1875 
1876  # the list of Positionals left to be parsed; this is modified
1877  # by consume_positionals()
1878  positionals = self._get_positional_actions()
1879 
1880  # function to convert arg_strings into positional actions
1881  def consume_positionals(start_index):
1882  # match as many Positionals as possible
1883  match_partial = self._match_arguments_partial
1884  selected_pattern = arg_strings_pattern[start_index:]
1885  arg_counts = match_partial(positionals, selected_pattern)
1886 
1887  # slice off the appropriate arg strings for each Positional
1888  # and add the Positional and its args to the list
1889  for action, arg_count in zip(positionals, arg_counts):
1890  args = arg_strings[start_index: start_index + arg_count]
1891  start_index += arg_count
1892  take_action(action, args)
1893 
1894  # slice off the Positionals that we just parsed and return the
1895  # index at which the Positionals' string args stopped
1896  positionals[:] = positionals[len(arg_counts):]
1897  return start_index
1898 
1899  # consume Positionals and Optionals alternately, until we have
1900  # passed the last option string
1901  extras = []
1902  start_index = 0
1903  if option_string_indices:
1904  max_option_string_index = max(option_string_indices)
1905  else:
1906  max_option_string_index = -1
1907  while start_index <= max_option_string_index:
1908 
1909  # consume any Positionals preceding the next option
1910  next_option_string_index = min([
1911  index
1912  for index in option_string_indices
1913  if index >= start_index])
1914  if start_index != next_option_string_index:
1915  positionals_end_index = consume_positionals(start_index)
1916 
1917  # only try to parse the next optional if we didn't consume
1918  # the option string during the positionals parsing
1919  if positionals_end_index > start_index:
1920  start_index = positionals_end_index
1921  continue
1922  else:
1923  start_index = positionals_end_index
1924 
1925  # if we consumed all the positionals we could and we're not
1926  # at the index of an option string, there were extra arguments
1927  if start_index not in option_string_indices:
1928  strings = arg_strings[start_index:next_option_string_index]
1929  extras.extend(strings)
1930  start_index = next_option_string_index
1931 
1932  # consume the next optional and any arguments for it
1933  start_index = consume_optional(start_index)
1934 
1935  # consume any positionals following the last Optional
1936  stop_index = consume_positionals(start_index)
1937 
1938  # if we didn't consume all the argument strings, there were extras
1939  extras.extend(arg_strings[stop_index:])
1940 
1941  # if we didn't use all the Positional objects, there were too few
1942  # arg strings supplied.
1943  if positionals:
1944  self.error(_('too few arguments'))
1945 
1946  # make sure all required actions were present
1947  for action in self._actions:
1948  if action.required:
1949  if action not in seen_actions:
1950  name = _get_action_name(action)
1951  self.error(_('argument %s is required') % name)
1952 
1953  # make sure all required groups had one option present
1954  for group in self._mutually_exclusive_groups:
1955  if group.required:
1956  for action in group._group_actions:
1957  if action in seen_non_default_actions:
1958  break
1959 
1960  # if no actions were used, report the error
1961  else:
1962  names = [_get_action_name(action)
1963  for action in group._group_actions
1964  if action.help is not SUPPRESS]
1965  msg = _('one of the arguments %s is required')
1966  self.error(msg % ' '.join(names))
1967 
1968  # return the updated namespace and the extra arguments
1969  return namespace, extras
#define min(a, b)
Definition: mlp_lapack.h:161
const T & max(const T &a, const T &b)
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def python.rootplot.argparse.ArgumentParser._parse_optional (   self,
  arg_string 
)
private

Definition at line 2037 of file argparse.py.

References argparse.ArgumentParser._get_option_tuples(), python.rootplot.argparse.ArgumentParser._get_option_tuples(), argparse._ActionsContainer._has_negative_number_optionals, python.rootplot.argparse._ActionsContainer._has_negative_number_optionals, argparse._ArgumentGroup._has_negative_number_optionals, argparse._ActionsContainer._option_string_actions, python.rootplot.argparse._ActionsContainer._option_string_actions, argparse._ArgumentGroup._option_string_actions, MomentumConstraint.error, pat::MHT.error(), BinomialProbability.error(), CSCPairConstraint.error(), EcalUncalibRecHitRatioMethodAlgo< C >::Ratio.error, Measurement1DFloat.error(), SiStripLaserRecHit2D.error, EcalUncalibRecHitRatioMethodAlgo< C >::Tmax.error, SaxToDom.error(), Measurement1D.error(), SamplingAnalysis.error(), SaxToDom2.error(), pat::LookupTableRecord.error(), FedTimingAnalysis.error(), ApvTimingAnalysis.error(), CSCPairResidualsConstraint.error(), edm::HLTGlobalStatus.error(), edm::HLTPathStatus.error(), edm::TriggerResultsByName.error(), PTrajectoryStateOnDet.error(), PhysicsTools::Calibration::Histogram< Value_t, Axis_t >.error(), cscdqm::XMLFileErrorHandler.error(), lhef::LHERunInfo::XSec.error(), PhysicsTools::Calibration::Histogram2D< Value_t, AxisX_t, AxisY_t >.error(), MuonErrorMatrix.error, DDLSAX2Handler.error(), PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >.error(), SimpleSAXParser::ParserError.error(), reco::Vertex.error(), CSCDCCExaminer.error(), reco::TrackBase.error(), MatacqTBRawEvent.error, MatacqRawEvent.error, TiXmlDocument.error, argparse.ArgumentParser.error(), python.rootplot.argparse.ArgumentParser.error(), join(), argparse._ActionsContainer.prefix_chars, and python.rootplot.argparse._ActionsContainer.prefix_chars.

Referenced by python.rootplot.argparse.ArgumentParser._parse_known_args().

2038  def _parse_optional(self, arg_string):
2039  # if it's an empty string, it was meant to be a positional
2040  if not arg_string:
2041  return None
2042 
2043  # if it doesn't start with a prefix, it was meant to be positional
2044  if not arg_string[0] in self.prefix_chars:
2045  return None
2046 
2047  # if the option string is present in the parser, return the action
2048  if arg_string in self._option_string_actions:
2049  action = self._option_string_actions[arg_string]
2050  return action, arg_string, None
2051 
2052  # if it's just a single character, it was meant to be positional
2053  if len(arg_string) == 1:
2054  return None
2055 
2056  # if the option string before the "=" is present, return the action
2057  if '=' in arg_string:
2058  option_string, explicit_arg = arg_string.split('=', 1)
2059  if option_string in self._option_string_actions:
2060  action = self._option_string_actions[option_string]
2061  return action, option_string, explicit_arg
2062 
2063  # search through all possible prefixes of the option string
2064  # and all actions in the parser for possible interpretations
2065  option_tuples = self._get_option_tuples(arg_string)
2066 
2067  # if multiple actions match, the option string was ambiguous
2068  if len(option_tuples) > 1:
2069  options = ', '.join([option_string
2070  for action, option_string, explicit_arg in option_tuples])
2071  tup = arg_string, options
2072  self.error(_('ambiguous option: %s could match %s') % tup)
2073 
2074  # if exactly one action matched, this segmentation is good,
2075  # so return the parsed action
2076  elif len(option_tuples) == 1:
2077  option_tuple, = option_tuples
2078  return option_tuple
2079 
2080  # if it was not found as an option, but it looks like a negative
2081  # number, it was meant to be positional
2082  # unless there are negative-number-like options
2083  if self._negative_number_matcher.match(arg_string):
2084  if not self._has_negative_number_optionals:
2085  return None
2086 
2087  # if it contains a space, it was meant to be a positional
2088  if ' ' in arg_string:
2089  return None
2090 
2091  # it was meant to be an optional but there is no such option
2092  # in this parser (though it might be a valid option in a subparser)
2093  return None, arg_string, None
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def python.rootplot.argparse.ArgumentParser._print_message (   self,
  message,
  file = None 
)
private

Definition at line 2329 of file argparse.py.

Referenced by python.rootplot.argparse.ArgumentParser.exit(), python.rootplot.argparse.ArgumentParser.print_help(), python.rootplot.argparse.ArgumentParser.print_usage(), and python.rootplot.argparse.ArgumentParser.print_version().

2330  def _print_message(self, message, file=None):
2331  if message:
2332  if file is None:
2333  file = _sys.stderr
2334  file.write(message)
def python.rootplot.argparse.ArgumentParser._read_args_from_files (   self,
  arg_strings 
)
private

Definition at line 1970 of file argparse.py.

References argparse.ArgumentParser._read_args_from_files(), python.rootplot.argparse.ArgumentParser._read_args_from_files(), argparse.ArgumentParser.convert_arg_line_to_args(), python.rootplot.argparse.ArgumentParser.convert_arg_line_to_args(), MomentumConstraint.error, pat::MHT.error(), BinomialProbability.error(), EcalUncalibRecHitRatioMethodAlgo< C >::Ratio.error, CSCPairConstraint.error(), Measurement1DFloat.error(), EcalUncalibRecHitRatioMethodAlgo< C >::Tmax.error, SiStripLaserRecHit2D.error, SaxToDom.error(), Measurement1D.error(), SamplingAnalysis.error(), SaxToDom2.error(), pat::LookupTableRecord.error(), FedTimingAnalysis.error(), ApvTimingAnalysis.error(), CSCPairResidualsConstraint.error(), edm::HLTGlobalStatus.error(), edm::HLTPathStatus.error(), edm::TriggerResultsByName.error(), PhysicsTools::Calibration::Histogram< Value_t, Axis_t >.error(), PTrajectoryStateOnDet.error(), cscdqm::XMLFileErrorHandler.error(), lhef::LHERunInfo::XSec.error(), PhysicsTools::Calibration::Histogram2D< Value_t, AxisX_t, AxisY_t >.error(), MuonErrorMatrix.error, DDLSAX2Handler.error(), PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >.error(), SimpleSAXParser::ParserError.error(), reco::Vertex.error(), CSCDCCExaminer.error(), reco::TrackBase.error(), MatacqTBRawEvent.error, MatacqRawEvent.error, TiXmlDocument.error, argparse.ArgumentParser.error(), python.rootplot.argparse.ArgumentParser.error(), argparse.ArgumentParser.fromfile_prefix_chars, and python.rootplot.argparse.ArgumentParser.fromfile_prefix_chars.

Referenced by python.rootplot.argparse.ArgumentParser._parse_known_args(), and python.rootplot.argparse.ArgumentParser._read_args_from_files().

1971  def _read_args_from_files(self, arg_strings):
1972  # expand arguments referencing files
1973  new_arg_strings = []
1974  for arg_string in arg_strings:
1975 
1976  # for regular arguments, just add them back into the list
1977  if arg_string[0] not in self.fromfile_prefix_chars:
1978  new_arg_strings.append(arg_string)
1979 
1980  # replace arguments referencing files with the file content
1981  else:
1982  try:
1983  args_file = open(arg_string[1:])
1984  try:
1985  arg_strings = []
1986  for arg_line in args_file.read().splitlines():
1987  for arg in self.convert_arg_line_to_args(arg_line):
1988  arg_strings.append(arg)
1989  arg_strings = self._read_args_from_files(arg_strings)
1990  new_arg_strings.extend(arg_strings)
1991  finally:
1992  args_file.close()
1993  except IOError:
1994  err = _sys.exc_info()[1]
1995  self.error(str(err))
1996 
1997  # return the modified argument list
1998  return new_arg_strings
def python.rootplot.argparse.ArgumentParser.add_subparsers (   self,
  kwargs 
)

Definition at line 1646 of file argparse.py.

References argparse.ArgumentParser._get_formatter(), python.rootplot.argparse.ArgumentParser._get_formatter(), argparse.ArgumentParser._get_positional_actions(), python.rootplot.argparse.ArgumentParser._get_positional_actions(), argparse._ActionsContainer._mutually_exclusive_groups, python.rootplot.argparse._ActionsContainer._mutually_exclusive_groups, argparse._ArgumentGroup._mutually_exclusive_groups, argparse._ActionsContainer._pop_action_class(), python.rootplot.argparse._ActionsContainer._pop_action_class(), argparse.ArgumentParser._positionals, python.rootplot.argparse.ArgumentParser._positionals, argparse.ArgumentParser._subparsers, python.rootplot.argparse.ArgumentParser._subparsers, argparse._ActionsContainer.add_argument_group(), python.rootplot.argparse._ActionsContainer.add_argument_group(), MomentumConstraint.error, pat::MHT.error(), BinomialProbability.error(), CSCPairConstraint.error(), EcalUncalibRecHitRatioMethodAlgo< C >::Ratio.error, Measurement1DFloat.error(), EcalUncalibRecHitRatioMethodAlgo< C >::Tmax.error, SiStripLaserRecHit2D.error, Measurement1D.error(), SaxToDom.error(), SamplingAnalysis.error(), pat::LookupTableRecord.error(), SaxToDom2.error(), FedTimingAnalysis.error(), ApvTimingAnalysis.error(), CSCPairResidualsConstraint.error(), edm::HLTGlobalStatus.error(), edm::HLTPathStatus.error(), edm::TriggerResultsByName.error(), PTrajectoryStateOnDet.error(), PhysicsTools::Calibration::Histogram< Value_t, Axis_t >.error(), cscdqm::XMLFileErrorHandler.error(), lhef::LHERunInfo::XSec.error(), PhysicsTools::Calibration::Histogram2D< Value_t, AxisX_t, AxisY_t >.error(), MuonErrorMatrix.error, DDLSAX2Handler.error(), PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >.error(), SimpleSAXParser::ParserError.error(), reco::Vertex.error(), CSCDCCExaminer.error(), reco::TrackBase.error(), MatacqTBRawEvent.error, MatacqRawEvent.error, TiXmlDocument.error, argparse.ArgumentParser.error(), python.rootplot.argparse.ArgumentParser.error(), strip(), argparse.ArgumentParser.usage, and python.rootplot.argparse.ArgumentParser.usage.

1647  def add_subparsers(self, **kwargs):
1648  if self._subparsers is not None:
1649  self.error(_('cannot have multiple subparser arguments'))
1650 
1651  # add the parser class to the arguments if it's not present
1652  kwargs.setdefault('parser_class', type(self))
1653 
1654  if 'title' in kwargs or 'description' in kwargs:
1655  title = _(kwargs.pop('title', 'subcommands'))
1656  description = _(kwargs.pop('description', None))
1657  self._subparsers = self.add_argument_group(title, description)
1658  else:
1659  self._subparsers = self._positionals
1660 
1661  # prog defaults to the usage message of this parser, skipping
1662  # optional arguments and with no "usage:" prefix
1663  if kwargs.get('prog') is None:
1664  formatter = self._get_formatter()
1665  positionals = self._get_positional_actions()
1666  groups = self._mutually_exclusive_groups
1667  formatter.add_usage(self.usage, positionals, groups, '')
1668  kwargs['prog'] = formatter.format_help().strip()
1669 
1670  # create the parsers action and add it to the positionals list
1671  parsers_class = self._pop_action_class(kwargs, 'parsers')
1672  action = parsers_class(option_strings=[], **kwargs)
1673  self._subparsers._add_action(action)
1674 
1675  # return the created parsers action
1676  return action
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
def python.rootplot.argparse.ArgumentParser.convert_arg_line_to_args (   self,
  arg_line 
)

Definition at line 1999 of file argparse.py.

Referenced by python.rootplot.argparse.ArgumentParser._read_args_from_files().

2000  def convert_arg_line_to_args(self, arg_line):
2001  return [arg_line]
def python.rootplot.argparse.ArgumentParser.error (   self,
  message 
)
error(message: string)

Prints a usage message incorporating the message to stderr and
exits.

If you override this in a subclass, it should not return -- it
should either exit or raise an exception.

Definition at line 2343 of file argparse.py.

References CaloSegment.exit(), statemachine::HandleFiles.exit(), statemachine::HandleRuns.exit(), statemachine::HandleLumis.exit(), Vispa.Main.Application.Application.exit(), argparse.ArgumentParser.exit(), python.rootplot.argparse.ArgumentParser.exit(), argparse.ArgumentParser.print_usage(), python.rootplot.argparse.ArgumentParser.print_usage(), argparse.ArgumentParser.prog, and python.rootplot.argparse.ArgumentParser.prog.

Referenced by python.rootplot.argparse.ArgumentParser._get_option_tuples(), python.rootplot.argparse.ArgumentParser._parse_known_args(), python.rootplot.argparse.ArgumentParser._parse_optional(), python.rootplot.argparse.ArgumentParser._read_args_from_files(), python.rootplot.argparse.ArgumentParser.add_subparsers(), python.rootplot.argparse.ArgumentParser.parse_args(), and python.rootplot.argparse.ArgumentParser.parse_known_args().

2344  def error(self, message):
2345  """error(message: string)
2346 
2347  Prints a usage message incorporating the message to stderr and
2348  exits.
2349 
2350  If you override this in a subclass, it should not return -- it
2351  should either exit or raise an exception.
2352  """
2353  self.print_usage(_sys.stderr)
2354  self.exit(2, _('%s: error: %s\n') % (self.prog, message))
def python.rootplot.argparse.ArgumentParser.exit (   self,
  status = 0,
  message = None 
)

Definition at line 2338 of file argparse.py.

References argparse.ArgumentParser._print_message(), and python.rootplot.argparse.ArgumentParser._print_message().

Referenced by python.rootplot.argparse.ArgumentParser.error().

2339  def exit(self, status=0, message=None):
2340  if message:
2341  self._print_message(message, _sys.stderr)
2342  _sys.exit(status)
def python.rootplot.argparse.ArgumentParser.format_help (   self)

Definition at line 2272 of file argparse.py.

References argparse._ActionsContainer._action_groups, python.rootplot.argparse._ActionsContainer._action_groups, argparse._ActionsContainer._actions, python.rootplot.argparse._ActionsContainer._actions, argparse._ArgumentGroup._actions, argparse.ArgumentParser._get_formatter(), python.rootplot.argparse.ArgumentParser._get_formatter(), argparse._ActionsContainer._mutually_exclusive_groups, python.rootplot.argparse._ActionsContainer._mutually_exclusive_groups, argparse._ArgumentGroup._mutually_exclusive_groups, ExpressionHisto< T >.description, ProcTMVA::Method.description, argparse._ActionsContainer.description, python.rootplot.argparse._ActionsContainer.description, argparse.ArgumentParser.epilog, python.rootplot.argparse.ArgumentParser.epilog, argparse.ArgumentParser.usage, and python.rootplot.argparse.ArgumentParser.usage.

Referenced by python.rootplot.argparse.ArgumentParser.print_help().

2273  def format_help(self):
2274  formatter = self._get_formatter()
2275 
2276  # usage
2277  formatter.add_usage(self.usage, self._actions,
2279 
2280  # description
2281  formatter.add_text(self.description)
2282 
2283  # positionals, optionals and user-defined groups
2284  for action_group in self._action_groups:
2285  formatter.start_section(action_group.title)
2286  formatter.add_text(action_group.description)
2287  formatter.add_arguments(action_group._group_actions)
2288  formatter.end_section()
2289 
2290  # epilog
2291  formatter.add_text(self.epilog)
2292 
2293  # determine help from format above
2294  return formatter.format_help()
def python.rootplot.argparse.ArgumentParser.format_usage (   self)

Definition at line 2266 of file argparse.py.

References argparse._ActionsContainer._actions, python.rootplot.argparse._ActionsContainer._actions, argparse._ArgumentGroup._actions, argparse.ArgumentParser._get_formatter(), python.rootplot.argparse.ArgumentParser._get_formatter(), argparse._ActionsContainer._mutually_exclusive_groups, python.rootplot.argparse._ActionsContainer._mutually_exclusive_groups, argparse._ArgumentGroup._mutually_exclusive_groups, argparse.ArgumentParser.usage, and python.rootplot.argparse.ArgumentParser.usage.

Referenced by python.rootplot.argparse.ArgumentParser.print_usage().

2267  def format_usage(self):
2268  formatter = self._get_formatter()
2269  formatter.add_usage(self.usage, self._actions,
2271  return formatter.format_help()
def python.rootplot.argparse.ArgumentParser.format_version (   self)

Definition at line 2295 of file argparse.py.

References argparse.ArgumentParser._get_formatter(), python.rootplot.argparse.ArgumentParser._get_formatter(), MatrixInjector.MatrixInjector.version, TrackerInteractionGeometry.version, ora::MappingRawData.version, MatacqTBRawEvent::matacqHeader_t.version, DQMNet::CoreObject.version, XMLProcessor::_DBConfig.version, ScalersEventRecordRaw_v1.version, ScalersEventRecordRaw_v2.version, ScalersEventRecordRaw_v3.version, ScalersEventRecordRaw_v4.version, ScalersEventRecordRaw_v5.version, ScalersEventRecordRaw_v6.version, argparse._VersionAction.version, python.rootplot.argparse._VersionAction.version, TiXmlDeclaration.version, argparse.ArgumentParser.version, and python.rootplot.argparse.ArgumentParser.version.

Referenced by python.rootplot.argparse.ArgumentParser.print_version().

2296  def format_version(self):
2297  import warnings
2298  warnings.warn(
2299  'The format_version method is deprecated -- the "version" '
2300  'argument to ArgumentParser is no longer supported.',
2301  DeprecationWarning)
2302  formatter = self._get_formatter()
2303  formatter.add_text(self.version)
2304  return formatter.format_help()
def python.rootplot.argparse.ArgumentParser.parse_args (   self,
  args = None,
  namespace = None 
)

Definition at line 1697 of file argparse.py.

References MomentumConstraint.error, pat::MHT.error(), BinomialProbability.error(), EcalUncalibRecHitRatioMethodAlgo< C >::Ratio.error, CSCPairConstraint.error(), Measurement1DFloat.error(), EcalUncalibRecHitRatioMethodAlgo< C >::Tmax.error, SiStripLaserRecHit2D.error, Measurement1D.error(), SaxToDom.error(), SamplingAnalysis.error(), pat::LookupTableRecord.error(), SaxToDom2.error(), FedTimingAnalysis.error(), ApvTimingAnalysis.error(), CSCPairResidualsConstraint.error(), edm::HLTGlobalStatus.error(), edm::HLTPathStatus.error(), edm::TriggerResultsByName.error(), PTrajectoryStateOnDet.error(), PhysicsTools::Calibration::Histogram< Value_t, Axis_t >.error(), cscdqm::XMLFileErrorHandler.error(), lhef::LHERunInfo::XSec.error(), PhysicsTools::Calibration::Histogram2D< Value_t, AxisX_t, AxisY_t >.error(), MuonErrorMatrix.error, DDLSAX2Handler.error(), PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >.error(), SimpleSAXParser::ParserError.error(), reco::Vertex.error(), CSCDCCExaminer.error(), reco::TrackBase.error(), MatacqTBRawEvent.error, MatacqRawEvent.error, TiXmlDocument.error, argparse.ArgumentParser.error(), python.rootplot.argparse.ArgumentParser.error(), join(), argparse.ArgumentParser.parse_known_args(), and python.rootplot.argparse.ArgumentParser.parse_known_args().

1698  def parse_args(self, args=None, namespace=None):
1699  args, argv = self.parse_known_args(args, namespace)
1700  if argv:
1701  msg = _('unrecognized arguments: %s')
1702  self.error(msg % ' '.join(argv))
1703  return args
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def python.rootplot.argparse.ArgumentParser.parse_known_args (   self,
  args = None,
  namespace = None 
)

Definition at line 1704 of file argparse.py.

References argparse._ActionsContainer._actions, python.rootplot.argparse._ActionsContainer._actions, argparse._ArgumentGroup._actions, argparse._ActionsContainer._defaults, python.rootplot.argparse._ActionsContainer._defaults, argparse._ArgumentGroup._defaults, argparse.ArgumentParser._get_value(), python.rootplot.argparse.ArgumentParser._get_value(), argparse.ArgumentParser._parse_known_args(), python.rootplot.argparse.ArgumentParser._parse_known_args(), MomentumConstraint.error, pat::MHT.error(), BinomialProbability.error(), CSCPairConstraint.error(), EcalUncalibRecHitRatioMethodAlgo< C >::Ratio.error, Measurement1DFloat.error(), EcalUncalibRecHitRatioMethodAlgo< C >::Tmax.error, SiStripLaserRecHit2D.error, SaxToDom.error(), Measurement1D.error(), SamplingAnalysis.error(), pat::LookupTableRecord.error(), SaxToDom2.error(), FedTimingAnalysis.error(), ApvTimingAnalysis.error(), CSCPairResidualsConstraint.error(), edm::HLTGlobalStatus.error(), edm::HLTPathStatus.error(), edm::TriggerResultsByName.error(), PTrajectoryStateOnDet.error(), PhysicsTools::Calibration::Histogram< Value_t, Axis_t >.error(), cscdqm::XMLFileErrorHandler.error(), lhef::LHERunInfo::XSec.error(), PhysicsTools::Calibration::Histogram2D< Value_t, AxisX_t, AxisY_t >.error(), MuonErrorMatrix.error, DDLSAX2Handler.error(), PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >.error(), SimpleSAXParser::ParserError.error(), reco::Vertex.error(), CSCDCCExaminer.error(), reco::TrackBase.error(), MatacqTBRawEvent.error, MatacqRawEvent.error, TiXmlDocument.error, argparse.ArgumentParser.error(), and python.rootplot.argparse.ArgumentParser.error().

Referenced by python.rootplot.argparse.ArgumentParser.parse_args().

1705  def parse_known_args(self, args=None, namespace=None):
1706  # args default to the system args
1707  if args is None:
1708  args = _sys.argv[1:]
1709 
1710  # default Namespace built from parser defaults
1711  if namespace is None:
1712  namespace = Namespace()
1713 
1714  # add any action defaults that aren't present
1715  for action in self._actions:
1716  if action.dest is not SUPPRESS:
1717  if not hasattr(namespace, action.dest):
1718  if action.default is not SUPPRESS:
1719  default = action.default
1720  if isinstance(action.default, _basestring):
1721  default = self._get_value(action, default)
1722  setattr(namespace, action.dest, default)
1723 
1724  # add any parser defaults that aren't present
1725  for dest in self._defaults:
1726  if not hasattr(namespace, dest):
1727  setattr(namespace, dest, self._defaults[dest])
1728 
1729  # parse the arguments and exit if there are any errors
1730  try:
1731  return self._parse_known_args(args, namespace)
1732  except ArgumentError:
1733  err = _sys.exc_info()[1]
1734  self.error(str(err))
def python.rootplot.argparse.ArgumentParser.print_help (   self,
  file = None 
)

Definition at line 2316 of file argparse.py.

References argparse.ArgumentParser._print_message(), python.rootplot.argparse.ArgumentParser._print_message(), argparse.HelpFormatter._Section.format_help(), python.rootplot.argparse.HelpFormatter._Section.format_help(), argparse.HelpFormatter.format_help(), python.rootplot.argparse.HelpFormatter.format_help(), argparse.ArgumentParser.format_help(), and python.rootplot.argparse.ArgumentParser.format_help().

2317  def print_help(self, file=None):
2318  if file is None:
2319  file = _sys.stdout
2320  self._print_message(self.format_help(), file)
def python.rootplot.argparse.ArgumentParser.print_usage (   self,
  file = None 
)

Definition at line 2311 of file argparse.py.

References argparse.ArgumentParser._print_message(), python.rootplot.argparse.ArgumentParser._print_message(), argparse.ArgumentParser.format_usage(), and python.rootplot.argparse.ArgumentParser.format_usage().

Referenced by python.rootplot.argparse.ArgumentParser.error().

2312  def print_usage(self, file=None):
2313  if file is None:
2314  file = _sys.stdout
2315  self._print_message(self.format_usage(), file)
def python.rootplot.argparse.ArgumentParser.print_version (   self,
  file = None 
)

Definition at line 2321 of file argparse.py.

References argparse.ArgumentParser._print_message(), python.rootplot.argparse.ArgumentParser._print_message(), CSCDDUHeader.format_version(), CSCSPHeader.format_version(), argparse.ArgumentParser.format_version(), and python.rootplot.argparse.ArgumentParser.format_version().

2322  def print_version(self, file=None):
2323  import warnings
2324  warnings.warn(
2325  'The print_version method is deprecated -- the "version" '
2326  'argument to ArgumentParser is no longer supported.',
2327  DeprecationWarning)
2328  self._print_message(self.format_version(), file)

Member Data Documentation

python.rootplot.argparse.ArgumentParser._optionals
private

Definition at line 1598 of file argparse.py.

python.rootplot.argparse.ArgumentParser._positionals
private

Definition at line 1597 of file argparse.py.

Referenced by python.rootplot.argparse.ArgumentParser.add_subparsers().

python.rootplot.argparse.ArgumentParser._subparsers
private

Definition at line 1599 of file argparse.py.

Referenced by python.rootplot.argparse.ArgumentParser.add_subparsers().

python.rootplot.argparse.ArgumentParser.add_help

Definition at line 1594 of file argparse.py.

python.rootplot.argparse.ArgumentParser.epilog

Definition at line 1590 of file argparse.py.

Referenced by python.rootplot.argparse.ArgumentParser.format_help().

python.rootplot.argparse.ArgumentParser.formatter_class

Definition at line 1592 of file argparse.py.

Referenced by python.rootplot.argparse.ArgumentParser._get_formatter().

python.rootplot.argparse.ArgumentParser.fromfile_prefix_chars

Definition at line 1593 of file argparse.py.

Referenced by python.rootplot.argparse.ArgumentParser._parse_known_args(), and python.rootplot.argparse.ArgumentParser._read_args_from_files().

python.rootplot.argparse.ArgumentParser.prog

Definition at line 1588 of file argparse.py.

Referenced by python.rootplot.argparse.ArgumentParser._get_formatter(), and python.rootplot.argparse.ArgumentParser.error().

python.rootplot.argparse.ArgumentParser.usage

Definition at line 1589 of file argparse.py.

Referenced by python.rootplot.argparse.ArgumentParser.add_subparsers(), python.rootplot.argparse.ArgumentParser.format_help(), and python.rootplot.argparse.ArgumentParser.format_usage().

python.rootplot.argparse.ArgumentParser.version

Definition at line 1591 of file argparse.py.

Referenced by python.rootplot.argparse.ArgumentParser.format_version().