ListEnum#

class ListEnum(value)[source]#

Bases: Enum

List Enum (enum with function listing names and values)

Example

>>> @unique
>>> class TsxPolarization(ListEnum):
>>>     SINGLE = "S"  # Single
>>>     DUAL = "D"  # Dual
>>>     QUAD = "Q"  # Quad
>>>     TWIN = "T"  # Twin
classmethod convert_from(to_convert: list | str) list[source]#

Convert from a list or a string to an enum instance

Parameters:

to_convert (Union[list, str]) – List or string to convert into an enum instance

Returns:

Converted list

Return type:

list

Example

>>> TsxPolarization.convert_from(["SINGLE", "S", TsxPolarization.QUAD])
[<TsxPolarization.SINGLE: 'S'>, <TsxPolarization.SINGLE: 'S'>, <TsxPolarization.QUAD: 'Q'>]
classmethod from_value(val: Any) ListEnum[source]#

Get the enum class from its value:

Parameters:

val (Any) – Value of the Enum

Returns:

Enum with value

Return type:

ListEnum

Example

>>> TsxPolarization.from_value("Q")
<TsxPolarization.QUAD: 'Q'>
classmethod list_names() list[source]#

Get the name list of this enum:

Example

>>> TsxPolarization.list_values()
["SINGLE", "DUAL", "QUAD", "TWIN"]
classmethod list_values() list[source]#

Get the value list of this enum

Example

>>> TsxPolarization.list_values()
["S", "D", "Q", "T"]