snake._meta#

Meta Class Voodoo magic.

Module Contents#

Classes#

MetaDCRegister

A MetaClass adding registration for subclasses and transform to dataclass.

LogMixin

A Mixin to add a logger to a class.

NoCaseEnumMeta

Make Enum case insensitive.

NoCaseEnum

Base Class for Enum to be case insensitive.

MethodRegister

A Decorator to register methods of the same type in dictionaries.

Singleton

ENVCONFIG

Environment Configuration.

Functions#

make_log_property

Create a property logger.

dataclass_repr_html

Recursive HTML representation for dataclasses.

Data#

API#

snake._meta.T = 'TypeVar(...)'#
snake._meta.ThreeInts = None#
snake._meta.ThreeFloats = None#
snake._meta.make_log_property(dunder_name: str) collections.abc.Callable[source]#

Create a property logger.

snake._meta.dataclass_repr_html(obj: Any, vertical: bool = True) str[source]#

Recursive HTML representation for dataclasses.

This function generates an HTML table representation of a dataclass, including nested dataclasses.

Parameters:

obj (The dataclass instance.)

Returns:

str

Return type:

An HTML table string representing the dataclass.

class snake._meta.MetaDCRegister[source]#

Bases: type

A MetaClass adding registration for subclasses and transform to dataclass.

dunder_name: str = None#
__new__(clsname: str, bases: tuple, class_dict: dict) type[source]#

Create a dataclass, with log property and auto registry properties.

No need for @dataclass decorator.

class snake._meta.LogMixin[source]#

A Mixin to add a logger to a class.

property log: logging.Logger#

Logger.

class snake._meta.NoCaseEnumMeta[source]#

Bases: enum.EnumMeta

Make Enum case insensitive.

__getitem__(item: Any)[source]#
class snake._meta.NoCaseEnum[source]#

Bases: enum.Enum

Base Class for Enum to be case insensitive.

class snake._meta.MethodRegister(register_name: str)[source]#

A Decorator to register methods of the same type in dictionaries.

Parameters:

name (str) – The register

Initialization

registry: dict = 'defaultdict(...)'#
__call__(method_name: str | collections.abc.Callable) collections.abc.Callable[source]#

Register the function in the registry.

class snake._meta.Singleton[source]#

Bases: type

_instances: dict[type, object] = None#
__call__(*args: Any, **kwargs: Any)[source]#
class snake._meta.ENVCONFIG[source]#

Environment Configuration.

SNAKE_TMP_DIR = '/tmp'#
SNAKE_HDF5_CHUNK_SIZE = None#
SNAKE_HDF5_CHUNK_WRITE_SIZE = None#
classmethod __getitem__(key: str) Any[source]#
snake._meta.EnvConfig = 'ENVCONFIG(...)'#