registries.errors¶
Registry error classes.
New in version 1.0.
Exceptions
|
The provided item is already registered. |
|
An item was not found by attribute for unregistration. |
|
Base class for registration errors. |
|
Base class for a registry exception. |
|
Base class for errors in looking up an item from a registry. |
|
Base class for unregistration errors. |
|
An item could not be registered due to missing attributes. |
|
An item could not be found in the registry. |
|
An item was not found for unregistration. |
|
The provided item conflicts with an item that is already registered. |
|
An attribute was referenced that is not supported by the registry. |
- exception registries.errors.BaseRegistryError(message: str | None = None, **kwargs)[source]¶
Bases:
ExceptionBase class for a registry exception.
New in version 1.0.
- message_template: ClassVar[_FormatStr] = "Unspecified registry error. This is an implementation error with the application's custom registry error handling."¶
The template for an error message.
This is in the form of a
%-based format string. Subclasses can provide custom error messages for specific error types or custom registries.
- exception registries.errors.UnsupportedRegistryAttributeError(message: str | None = None, *, attr_name: str, **kwargs)[source]¶
Bases:
BaseRegistryErrorAn attribute was referenced that is not supported by the registry.
New in version 1.0.
- message_template: ClassVar[_FormatStr] = '"%(attr_name)s" is not a registered lookup attribute.'[source]¶
The template for an error message.
This is in the form of a
%-based format string. Subclasses can provide custom error messages for specific error types or custom registries.
- __init__(message: str | None = None, *, attr_name: str, **kwargs) None[source]¶
Initialize the error.
- Parameters:
attr_name (
str) – The name of the unsupported attribute that was used.message (
str, optional) –An explicit error message as a
%-based format string.This support an
%(attr_name)sformat argument.If not provided,
message_templatewill be used.
- exception registries.errors.BaseRegistryItemLookupError(message: str | None = None, *, attr_name: str, **kwargs)[source]¶
Bases:
BaseRegistryErrorBase class for errors in looking up an item from a registry.
New in version 1.0.
- exception registries.errors.ItemNotFoundLookupError(message: str | None = None, *, attr_name: str, attr_value: object)[source]¶
Bases:
BaseRegistryItemLookupErrorAn item could not be found in the registry.
New in version 1.0.
- message_template: ClassVar[_FormatStr] = 'No item registered with %(attr_name)s=%(attr_value)s.'[source]¶
The template for an error message.
This is in the form of a
%-based format string. Subclasses can provide custom error messages for specific error types or custom registries.
- __init__(message: str | None = None, *, attr_name: str, attr_value: object) None[source]¶
Initialize the error.
- Parameters:
attr_name (
str) – The name of the attribute that was used to look up the item.attr_value (
object) – The attribute value used to look up the item.message (
str, optional) –An explicit error message as a
%-based format string.This supports
%(attr_name)sand%(attr_value)sformat arguments.If not provided,
message_templatewill be used.
- exception registries.errors.BaseRegistrationError(message: str | None = None, *, item: RegistryItemType, **kwargs)[source]¶
Bases:
Generic[RegistryItemType],BaseRegistryErrorBase class for registration errors.
New in version 1.0.
- __init__(message: str | None = None, *, item: RegistryItemType, **kwargs) None[source]¶
Initialize the error.
- item: RegistryItemType¶
The item that failed to be registered.
- __orig_bases__ = (typing.Generic[~RegistryItemType], <class 'registries.errors.BaseRegistryError'>)¶
- __parameters__ = (~RegistryItemType,)¶
- exception registries.errors.AlreadyRegisteredError(message: str | None = None, *, item: RegistryItemType, **kwargs)[source]¶
Bases:
BaseRegistrationError[RegistryItemType]The provided item is already registered.
New in version 1.0.
- message_template: ClassVar[_FormatStr] = 'Could not register %(item)s: it is already registered.'[source]¶
The template for an error message.
This is in the form of a
%-based format string. Subclasses can provide custom error messages for specific error types or custom registries.
- __orig_bases__ = (registries.errors.BaseRegistrationError[~RegistryItemType],)¶
- __parameters__ = (~RegistryItemType,)¶
- exception registries.errors.RegistrationConflictError(message: str | None = None, *, attr_name: str, attr_value: Any, item: RegistryItemType, other_item: RegistryItemType)[source]¶
Bases:
BaseRegistrationError[RegistryItemType]The provided item conflicts with an item that is already registered.
This may apply to a separate item matching the same lookup attributes.
New in version 1.0.
- message_template: ClassVar[_FormatStr] = 'Could not register %(item)s: another item (%(other_item)s) is already registered with %(attr_name)s=%(attr_value)s.'[source]¶
The template for an error message.
This is in the form of a
%-based format string. Subclasses can provide custom error messages for specific error types or custom registries.
- __init__(message: str | None = None, *, attr_name: str, attr_value: Any, item: RegistryItemType, other_item: RegistryItemType) None[source]¶
Initialize the error.
- Parameters:
attr_name (
str) – The name of the attribute that was used for registration.attr_value (
object) – The attribute value that conflicted.item (
object) – The item that failed to be registered.other_item (
object) – The conflicting item already in the registry.message (
str, optional) –An explicit error message as a
%-based format string.This supports
%(attr_name)s,%(attr_value)s,%(item)s, and%(other_item)sformat arguments.If not provided,
message_templatewill be used.
- other_item: RegistryItemType¶
The conflicting item already in the registry.
- __orig_bases__ = (registries.errors.BaseRegistrationError[~RegistryItemType],)¶
- __parameters__ = (~RegistryItemType,)¶
- exception registries.errors.InvalidItemRegistrationError(message: str | None = None, *, attr_name: str, item: RegistryItemType)[source]¶
Bases:
BaseRegistrationError[RegistryItemType]An item could not be registered due to missing attributes.
New in version 1.0.
- message_template: ClassVar[_FormatStr] = 'Could not register %(item)s: it does not have a "%(attr_name)s" attribute.'[source]¶
The template for an error message.
This is in the form of a
%-based format string. Subclasses can provide custom error messages for specific error types or custom registries.
- __init__(message: str | None = None, *, attr_name: str, item: RegistryItemType) None[source]¶
Initialize the error.
- Parameters:
attr_name (
str) – The name of the attribute that was used for registration.item (
object) – The item that failed to be registered.message (
str, optional) –An explicit error message as a
%-based format string.This supports
%(attr_name)sand%(item)sformat arguments.If not provided,
message_templatewill be used.
- __orig_bases__ = (registries.errors.BaseRegistrationError[~RegistryItemType],)¶
- __parameters__ = (~RegistryItemType,)¶
- exception registries.errors.BaseUnregistrationError(message: str | None = None, **kwargs)[source]¶
Bases:
BaseRegistryErrorBase class for unregistration errors.
New in version 1.0.
- exception registries.errors.AttrNotFoundUnregistrationError(message: str | None = None, *, attr_name: str, attr_value: object)[source]¶
Bases:
BaseUnregistrationErrorAn item was not found by attribute for unregistration.
New in version 1.0.
- message_template: ClassVar[_FormatStr] = 'No item registered with %(attr_name)s=%(attr_value)s.'[source]¶
The template for an error message.
This is in the form of a
%-based format string. Subclasses can provide custom error messages for specific error types or custom registries.
- __init__(message: str | None = None, *, attr_name: str, attr_value: object) None[source]¶
Initialize the error.
- Parameters:
attr_name (
str) – The name of the attribute that was used for unregistration.attr_value (
object) – The attribute value that was used for the lookup.message (
str, optional) –An explicit error message as a
%-based format string.This supports
%(attr_name)sand%(attr_value)sformat arguments.If not provided,
message_templatewill be used.
- exception registries.errors.ItemNotFoundUnregistrationError(message: str | None = None, *, item: RegistryItemType)[source]¶
Bases:
Generic[RegistryItemType],BaseUnregistrationErrorAn item was not found for unregistration.
New in version 1.0.
- __orig_bases__ = (typing.Generic[~RegistryItemType], <class 'registries.errors.BaseUnregistrationError'>)¶
- __parameters__ = (~RegistryItemType,)¶
- message_template: ClassVar[_FormatStr] = 'Could not unregister %(item)s: it is not registered.'[source]¶
The template for an error message.
This is in the form of a
%-based format string. Subclasses can provide custom error messages for specific error types or custom registries.
- __init__(message: str | None = None, *, item: RegistryItemType) None[source]¶
Initialize the error.
- Parameters:
item (
object) – The item that failed to be unregistered.message (
str, optional) –An explicit error message as a
%-based format string.This supports an
%(item)sformat argument.If not provided,
message_templatewill be used.
- item: RegistryItemType¶
The item that failed to be registered.