gpsea.io module

class gpsea.io.GpseaJSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Bases: JSONEncoder

GpseaJSONEncoder encodes gpsea’s types into a JSON message.

The encoder is supposed to be used along with Python’s json module via the cls parameter of json.dump() or json.dumps().

default(o)[source]

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return super().default(o)
class gpsea.io.GpseaJSONDecoder(*args: Any, **kwargs: Any)[source]

Bases: JSONDecoder

GpseaJSONDecoder decodes gpsea’s types from a JSON message.

The decoder is supposed to be used along with Python’s json module via the cls parameter of json.load() or json.loads().

static object_hook(obj: Dict[Any, Any]) Any[source]