It seems that I cannot use super() in a class declaration inside a cached function.
I am trying to use an object that requires import taking a long time, I therefore want to place the imports and the class declaration inside the cached function, however, as soon as I add super to subclass, I get the following error
UserHashError : ’ class ’
I made the following code to highlight the issue:
import streamlit as st
@st.cache()
def state():
class Parent:
def test(self):
return "parent"
class child(Parent):
def test(self):
par = super().test()
return "hello"
test = child()
return test.test()
st.text(state())
Resulting in the error:
UserHashError : ’ class ’
Error in
C:\Users\xxxxx\Devel\RICS\rics-gui-web\st_test_class.py
near line11
:
If you think this is actually a Streamlit bug, please file a bug report here.
Traceback:
File "C:\Users\xxxxx\st_test_class.py", line 19, in <module> st.text(state())
If we remove the super() line, everything runs as expected.
Is this a bug or am I missing something?