File tree 3 files changed +23
-5
lines changed
3 files changed +23
-5
lines changed Original file line number Diff line number Diff line change 1
1
name = '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':
107
107
Returns:
108
108
ProteinLanguage: the loaded Protein language object.
109
109
"""
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
112
121
return protein_language
113
122
114
123
@staticmethod
Original file line number Diff line number Diff line change @@ -176,8 +176,17 @@ def load(filepath: str) -> 'SMILESLanguage':
176
176
warnings .warn (
177
177
"Loading languages will use a text files in the future" , FutureWarning
178
178
)
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
181
190
return smiles_language
182
191
183
192
@staticmethod
You can’t perform that action at this time.
0 commit comments