weaver.base
Module Contents
- class weaver.base.Constants[source]
Constants container that provides similar functionalities to
ExtendedEnumwithout explicit Enum membership.- classmethod get(key_or_value: Union[weaver.typedefs.AnyKey, EnumType, PropertyDataTypeT], default: Optional[Any] = None) PropertyDataTypeT[source]
- classmethod docs() Dict[str, Optional[str]][source]
Retrieves the documentation string applied on the attribute.
Employ
classpropertyto define the attributes.
- class weaver.base.classproperty(fget: Ellipsis = None, fset: Optional[Callable[[object, PropertyDataTypeT], 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.
- property title: str[source]
Returns the title representation of the enum element.
Title use the original enum element name with capitalization considering underscores for separate words.
- 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.