55This software may be modified and distributed under the terms
66of the BSD license. See the LICENSE file for details.
77'''
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
1111from .util import _get_aws_credentials as _util_get_aws_credentials , \
1212 cloudpickle as _cloudpickle , file_util as _file_util
1313
@@ -29,7 +29,6 @@ def _get_temp_filename():
2929def _get_tmp_file_location ():
3030 return _util ._make_temp_directory (prefix = 'gl_pickle_' )
3131
32-
3332def _get_class_from_name (module_name , class_name ):
3433 import importlib
3534
@@ -184,11 +183,11 @@ def __init__(self, filename, protocol = -1, min_bytes_to_save = 0):
184183
185184 Parameters
186185 ----------
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).
189188
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.
192191
193192 min_bytes_to_save : Cloud pickle option (see cloud pickle docs).
194193
@@ -358,12 +357,13 @@ def __gl_pickle_load__(cls, filename):
358357
359358 # Save the object
360359 obj .__gl_pickle_save__ (filename )
360+ type_tag = (obj .__module__ , obj .__class__ .__name__ )
361361
362362 # Memoize.
363363 self .gl_object_memo .add (id (obj ))
364364
365365 # 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 ))
367367
368368 # Not a GLC object. Default to cloud pickle
369369 else :
@@ -562,9 +562,7 @@ def persistent_load(self, pid):
562562 class_name )
563563 obj = type_class .__gl_pickle_load__ (abs_path )
564564 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 )
568566 self .gl_object_memo [object_id ] = obj
569567 return obj
570568
0 commit comments