Example #1
0
  def _unnormalized_option_registrations_iter(self):
    """Returns an iterator over the raw registration arguments of each option in this parser.

    Each yielded item is an (args, kwargs) pair, exactly as passed to register().

    Note that recursive options we inherit from a parent will also be yielded here.
    """
    # First yield any recursive options we inherit from our parent.
    if self._parent_parser:
      for args, kwargs in self._parent_parser._recursive_option_registration_args():
        yield args, kwargs
    # Then yield our directly-registered options.
    for args, kwargs in self._option_registrations:
      if 'recursive' in kwargs and self._scope_info.category == ScopeInfo.SUBSYSTEM:
        raise RecursiveSubsystemOption(self.scope, args[0])
      yield args, kwargs
Example #2
0
    def _unnormalized_option_registrations_iter(self):
        """Returns an iterator over the raw registration arguments of each option in this parser.

        Each yielded item is an (args, kwargs) pair, exactly as passed to register(), except for
        substituting list and dict types with list_option/dict_option.

        Note that recursive options we inherit from a parent will also be yielded here.
        """
        # First yield any recursive options we inherit from our parent.
        if self._parent_parser:
            for args, kwargs in self._parent_parser._recursive_option_registration_args():
                yield args, kwargs
        # Then yield our directly-registered options.
        for args, kwargs in self._option_registrations:
            if "recursive" in kwargs and self._scope_info.scope != GLOBAL_SCOPE:
                raise RecursiveSubsystemOption(self.scope, args[0])
            yield args, kwargs