-
Notifications
You must be signed in to change notification settings - Fork 4k
Add mypy fixes #5662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mypy fixes #5662
Conversation
| Value: TypeAlias = Union["np.integer", "np.floating", float, str, None] | ||
| Delta: TypeAlias = Union[float, str, None] | ||
| Value: TypeAlias = Union["np.integer", "np.floating", float, int, str, None] | ||
| Delta: TypeAlias = Union[float, int, str, None] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: are we not supporting "np.integer", "np.floating", for Delta as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm good point. I'll add those
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, looking at this a bit more, we actually do extra stuff for numpy values here:
streamlit/lib/streamlit/elements/metric.py
Line 143 in 69d2027
| elif hasattr(value, "item"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add that code and make it a function for reusability and add support for delta? I think Deltas and Values would almost surely likely use the same types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have decided to make this a separate PR.
This reverts commit 69d2027.
* develop: Add mypy fixes (streamlit#5662) Don't render stale st.snow and st.ballons elements (streamlit#5401)
* develop: Add mypy fixes (streamlit#5662) Don't render stale st.snow and st.ballons elements (streamlit#5401) Fix unevaluated dataframe exception formatting (streamlit#5657) Update aboutDialog to check SessionInfo.isSet() before referring the instance (streamlit#5518) Replace assertEquals->assertEqual to silence deprecation warnings (streamlit#5648) Reworke AttrDict for st.secrets to explicitly disallow item and attribute assignment (streamlit#5621) Fix pydoc command for streamlit package (streamlit#5535) Temporarily have /st-allowed-message-origins double as a healthcheck (streamlit#5642) Fix Plotly Charts when exiting out of fullscreen (streamlit#5645) Flaky test e2e fixes (streamlit#5610)
📚 Context
mypy is failing
Please describe the project or issue background here
What kind of change does this PR introduce?
🧠 Description of Changes
remove unnecessary mypy ignores and add ints for metric.py