MCPcopy Create free account
hub / github.com/ActiveState/code / _save

Method _save

recipes/Python/578195_Setting_Namespaces/recipe-578195.py:29–33  ·  view source on GitHub ↗

Save an object to the specified path.

(path, obj)

Source from the content-addressed store, hash-verified

27
28 @staticmethod
29 def _save(path, obj):
30 "Save an object to the specified path."
31 data = zlib.compress(pickletools.optimize(pickle.dumps(obj)), 9)
32 with open(path, 'wb') as file:
33 file.write(data)
34
35 @staticmethod
36 def _load(path):

Callers 1

saveMethod · 0.80

Calls 4

compressMethod · 0.80
openFunction · 0.50
dumpsMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected