b.o.RegistryOption(Option) : class documentation

Part of bzrlib.option View In Hierarchy

Known subclasses: bzrlib.conflicts.ResolveActionOption

Option based on a registry

The values for the options correspond to entries in the registry. Input must be a registry key. After validation, it is converted into an object using Registry.get or a caller-provided converter.

Method validate_value Validate a value name
Method convert Convert a value name into an output type
Method __init__ Constructor.
Method registry Undocumented
Static Method from_kwargs Convenience method to generate string-map registry options
Method add_option Add this option to an Optparse parser
Method iter_switches Iterate through the list of switches provided by the option
Method is_hidden Undocumented
Method _optparse_value_callback Undocumented

Inherited from Option:

Method short_name Undocumented
Method set_short_name Undocumented
Method get_negation_name Undocumented
Method _optparse_bool_callback Undocumented
Method _optparse_callback Undocumented
def validate_value(self, value):
Validate a value name
def convert(self, value):
Convert a value name into an output type
def __init__(self, name, help, registry=None, converter=None, value_switches=False, title=None, enum_switch=True, lazy_registry=None, short_name=None, short_value_switches=None):
Constructor.
ParametersnameThe option name.
helpHelp for the option.
registryA Registry containing the values
converterCallable to invoke with the value name to produce the value. If not supplied, self.registry.get is used.
value_switchesIf true, each possible value is assigned its own switch. For example, instead of '--format knit', '--knit' can be used interchangeably.
enum_switchIf true, a switch is provided with the option name, which takes a value.
lazy_registryA tuple of (module name, attribute name) for a registry to be lazily loaded.
short_nameThe short name for the enum switch, if any
short_value_switchesA dict mapping values to short names
@property
def registry(self):
Undocumented
@staticmethod
def from_kwargs(name_, help=None, title=None, value_switches=False, enum_switch=True, **kwargs):
Convenience method to generate string-map registry options

name, help, value_switches and enum_switch are passed to the RegistryOption constructor. Any other keyword arguments are treated as values for the option, and their value is treated as the help.

def add_option(self, parser, short_name):
Add this option to an Optparse parser
def _optparse_value_callback(self, cb_value):
Undocumented
def iter_switches(self):
Iterate through the list of switches provided by the option
Returnsan iterator of (name, short_name, argname, help)
def is_hidden(self, name):
Undocumented
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.