Passed
Push — master ( d5b48a...5a31d8 )
by Simon
01:07
created

optimization_metadata.io_dill.load_object()   A

Complexity

Conditions 2

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 2
nop 2
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