moved pickle functions to separate file, made them accessible from slic.utils

This commit is contained in:
2022-10-12 12:48:08 +02:00
parent 9bf3f0c1a8
commit e0d425acee
3 changed files with 15 additions and 10 deletions
+1
View File
@@ -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
+13
View File
@@ -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
View File
@@ -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)