tensorbay.utility.type

TypeEnum, TypeMixin and TypeRegister.

TypeEnum is a superclass for enumeration classes that need to create a mapping with class.

TypeMixin is a superclass for the class which needs to link with TypeEnum.

TypeRegister is a decorator, which is used for registering TypeMixin to TypeEnum.

class tensorbay.utility.type.TypeEnum(value)[source]

Bases: enum.Enum

TypeEnum is a superclass for enumeration classes that need to create a mapping with class.

The ‘type’ property is used for getting the corresponding class of the enumeration.

property type: Type[Any]

Get the corresponding class.

Returns

The corresponding class.

class tensorbay.utility.type.TypeMixin(*args, **kwds)[source]

Bases: Generic[tensorbay.utility.type._T]

TypeMixin is a superclass for the class which needs to link with TypeEnum.

It provides the class variable ‘TYPE’ to access the corresponding TypeEnum.

property enum: tensorbay.utility.type._T

Get the corresponding TypeEnum.

Returns

The corresponding TypeEnum.

class tensorbay.utility.type.TypeRegister(enum)[source]

Bases: Generic[tensorbay.utility.type._T]

TypeRegister is a decorator, which is used for registering TypeMixin to TypeEnum.

Parameters

enum – The corresponding TypeEnum of the TypeMixin.