forked from streamlit/streamlit
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add datetime hashing for st.cache_data and st.cache_resource (streaml…
…it#6812) Previously hashing of datetime objects happens via calling __reduce__, but that fails when datetime object was aware (containing information about the timezone). This changes adding special hashing handling for DateTime objects, by converting them to isoformat(which contains information about timezone offset). Please note that via that we lose information about the exact time zone in hashing, but information about UTC offset will be preserved. So e.g. same date-times with different timezones, but the same time stamp and offset will be hashed to the same value. Which should be fine in the vast majority of cases.
- Loading branch information
Showing
2 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters