Loads a pickled object from the specified file
(file_name)
| 17 | handle.write(data) |
| 18 | |
| 19 | def 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 | |
| 35 | def is_numpy_installed(): |
| 36 | ''' |
nothing calls this directly
no test coverage detected