weaver.base
Definitions of base classes employed across multiple modules to avoid circular import errors.
Module Contents
- class weaver.base.Constants[source]
Constants container that provides similar functionalities to
ExtendedEnum
without explicit Enum membership.- classmethod get(key_or_value: weaver.typedefs.AnyKey | EnumType | PropertyDataTypeT, default: Any | None = None) PropertyDataTypeT [source]
- classmethod docs() Dict[str, str | None] [source]
Retrieves the documentation string applied on the attribute.
Employ
classproperty
to define the attributes.
- class weaver.base.classproperty(fget: Callable[[object], PropertyDataTypeT] | None = None, fset: Callable[[object, PropertyDataTypeT], None] | None = None, fdel: Callable[[object], None] | None = None, doc: str = '')[source]
Mimics
property
decorator, but applied ontoclassmethod
in backward compatible way.Note
This decorator purposely only supports getter attribute to define unmodifiable class properties.
See also
Initialize self. See help(type(self)) for accurate signature.
- class weaver.base.ExtendedEnum[source]
Utility
enum.Enum
methods.Create an extended enum with these utilities as follows.
class CustomEnum(ExtendedEnum): ItemA = "A" ItemB = "B"
Warning
Must not define any enum value here to allow inheritance by subclasses.
- classmethod names() List[str] [source]
Returns the member names assigned to corresponding enum elements.
- classmethod values() List[weaver.typedefs.AnyKey] [source]
Returns the literal values assigned to corresponding enum elements.