Skip to content

PickleSerializer

Bases: Serializer[Any]

Serializes with pickle. This is the default serializer, matching alchemical_queues' historical behavior: any pickle-able object is accepted, with no schema or type checking.

Source code in src/alchemical_queues/serializers.py
35
36
37
38
39
40
41
42
43
44
class PickleSerializer(Serializer[Any]):
    """Serializes with `pickle`. This is the default serializer, matching
    alchemical_queues' historical behavior: any pickle-able object is
    accepted, with no schema or type checking."""

    def dumps(self, obj: Any) -> bytes:
        return pickle.dumps(obj)

    def loads(self, data: bytes) -> Any:
        return pickle.loads(data)  # noqa: S301