| Total Complexity | 5 |
| Total Lines | 22 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | # Author: Simon Blanke |
||
| 2 | # Email: [email protected] |
||
| 3 | # License: MIT License |
||
| 4 | |||
| 5 | import os |
||
| 6 | import dill |
||
| 7 | |||
| 8 | |||
| 9 | def save_object(path, name, _object): |
||
| 10 | if not os.path.exists(path): |
||
| 11 | os.makedirs(path, exist_ok=True) |
||
| 12 | |||
| 13 | with open(path + name + ".pkl", "wb") as dill_file: |
||
| 14 | dill.dump(_object, dill_file) |
||
| 15 | |||
| 16 | |||
| 17 | def load_object(path, name): |
||
| 18 | with open(path + name + ".pkl", "rb") as dill_file: |
||
| 19 | _object = dill.load(dill_file) |
||
| 20 | |||
| 21 | return _object |
||
| 22 |