MCPcopy Create free account
hub / github.com/davisking/dlib / load_pickled_compatible

Function load_pickled_compatible

tools/python/test/utils.py:19–33  ·  view source on GitHub ↗

Loads a pickled object from the specified file

(file_name)

Source from the content-addressed store, hash-verified

17 handle.write(data)
18
19def load_pickled_compatible(file_name):
20 '''
21 Loads a pickled object from the specified file
22 '''
23 try:
24 import cPickle as pickle # Use cPickle on Python 2.7
25 except ImportError:
26 import pickle
27
28 with open(file_name, "rb") as handle:
29 data = handle.read()
30 if not is_python3():
31 return pickle.loads(data)
32 else:
33 return pickle.loads(data, encoding="bytes")
34
35def is_numpy_installed():
36 '''

Callers

nothing calls this directly

Calls 2

is_python3Function · 0.85
readMethod · 0.45

Tested by

no test coverage detected