streamlit-elements
streamlit-elements copied to clipboard
Add AttributeError to __getattr__ in /core/callback.py ElementsCallbackData
getattr should raise a AttributeError when value is not found, not KeyError, which is raised when getitem fails. New function should look like
class ElementsCallbackData(dict): slots = ()
def __getattr__(self, value):
try:
return self.__getitem__(value)
except:
raise AttributeError
See here for more: https://docs.python.org/3/reference/datamodel.html?highlight=getattr#object.getattr
Made pr for this feature here: https://github.com/okld/streamlit-elements/pull/10