hvl_ccb.utils package

Submodules

hvl_ccb.utils.enum module

class hvl_ccb.utils.enum.AutoNumberNameEnum(value=<object object>, names=None, module=None, type=None, start=1, boundary=None)[source]

Bases: hvl_ccb.utils.enum.NameEnum, aenum.AutoNumberEnum

Auto-numbered enum with names used as string representation, and with lookup and equality based on this representation.

class hvl_ccb.utils.enum.NameEnum(value=<object object>, names=None, module=None, type=None, start=1, boundary=None)[source]

Bases: hvl_ccb.utils.enum.StrEnumBase

Enum with names used as string representation, and with lookup and equality based on this representation.

class hvl_ccb.utils.enum.StrEnumBase(value=<object object>, names=None, module=None, type=None, start=1, boundary=None)[source]

Bases: aenum.Enum

String representation-based equality and lookup.

class hvl_ccb.utils.enum.ValueEnum(value=<object object>, names=None, module=None, type=None, start=1, boundary=None)[source]

Bases: hvl_ccb.utils.enum.StrEnumBase

Enum with string representation of values used as string representation, and with lookup and equality based on this representation.

Attention: to avoid errors, best use together with unique enum decorator.

hvl_ccb.utils.typing module

Additional Python typing module utilities

hvl_ccb.utils.typing.Number

Typing hint auxiliary for a Python base number types: int or float.

alias of Union[int, float]

hvl_ccb.utils.typing.check_generic_type(value, type_, name='instance')[source]

Check if value is of a generic type type_. Raises TypeError if it’s not.

Parameters
  • name – name to report in case of an error

  • value – value to check

  • type – generic type to check against

hvl_ccb.utils.typing.is_generic_type_hint(type_)[source]

Check if class is a generic type, for example Union[int, float], List[int], or List.

Parameters

type – type to check

Module contents