register_codec

Contents

register_codec#

eoio.serialisation.codecs.register_codec(codec: AttrCodec, priority: int = 100, overwrite: bool = False) → AttrCodec[source]#

Register a codec under its own name.

Parameters:
  • codec – Codec instance implementing AttrCodec.

  • priority – Consultation order; lower values are offered the value first.

  • overwrite – Whether replacing an already-registered name is permitted.

Returns:

The registered codec, so it can be assigned in the same statement.

Raises:

KeyError – If the name is already registered and overwrite is False.