5
5
This software may be modified and distributed under the terms
6
6
of the BSD license. See the LICENSE file for details.
7
7
'''
8
- from . import util as _util , toolkits as _toolkits , SFrame as _SFrame , SArray as _SArray , \
9
- SGraph as _SGraph , load_graph as _load_graph
10
-
8
+ from . import util as _util , toolkits as _toolkits , SFrame as \
9
+ _SFrame , SArray as _SArray , SGraph as _SGraph , load_graph as \
10
+ _load_graph
11
11
from .util import _get_aws_credentials as _util_get_aws_credentials , \
12
12
cloudpickle as _cloudpickle , file_util as _file_util
13
13
@@ -29,7 +29,6 @@ def _get_temp_filename():
29
29
def _get_tmp_file_location ():
30
30
return _util ._make_temp_directory (prefix = 'gl_pickle_' )
31
31
32
-
33
32
def _get_class_from_name (module_name , class_name ):
34
33
import importlib
35
34
@@ -184,11 +183,11 @@ def __init__(self, filename, protocol = -1, min_bytes_to_save = 0):
184
183
185
184
Parameters
186
185
----------
187
- filename : Name of the file to write to. This file is all you need to pickle
188
- all objects (including GLC objects).
186
+ filename : Name of the file to write to. This file is all you need to
187
+ pickle all objects (including GLC objects).
189
188
190
- protocol : Pickle protocol (see pickle docs). Note that all pickle protocols
191
- may not be compatable with GLC objects.
189
+ protocol : Pickle protocol (see pickle docs). Note: All pickle
190
+ protocols may not be compatable with GLC objects.
192
191
193
192
min_bytes_to_save : Cloud pickle option (see cloud pickle docs).
194
193
@@ -358,12 +357,13 @@ def __gl_pickle_load__(cls, filename):
358
357
359
358
# Save the object
360
359
obj .__gl_pickle_save__ (filename )
360
+ type_tag = (obj .__module__ , obj .__class__ .__name__ )
361
361
362
362
# Memoize.
363
363
self .gl_object_memo .add (id (obj ))
364
364
365
365
# Return the tuple (load_func, relative_filename) in archive.
366
- return (obj . __gl_pickle_load__ , relative_filename , id (obj ))
366
+ return (type_tag , relative_filename , id (obj ))
367
367
368
368
# Not a GLC object. Default to cloud pickle
369
369
else :
@@ -562,9 +562,7 @@ def persistent_load(self, pid):
562
562
class_name )
563
563
obj = type_class .__gl_pickle_load__ (abs_path )
564
564
else :
565
- raise Exception (
566
- "Unknown version %s: Expected version in [1.0, 2.0]" \
567
- % self .version )
565
+ raise Exception ("Unknown version %s" % self .version )
568
566
self .gl_object_memo [object_id ] = obj
569
567
return obj
570
568
0 commit comments