b.r.FormatRegistry(Registry) : class documentation

Part of bzrlib.registry View In Hierarchy

Known subclasses: bzrlib.controldir.ControlComponentFormatRegistry

Registry specialised for handling formats.
Method __init__ Create a new Registry.
Method register Register a new object to a name.
Method register_lazy Register a new object to be loaded on request.
Method remove Remove a registered entry.
Method get Return the object register()'ed to the given key.

Inherited from Registry:

Method get_prefix Return an object whose key is a prefix of the supplied value.
Method get_help Get the help text associated with the given key
Method get_info Get the extra information associated with the given key
Method __contains__ Undocumented
Method keys Get a list of registered entries
Method iteritems Undocumented
Method items Undocumented
Method _add_help_and_info Add the help and information about this key
Method _get_module Return the module the object will be or was loaded from.
Method _get_key_or_default Return either 'key' or the default key if key is None
Method _set_default_key Undocumented
Method _get_default_key Undocumented
def __init__(self, other_registry=None):
Create a new Registry.
def register(self, key, obj, help=None, info=None, override_existing=False):
Register a new object to a name.
ParameterskeyThis is the key to use to request the object later.
objThe object to register.
helpHelp text for this entry. This may be a string or a callable. If it is a callable, it should take two parameters (registry, key): this registry and the key that the help was registered under.
infoMore information for this entry. Registry.get_info() can be used to get this information. Registry treats this as an opaque storage location (it is defined by the caller).
override_existingRaise KeyErorr if False and something has already been registered for that key. If True, ignore if there is an existing key (always register the new value).
def register_lazy(self, key, module_name, member_name, help=None, info=None, override_existing=False):
Register a new object to be loaded on request.
ParameterskeyThis is the key to use to request the object later.
module_nameThe python path to the module. Such as 'os.path'.
member_nameThe member of the module to return. If empty or None, get() will return the module itself.
helpHelp text for this entry. This may be a string or a callable.
infoMore information for this entry. Registry.get_info() can be used to get this information. Registry treats this as an opaque storage location (it is defined by the caller).
override_existingIf True, replace the existing object with the new one. If False, if there is already something registered with the same key, raise a KeyError
def remove(self, key):
Remove a registered entry.

This is mostly for the test suite, but it can be used by others

def get(self, format_string):
Return the object register()'ed to the given key.

May raise ImportError if the object was registered lazily and there are any problems, or AttributeError if the module does not have the supplied member.

ParameterskeyThe key to obtain the object for. If no object has been registered to that key, the object registered for self.default_key will be returned instead, if it exists. Otherwise KeyError will be raised.
ReturnsThe previously registered object.
RaisesImportErrorIf the object was registered lazily, and there are problems during import.
AttributeErrorIf registered lazily, and the module does not contain the registered member.
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.