pyphi.serialize.save#
- pyphi.serialize.save(obj, target, *, format=None)[source]#
Serialize
objtotarget.- Parameters:
obj (Any) – A PyPhi domain object with a registered serializer (see
pyphi.serialize.convertfor the supported types).target (str or os.PathLike or file object) – Destination path, or an open binary file object to write to.
format ({"json", "msgpack"}, optional) – Wire format. If None (the default), it is inferred from a path’s extension:
.jsongives"json";.msgpackor.mpkgive"msgpack"; any other extension, or a non-path target, gives"json".
- Return type:
None
Notes
A path ending in
.gzis gzip-compressed, with the wire format taken from the inner suffix (result.json.gzyields gzip-compressed JSON). Compression is applied only to path targets, not to file objects.