[plum.int.enum] Module Reference

Interpret bytes as integer enumerated constants.

class plum.int.enum.Enum(value)

Interpret bytes as integer enumerated constants.

Parameters:
  • x (number or str) – value
  • base (int) – base of x when x is str
class plum.int.enum.EnumType(name, bases, namespace, nbytes=None, byteorder=None, signed=None, strict=None, source=None)

Integer enumeration type metaclass.

Create custom Enum subclass.

Parameters:
  • nbytes (int) – number of bytes
  • byteorder (str) – 'big' or 'little'
  • signed (bool) – signed integer
  • source (EnumMeta) – enumeration to copy

For example:

>>> from plum.int.enum import Enum
>>> class Enum24(Enum, nbytes=3, byteorder='big'):
...     A = 1
...     B = 2
...     C = 3
...
>>>