weaver.base
Module Contents
- class weaver.base.Constants[source]
Constants container that provides similar functionalities to
ExtendedEnumwithout explicit Enum membership.- classmethod get(cls: Union[weaver.typedefs.AnyKey, EnumType, PropertyDataType], key_or_value: Optional[Any], default=None) PropertyDataType[source]
- classmethod docs(cls) Dict[str, Optional[str]][source]
Retrieves the documentation string applied on the attribute.
Employ
classpropertyto define the attributes.
- class weaver.base.classproperty(fget: Optional[Callable[[object], PropertyDataType]] = None, fset: Optional[Callable[[object, PropertyDataType], None]] = None, fdel: Optional[Callable[[object], None]] = None, doc: str = '')[source]
Mimics
propertydecorator, but applied ontoclassmethodin 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.Enummethods.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(cls) List[str][source]
Returns the member names assigned to corresponding enum elements.
- classmethod values(cls) List[weaver.typedefs.AnyKey][source]
Returns the literal values assigned to corresponding enum elements.