File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name = 'pytoda'
2- __version__ = '1.0.1 '
2+ __version__ = '1.0.2 '
Original file line number Diff line number Diff line change @@ -107,8 +107,17 @@ def load(filepath: str) -> 'ProteinLanguage':
107107 Returns:
108108 ProteinLanguage: the loaded Protein language object.
109109 """
110- with open (filepath , 'rb' ) as f :
111- protein_language = dill .load (f )
110+ try :
111+ with open (filepath , 'rb' ) as f :
112+ protein_language = dill .load (f )
113+ except TypeError :
114+ # Necessary to load python3.7 pickled objects with >=3.8
115+ # For details see: https://github.com/uqfoundation/dill/pull/406
116+ storage = dill ._dill ._reverse_typemap ['CodeType' ]
117+ dill ._dill ._reverse_typemap ['CodeType' ] = dill ._dill ._create_code
118+ with open (filepath , 'rb' ) as f :
119+ protein_language = dill .load (f )
120+ dill ._dill ._reverse_typemap ['CodeType' ] = storage
112121 return protein_language
113122
114123 @staticmethod
Original file line number Diff line number Diff line change @@ -176,8 +176,17 @@ def load(filepath: str) -> 'SMILESLanguage':
176176 warnings .warn (
177177 "Loading languages will use a text files in the future" , FutureWarning
178178 )
179- with open (filepath , 'rb' ) as f :
180- smiles_language = dill .load (f )
179+ try :
180+ with open (filepath , 'rb' ) as f :
181+ smiles_language = dill .load (f )
182+ except TypeError :
183+ # Necessary to load python3.7 pickled objects with >=3.8:
184+ # For details see: https://github.com/uqfoundation/dill/pull/406
185+ storage = dill ._dill ._reverse_typemap ['CodeType' ]
186+ dill ._dill ._reverse_typemap ['CodeType' ] = dill ._dill ._create_code
187+ with open (filepath , 'rb' ) as f :
188+ smiles_language = dill .load (f )
189+ dill ._dill ._reverse_typemap ['CodeType' ] = storage
181190 return smiles_language
182191
183192 @staticmethod
You can’t perform that action at this time.
0 commit comments