syft.serde.msgpack.proto

This file exists to translate python classes to Serde type constants defined in proto.json file in https://github.com/OpenMined/proto. The reason for this is to have stable constants used in Serde serialization protocol and the definition file that can be used not only by PySyft but also in other languages.

https://github.com/OpenMined/proto (pysyft_proto module) is included as dependency in setup.py exposes contents of proto.json file in proto_info variable.

IMPORTANT: New types added in Serde need to be also defined in proto.json.

Module Contents

class syft.serde.msgpack.proto.TypeInfo(name, obj)

Convenience wrapper for type info defined in proto_info. Exposes type constants with error handling.

property code(self)

Returns code property (serialization constant) for class or throws an exception if it’s not defined in proto.json.

property forced_code(self)

Returns forced_code property (serialization constant) for class or throws an exception if it’s not defined in proto.json.

syft.serde.msgpack.proto.fullname(cls)

Returns full name of a given class (not instance of class). Source: https://stackoverflow.com/questions/2020014/get-fully-qualified-class-name-of-an-object-in-python.

syft.serde.msgpack.proto.proto_type_info(cls)

Returns TypeInfo instance for a given class identified by cls parameter. Throws an exception when such class does not exists in the proto.json.