moved pickle functions to separate file, made them accessible from slic.utils
This commit is contained in:
@@ -13,6 +13,7 @@ from .marker import Marker, markers
|
||||
from .namespace import Namespace
|
||||
from .npy import nice_linspace, nice_arange, fraction_to_percentage, within, within_fraction, get_dtype, get_shape, is_array
|
||||
from .path import can_create_all_files, can_create_file, glob_files, make_missing_dir
|
||||
from .picklio import pickle, unpickle
|
||||
from .pv import PV
|
||||
from .readable import readable_seconds
|
||||
from .screenshot import Screenshot
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import pickle as pkl
|
||||
|
||||
|
||||
def pickle(obj, fn):
|
||||
with open(fn, "wb") as f:
|
||||
pkl.dump(obj, f)
|
||||
|
||||
def unpickle(fn):
|
||||
with open(fn, "rb") as f:
|
||||
return pkl.load(f)
|
||||
|
||||
|
||||
|
||||
+1
-10
@@ -1,4 +1,3 @@
|
||||
import pickle as pkl
|
||||
from datetime import datetime, timedelta
|
||||
from pathlib import Path
|
||||
from threading import Thread
|
||||
@@ -9,6 +8,7 @@ from logzero import logger as log
|
||||
|
||||
from .utils import typename
|
||||
from .hastyepics import get_pv
|
||||
from .picklio import pickle, unpickle
|
||||
|
||||
|
||||
fn = ".slic_pvpreload"
|
||||
@@ -64,13 +64,4 @@ def file_age(fn):
|
||||
return delta
|
||||
|
||||
|
||||
def pickle(obj, fn):
|
||||
with open(fn, "wb") as f:
|
||||
pkl.dump(obj, f)
|
||||
|
||||
def unpickle(fn):
|
||||
with open(fn, "rb") as f:
|
||||
return pkl.load(f)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user