graviti.portex.enum#

Portex enum values releated classes.

Module Contents#

Classes#

EnumValues

The base class of portex enum values.

EnumValueList

The portex enum values in list format.

EnumValueDict

The portex enum values in dict format.

Functions#

create_enum_values(values)

The factory function of EnumValues.

Attributes#

graviti.portex.enum.EnumValueType[source]#
class graviti.portex.enum.EnumValues[source]#

The base class of portex enum values.

abstract to_pyobj(self)[source]#

Dump the instance to a python list or dict.

Raises

NotImplementedError – The method of the base class should not be called.

Return type

Union[List[EnumValueType], Dict[int, EnumValueType]]

abstract to_pyarrow(self)[source]#

Dump the instance to a pyarrow array.

Raises

NotImplementedError – The method of the base class should not be called.

Return type

pyarrow.Array

class graviti.portex.enum.EnumValueList(values)[source]#

Bases: EnumValues, graviti.utility.UserSequence[EnumValueType]

The portex enum values in list format.

Parameters

values (Iterable[EnumValueType]) – The enum values.

to_pyobj(self)[source]#

Dump the instance to a python list.

Returns

A python list representation of the enum values.

Return type

List[EnumValueType]

to_pyarrow(self)[source]#

Dump the instance to a pyarrow array.

Returns

A pyarrow array representation of the enum values.

Return type

pyarrow.Array

class graviti.portex.enum.EnumValueDict(values)[source]#

Bases: EnumValues, graviti.utility.UserMapping[int, EnumValueType]

The portex enum values in dict format.

Parameters

values (Mapping[int, EnumValueType]) – The enum values.

to_pyobj(self)[source]#

Dump the instance to a python dict.

Returns

A python dict representation of the enum values.

Return type

Dict[int, EnumValueType]

to_pyarrow(self)[source]#

Dump the instance to a pyarrow array.

Raises

TypeError – EnumValueDict is not supported converting to pyarrow.

Return type

pyarrow.Array

graviti.portex.enum.create_enum_values(values)[source]#

The factory function of EnumValues.

Parameters

values (Union[Sequence[EnumValueType], Mapping[int, EnumValueType]]) – The enum values.

Returns

The EnumValues instance created by the input enum values.

Raises

TypeError – When the input enum values is not in list or dict format.

Return type

EnumValues