@@ -265,14 +265,19 @@ def _to_bytes(self, obj, context):
265
265
elif inspect .iscode (obj ):
266
266
return self ._code_to_bytes (obj , context )
267
267
elif inspect .ismodule (obj ):
268
+ # TODO: Figure out how to best show this kind of warning to the
269
+ # user. In the meantime, show nothing. This scenario is too common,
270
+ # so the current warning is quite annoying...
271
+ # st.warning(('Streamlit does not support hashing modules. '
272
+ # 'We did not hash `%s`.') % obj.__name__)
268
273
# TODO: Hash more than just the name for internal modules.
269
- st .warning (('Streamlit does not support hashing modules. '
270
- 'We did not hash `%s`.' ) % obj .__name__ )
271
274
return self .to_bytes (obj .__name__ )
272
275
elif inspect .isclass (obj ):
273
- # TODO: Hash more than just the name of classes.
276
+ # TODO: Figure out how to best show this kind of warning to the
277
+ # user.
274
278
st .warning (('Streamlit does not support hashing classes. '
275
279
'We did not hash `%s`.' ) % obj .__name__ )
280
+ # TODO: Hash more than just the name of classes.
276
281
return self .to_bytes (obj .__name__ )
277
282
elif isinstance (obj , functools .partial ):
278
283
# The return value of functools.partial is not a plain function:
@@ -288,6 +293,8 @@ def _to_bytes(self, obj, context):
288
293
# As a last resort, we pickle the object to hash it.
289
294
return pickle .dumps (obj , pickle .HIGHEST_PROTOCOL )
290
295
except Exception :
296
+ # TODO: Figure out how to best show this kind of warning to the
297
+ # user.
291
298
st .warning ('Streamlit cannot hash an object of type %s.' % type (obj ))
292
299
293
300
def _code_to_bytes (self , code , context ):
0 commit comments