-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.py
More file actions
32 lines (22 loc) · 797 Bytes
/
debug.py
File metadata and controls
32 lines (22 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import cPickle as pk
def pickleDict(objDict, fname):
""" Pickle a dictionary of "var name": values for debugging.
Arguments:
:param dict objDict: A dictionary where each key is the name of a
variable and the value is the object itself.
:param str fname: File name of the pickle.
"""
with open(fname, 'wb') as FH:
pk.dump(objDict, FH)
def unPickleDict(fname):
""" Pickle a dictionary of "var name": values for debugging.
Arguments:
:param str fname: File name of the pickle.
Returns:
:rtype: dict
:returns: A dictionary where each key is the name of a
variable and the value is the object itself.
"""
with open(fname, 'rb') as FH:
objDict = pk.load(FH)
return objDict