Skip to content

Commit b871175

Browse files
committed
update
1 parent e725944 commit b871175

File tree

8 files changed

+36
-0
lines changed

8 files changed

+36
-0
lines changed

__pycache__/__init__.cpython-36.pyc

146 Bytes
Binary file not shown.
150 Bytes
Binary file not shown.
1.87 KB
Binary file not shown.
629 Bytes
Binary file not shown.
661 Bytes
Binary file not shown.
1.13 KB
Binary file not shown.

lib/utils/npy_util.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
-------------------------------------------------
4+
File Name: npy_util
5+
Description:
6+
Author: bowen
7+
date: 2/19/19
8+
-------------------------------------------------
9+
"""
10+
11+
import numpy as np
12+
13+
14+
def load_npy(fpath):
15+
return np.load(fpath)
16+
17+
18+
def save_npy(data, fpath):
19+
np.save(fpath, data)

lib/utils/pkl_util.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import _pickle as cPickle
2+
from pyToolkit.lib.utils.time_util import get_current_time
3+
4+
5+
def save_pickle(data, fpath):
6+
print("Saving %s..." % fpath, get_current_time())
7+
with open(fpath, 'wb') as handle:
8+
cPickle.dump(data, handle)
9+
print("Saved.", get_current_time())
10+
11+
12+
def load_pickle(fpath):
13+
# print("Loading %s..." % fpath, get_current_time())
14+
with open(fpath, 'rb') as handle:
15+
data = cPickle.load(handle)
16+
# print("Loaded.", get_current_time())
17+
return data

0 commit comments

Comments
 (0)