streamlit-nightly 1.45.2.dev20250513__py3-none-any.whl → 1.45.2.dev20250514__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit/commands/execution_control.py +30 -30
- streamlit/elements/heading.py +3 -4
- streamlit/elements/html.py +3 -4
- streamlit/elements/lib/built_in_chart_utils.py +1 -3
- streamlit/elements/lib/image_utils.py +2 -3
- streamlit/elements/lib/options_selector_utils.py +1 -2
- streamlit/elements/lib/pandas_styler_utils.py +1 -3
- streamlit/elements/lib/subtitle_utils.py +6 -9
- streamlit/elements/map.py +1 -2
- streamlit/elements/plotly_chart.py +1 -2
- streamlit/elements/toast.py +1 -2
- streamlit/elements/widgets/chat.py +25 -27
- streamlit/elements/widgets/file_uploader.py +2 -2
- streamlit/elements/widgets/radio.py +4 -5
- streamlit/elements/widgets/select_slider.py +9 -11
- streamlit/navigation/page.py +5 -6
- streamlit/runtime/caching/cache_errors.py +1 -1
- streamlit/runtime/caching/cached_message_replay.py +1 -2
- streamlit/runtime/caching/storage/in_memory_cache_storage_wrapper.py +2 -3
- streamlit/runtime/context.py +1 -5
- streamlit/runtime/media_file_manager.py +1 -2
- streamlit/runtime/state/session_state.py +1 -2
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{ErrorOutline.esm.CxkgXqSh.js → ErrorOutline.esm.DbGVRvJi.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.DVrjmwoh.js → FileDownload.esm.Dsazfko3.js} +1 -1
- streamlit/static/static/js/{FileHelper.CMA9s0t3.js → FileHelper.MycXbml-.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.Ca3GFjxv.js → FormClearHelper.BBCnWP4b.js} +1 -1
- streamlit/static/static/js/{Hooks.BpCPXt5n.js → Hooks.Cogxcj3O.js} +1 -1
- streamlit/static/static/js/{InputInstructions.BO_BnHv5.js → InputInstructions.DmFmv5Ss.js} +1 -1
- streamlit/static/static/js/{ProgressBar.Ctk1m4EX.js → ProgressBar.CL8D7fKU.js} +1 -1
- streamlit/static/static/js/{RenderInPortalIfExists.kuKoxpXt.js → RenderInPortalIfExists.BIF2_x-k.js} +1 -1
- streamlit/static/static/js/{Toolbar.Cde1fEcQ.js → Toolbar.BiePqUs0.js} +1 -1
- streamlit/static/static/js/{base-input.BwCmIYba.js → base-input.9-IewVJN.js} +1 -1
- streamlit/static/static/js/{checkbox.CwPOyuag.js → checkbox.CvxVkFoK.js} +1 -1
- streamlit/static/static/js/{createSuper.BMtevhyt.js → createSuper.CcYwpbOm.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.gtfE9z1L.js → data-grid-overlay-editor.DVakjLUQ.js} +1 -1
- streamlit/static/static/js/{downloader.-58ZXBvx.js → downloader.DUDYpW4X.js} +1 -1
- streamlit/static/static/js/{es6.6JpsZqpF.js → es6.Dd8C3gJG.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.Dvm_jxul.js → iframeResizer.contentWindow.ElqrcVSG.js} +1 -1
- streamlit/static/static/js/{index.DW60zbv4.js → index.3TsDLcVz.js} +1 -1
- streamlit/static/static/js/{index.B9LBeTzL.js → index.8U8I-dVE.js} +1 -1
- streamlit/static/static/js/{index.DJ0X7aeY.js → index.B5gxNAgv.js} +1 -1
- streamlit/static/static/js/{index.lYSTjxV_.js → index.BANNX-Et.js} +1 -1
- streamlit/static/static/js/{index.Ce-7kIl6.js → index.BRTdJWEL.js} +1 -1
- streamlit/static/static/js/{index.CZy9JHE4.js → index.BYGvkzYg.js} +6 -6
- streamlit/static/static/js/{index.DUizq_aW.js → index.Bgid2lLN.js} +1 -1
- streamlit/static/static/js/{index.DNNQBTM6.js → index.BkpDVBQw.js} +1 -1
- streamlit/static/static/js/{index.NfOJ2GJ6.js → index.Bud-F2Rk.js} +1 -1
- streamlit/static/static/js/{index.CGJjlswG.js → index.C-wDYZmi.js} +1 -1
- streamlit/static/static/js/{index.BhODUTaJ.js → index.C44ecW4y.js} +1 -1
- streamlit/static/static/js/{index.Bd91GXu8.js → index.CDxF0FlW.js} +1 -1
- streamlit/static/static/js/{index.DQJE0i9s.js → index.CM8qhnIu.js} +5 -5
- streamlit/static/static/js/{index.BdEKCy-o.js → index.Chn8rXFO.js} +1 -1
- streamlit/static/static/js/{index.WVgPkrrw.js → index.CkOK3vMg.js} +1 -1
- streamlit/static/static/js/{index.DgnhzFgr.js → index.CssifhIa.js} +1 -1
- streamlit/static/static/js/{index.CvKH37SN.js → index.CtEWZzBM.js} +1 -1
- streamlit/static/static/js/{index.D1ccH_2Z.js → index.CwLlrvyN.js} +1 -1
- streamlit/static/static/js/{index.BjtSRm-c.js → index.D0fj09K-.js} +1 -1
- streamlit/static/static/js/{index.D0G-y_z6.js → index.D5Y8GQ-0.js} +1 -1
- streamlit/static/static/js/{index.hQ5adhxG.js → index.D8g5_NeN.js} +1 -1
- streamlit/static/static/js/{index.B1T1N6vQ.js → index.DK1C5mv_.js} +1 -1
- streamlit/static/static/js/{index.CIZd1q4K.js → index.DNeEyPk6.js} +1 -1
- streamlit/static/static/js/{index.D3ES4sSL.js → index.DWBlm6kP.js} +1 -1
- streamlit/static/static/js/{index.BnK8pWHN.js → index.DWL3vnFa.js} +1 -1
- streamlit/static/static/js/{index.DVE5BhiT.js → index.DX_Td1Hq.js} +1 -1
- streamlit/static/static/js/{index.BXdNB_A0.js → index.DfYxhBCm.js} +1 -1
- streamlit/static/static/js/{index.Dqcp7EZB.js → index.DgQ-i_4o.js} +72 -72
- streamlit/static/static/js/{index.CiiU1-bS.js → index.DiE_wY_P.js} +1 -1
- streamlit/static/static/js/{index.CD3lJu6g.js → index.DrVpZAT_.js} +1 -1
- streamlit/static/static/js/{index.9Bu4pGgs.js → index.Dxf51cqQ.js} +1 -1
- streamlit/static/static/js/{index.bkU6rhIM.js → index.Ogd9LUng.js} +1 -1
- streamlit/static/static/js/{index.DR9ekgzX.js → index.PYQDVW05.js} +1 -1
- streamlit/static/static/js/{index.Dk_aZplH.js → index.QqgppQA_.js} +1 -1
- streamlit/static/static/js/{index.ClE8XHxl.js → index.rR2rxOdw.js} +1 -1
- streamlit/static/static/js/{index.C5xsotRs.js → index.uT7_kc4D.js} +1 -1
- streamlit/static/static/js/{index.DenamHJl.js → index.y8UOtxmw.js} +1 -1
- streamlit/static/static/js/{input.JEUWF6Z-.js → input.D1uIuNvR.js} +1 -1
- streamlit/static/static/js/{memory.BToPJrCN.js → memory.C_YLF4Fx.js} +1 -1
- streamlit/static/static/js/{mergeWith.DGon2YId.js → mergeWith.BrhEAUIQ.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.kqkFTYSn.js → number-overlay-editor.Cl4hS5U2.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.twGQoCQl.js → possibleConstructorReturn.BizCfnoE.js} +1 -1
- streamlit/static/static/js/{sandbox.o85HOKwq.js → sandbox.BYlf4D-n.js} +1 -1
- streamlit/static/static/js/{textarea.CdOYpTta.js → textarea.BvMrgzVs.js} +1 -1
- streamlit/static/static/js/{timepicker.Cy1BKBo3.js → timepicker.8sMF8VpM.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.BVXfsvDc.js → toConsumableArray.Cl96Bc5x.js} +1 -1
- streamlit/static/static/js/{uniqueId.Dz7-nY8K.js → uniqueId.BoXr82qs.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.CeKdNkz-.js → useBasicWidgetState.DYpB4KjS.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.CM8BtP-c.js → useOnInputChange.D17AAeVI.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.DuyW554J.js → withFullScreenWrapper.Lq8QUQxx.js} +1 -1
- streamlit/testing/v1/element_tree.py +2 -4
- streamlit/testing/v1/local_script_runner.py +1 -2
- streamlit/url_util.py +1 -1
- {streamlit_nightly-1.45.2.dev20250513.dist-info → streamlit_nightly-1.45.2.dev20250514.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.45.2.dev20250513.dist-info → streamlit_nightly-1.45.2.dev20250514.dist-info}/RECORD +98 -98
- {streamlit_nightly-1.45.2.dev20250513.dist-info → streamlit_nightly-1.45.2.dev20250514.dist-info}/WHEEL +1 -1
- {streamlit_nightly-1.45.2.dev20250513.data → streamlit_nightly-1.45.2.dev20250514.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.45.2.dev20250513.dist-info → streamlit_nightly-1.45.2.dev20250514.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.45.2.dev20250513.dist-info → streamlit_nightly-1.45.2.dev20250514.dist-info}/top_level.txt +0 -0
@@ -64,38 +64,38 @@ def _new_fragment_id_queue(
|
|
64
64
|
if scope == "app":
|
65
65
|
return []
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
)
|
92
|
-
|
93
|
-
new_queue = list(dropwhile(lambda x: x != ctx.current_fragment_id, curr_queue))
|
94
|
-
assert new_queue, (
|
95
|
-
"Could not find current_fragment_id in fragment_id_queue. This should never happen."
|
67
|
+
# > scope == "fragment"
|
68
|
+
curr_queue = ctx.fragment_ids_this_run
|
69
|
+
|
70
|
+
# If st.rerun(scope="fragment") is called during a full script run, we raise an
|
71
|
+
# exception. This occurs, of course, if st.rerun(scope="fragment") is called
|
72
|
+
# outside of a fragment, but it somewhat surprisingly occurs if it gets called
|
73
|
+
# from within a fragment during a run of the full script. While this behavior may
|
74
|
+
# be surprising, it seems somewhat reasonable given that the correct behavior of
|
75
|
+
# calling st.rerun(scope="fragment") in this situation is unclear to me:
|
76
|
+
# * Rerunning just the fragment immediately may cause weirdness down the line
|
77
|
+
# as any part of the script that occurs after the fragment will not be
|
78
|
+
# executed.
|
79
|
+
# * Waiting until the full script run completes before rerunning the fragment
|
80
|
+
# seems odd (even if we normally do this before running a fragment not
|
81
|
+
# triggered by st.rerun()) because it defers the execution of st.rerun().
|
82
|
+
# * Rerunning the full app feels incorrect as we're seemingly ignoring the
|
83
|
+
# `scope` argument.
|
84
|
+
# With these issues and given that it seems pretty unnatural to have a
|
85
|
+
# fragment-scoped rerun happen during a full script run to begin with, it seems
|
86
|
+
# reasonable to just disallow this completely for now.
|
87
|
+
if not curr_queue:
|
88
|
+
raise StreamlitAPIException(
|
89
|
+
'scope="fragment" can only be specified from `@st.fragment`-decorated '
|
90
|
+
"functions during fragment reruns."
|
96
91
|
)
|
97
92
|
|
98
|
-
|
93
|
+
new_queue = list(dropwhile(lambda x: x != ctx.current_fragment_id, curr_queue))
|
94
|
+
assert new_queue, (
|
95
|
+
"Could not find current_fragment_id in fragment_id_queue. This should never happen."
|
96
|
+
)
|
97
|
+
|
98
|
+
return new_queue
|
99
99
|
|
100
100
|
|
101
101
|
@gather_metrics("rerun")
|
streamlit/elements/heading.py
CHANGED
@@ -262,10 +262,9 @@ class HeadingMixin:
|
|
262
262
|
]
|
263
263
|
if divider in valid_colors:
|
264
264
|
return cast("str", divider)
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
)
|
265
|
+
raise StreamlitAPIException(
|
266
|
+
f"Divider parameter has invalid value: `{divider}`. Please choose from: {', '.join(valid_colors)}."
|
267
|
+
)
|
269
268
|
|
270
269
|
@staticmethod
|
271
270
|
def _create_heading_proto(
|
streamlit/elements/html.py
CHANGED
@@ -113,10 +113,9 @@ class HtmlMixin:
|
|
113
113
|
# If true, there are only style tags - send html to the event container
|
114
114
|
html_proto.body = html_content
|
115
115
|
return self._event_dg._enqueue("html", html_proto)
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
return self.dg._enqueue("html", html_proto)
|
116
|
+
# Otherwise, send the html to the main container as normal
|
117
|
+
html_proto.body = html_content
|
118
|
+
return self.dg._enqueue("html", html_proto)
|
120
119
|
|
121
120
|
@property
|
122
121
|
def dg(self) -> DeltaGenerator:
|
@@ -559,7 +559,7 @@ def _melt_data(
|
|
559
559
|
|
560
560
|
# Arrow has problems with object types after melting two different dtypes
|
561
561
|
# > pyarrow.lib.ArrowTypeError: "Expected a <TYPE> object, got a object"
|
562
|
-
|
562
|
+
return dataframe_util.fix_arrow_incompatible_column_types(
|
563
563
|
melted_df,
|
564
564
|
selected_columns=[
|
565
565
|
*columns_to_leave_alone,
|
@@ -568,8 +568,6 @@ def _melt_data(
|
|
568
568
|
],
|
569
569
|
)
|
570
570
|
|
571
|
-
return fixed_df
|
572
|
-
|
573
571
|
|
574
572
|
def _maybe_reset_index_in_place(
|
575
573
|
df: pd.DataFrame, x_column: str | None, y_column_list: list[str]
|
@@ -335,9 +335,8 @@ def image_to_url(
|
|
335
335
|
url = runtime.get_instance().media_file_mgr.add(image_data, mimetype, image_id)
|
336
336
|
caching.save_media_data(image_data, mimetype, image_id)
|
337
337
|
return url
|
338
|
-
|
339
|
-
|
340
|
-
return ""
|
338
|
+
# When running in "raw mode", we can't access the MediaFileManager.
|
339
|
+
return ""
|
341
340
|
|
342
341
|
|
343
342
|
def _4d_to_list_3d(array: npt.NDArray[Any]) -> list[npt.NDArray[Any]]:
|
@@ -92,8 +92,7 @@ def get_default_indices(
|
|
92
92
|
indexable_options: Sequence[T], default: Sequence[Any] | Any | None = None
|
93
93
|
) -> list[int]:
|
94
94
|
default_indices = check_and_convert_to_indices(indexable_options, default)
|
95
|
-
|
96
|
-
return default_indices
|
95
|
+
return default_indices if default_indices is not None else []
|
97
96
|
|
98
97
|
|
99
98
|
E1 = TypeVar("E1", bound=Enum)
|
@@ -213,9 +213,7 @@ def _pandas_style_to_css(
|
|
213
213
|
selector = ", ".join(selectors)
|
214
214
|
|
215
215
|
declaration_block = "; ".join(declarations)
|
216
|
-
|
217
|
-
|
218
|
-
return rule_set
|
216
|
+
return selector + " { " + declaration_block + " }"
|
219
217
|
|
220
218
|
|
221
219
|
def _marshall_display_values(
|
@@ -104,9 +104,7 @@ def _srt_to_vtt(srt_data: str | bytes) -> bytes:
|
|
104
104
|
# Add WebVTT file header
|
105
105
|
vtt_content = "WEBVTT\n\n" + vtt_data
|
106
106
|
# Convert the vtt content to bytes
|
107
|
-
|
108
|
-
|
109
|
-
return vtt_content
|
107
|
+
return vtt_content.strip().encode("utf-8")
|
110
108
|
|
111
109
|
|
112
110
|
def _handle_string_or_path_data(data_or_path: str | Path) -> bytes:
|
@@ -123,14 +121,14 @@ def _handle_string_or_path_data(data_or_path: str | Path) -> bytes:
|
|
123
121
|
with open(data_or_path, "rb") as file:
|
124
122
|
content = file.read()
|
125
123
|
return _srt_to_vtt(content) if file_extension == ".srt" else content
|
126
|
-
|
127
|
-
raise ValueError(f"File {data_or_path} does not exist.")
|
124
|
+
if isinstance(data_or_path, Path):
|
125
|
+
raise ValueError(f"File {data_or_path} does not exist.") # noqa: TRY004
|
128
126
|
|
129
127
|
content_string = data_or_path.strip()
|
130
128
|
|
131
129
|
if content_string.startswith("WEBVTT") or content_string == "":
|
132
130
|
return content_string.encode("utf-8")
|
133
|
-
|
131
|
+
if _is_srt(content_string):
|
134
132
|
return _srt_to_vtt(content_string)
|
135
133
|
raise ValueError("The provided string neither matches valid VTT nor SRT format.")
|
136
134
|
|
@@ -173,6 +171,5 @@ def process_subtitle_data(
|
|
173
171
|
)
|
174
172
|
caching.save_media_data(subtitle_data, "text/vtt", coordinates)
|
175
173
|
return file_url
|
176
|
-
|
177
|
-
|
178
|
-
return ""
|
174
|
+
# When running in "raw mode", we can't access the MediaFileManager.
|
175
|
+
return ""
|
streamlit/elements/map.py
CHANGED
@@ -357,8 +357,7 @@ def _get_lat_or_lon_col_name(
|
|
357
357
|
f"Map data must contain a {human_readable_name} column named: "
|
358
358
|
f"{formatted_allowed_col_name}. Existing columns: {formmated_col_names}"
|
359
359
|
)
|
360
|
-
|
361
|
-
col_name = candidate_col_name
|
360
|
+
col_name = candidate_col_name
|
362
361
|
|
363
362
|
# Check that the column is well-formed.
|
364
363
|
# IMPLEMENTATION NOTE: We can't use isnull().values.any() because .values can return
|
@@ -537,8 +537,7 @@ class PlotlyMixin:
|
|
537
537
|
|
538
538
|
self.dg._enqueue("plotly_chart", plotly_chart_proto)
|
539
539
|
return cast("PlotlyState", widget_state.value)
|
540
|
-
|
541
|
-
return self.dg._enqueue("plotly_chart", plotly_chart_proto)
|
540
|
+
return self.dg._enqueue("plotly_chart", plotly_chart_proto)
|
542
541
|
|
543
542
|
@property
|
544
543
|
def dg(self) -> DeltaGenerator:
|
streamlit/elements/toast.py
CHANGED
@@ -127,7 +127,7 @@ def _process_avatar_input(
|
|
127
127
|
|
128
128
|
if avatar is None:
|
129
129
|
return AvatarType.ICON, ""
|
130
|
-
|
130
|
+
if isinstance(avatar, str) and avatar in {item.value for item in PresetNames}:
|
131
131
|
# On the frontend, we only support "assistant" and "user" for the avatar.
|
132
132
|
return (
|
133
133
|
AvatarType.ICON,
|
@@ -137,25 +137,24 @@ def _process_avatar_input(
|
|
137
137
|
else "user"
|
138
138
|
),
|
139
139
|
)
|
140
|
-
|
140
|
+
if isinstance(avatar, str) and is_emoji(avatar):
|
141
141
|
return AvatarType.EMOJI, avatar
|
142
142
|
|
143
|
-
|
143
|
+
if isinstance(avatar, str) and avatar.startswith(":material"):
|
144
144
|
return AvatarType.ICON, validate_material_icon(avatar)
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
) from ex
|
145
|
+
try:
|
146
|
+
return AvatarType.IMAGE, image_to_url(
|
147
|
+
avatar,
|
148
|
+
width=WidthBehavior.ORIGINAL,
|
149
|
+
clamp=False,
|
150
|
+
channels="RGB",
|
151
|
+
output_format="auto",
|
152
|
+
image_id=delta_path,
|
153
|
+
)
|
154
|
+
except Exception as ex:
|
155
|
+
raise StreamlitAPIException(
|
156
|
+
"Failed to load the provided avatar value as an image."
|
157
|
+
) from ex
|
159
158
|
|
160
159
|
|
161
160
|
def _pop_upload_files(
|
@@ -208,16 +207,15 @@ class ChatInputSerde:
|
|
208
207
|
return None
|
209
208
|
if not self.accept_files:
|
210
209
|
return ui_value.data
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
)
|
210
|
+
uploaded_files = _pop_upload_files(ui_value.file_uploader_state)
|
211
|
+
for file in uploaded_files:
|
212
|
+
if self.allowed_types and not isinstance(file, DeletedFile):
|
213
|
+
enforce_filename_restriction(file.name, self.allowed_types)
|
214
|
+
|
215
|
+
return ChatInputValue(
|
216
|
+
text=ui_value.data,
|
217
|
+
files=uploaded_files,
|
218
|
+
)
|
221
219
|
|
222
220
|
def serialize(self, v: str | None) -> ChatInputValueProto:
|
223
221
|
return ChatInputValueProto(data=v)
|
@@ -127,7 +127,7 @@ class FileUploaderSerde:
|
|
127
127
|
|
128
128
|
if not files:
|
129
129
|
return state_proto
|
130
|
-
|
130
|
+
if not isinstance(files, list):
|
131
131
|
files = [files]
|
132
132
|
|
133
133
|
for f in files:
|
@@ -497,7 +497,7 @@ class FileUploaderMixin:
|
|
497
497
|
|
498
498
|
if isinstance(widget_state.value, DeletedFile):
|
499
499
|
return None
|
500
|
-
|
500
|
+
if isinstance(widget_state.value, list):
|
501
501
|
return [f for f in widget_state.value if not isinstance(f, DeletedFile)]
|
502
502
|
|
503
503
|
return widget_state.value
|
@@ -341,12 +341,11 @@ class RadioMixin:
|
|
341
341
|
def handle_captions(caption: str | None) -> str:
|
342
342
|
if caption is None:
|
343
343
|
return ""
|
344
|
-
|
344
|
+
if isinstance(caption, str):
|
345
345
|
return caption
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
)
|
346
|
+
raise StreamlitAPIException(
|
347
|
+
f"Radio captions must be strings. Passed type: {type(caption).__name__}"
|
348
|
+
)
|
350
349
|
|
351
350
|
session_state = get_session_state().filtered_state
|
352
351
|
if key is not None and key in session_state and session_state[key] is None:
|
@@ -102,8 +102,7 @@ class SelectSliderSerde(Generic[T]):
|
|
102
102
|
if start > end:
|
103
103
|
slider_value = [end, start]
|
104
104
|
return slider_value
|
105
|
-
|
106
|
-
return [index_(self.options, v)]
|
105
|
+
return [index_(self.options, v)]
|
107
106
|
|
108
107
|
|
109
108
|
class SelectSliderMixin:
|
@@ -367,15 +366,14 @@ class SelectSliderMixin:
|
|
367
366
|
if start > end:
|
368
367
|
slider_value = [end, start]
|
369
368
|
return slider_value
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
return [0]
|
369
|
+
# Simplify future logic by always making value a list
|
370
|
+
try:
|
371
|
+
return [index_(opt, v)]
|
372
|
+
except ValueError:
|
373
|
+
if value is not None:
|
374
|
+
raise
|
375
|
+
|
376
|
+
return [0]
|
379
377
|
|
380
378
|
# Convert element to index of the elements
|
381
379
|
slider_value = as_index_list(value)
|
streamlit/navigation/page.py
CHANGED
@@ -289,12 +289,11 @@ class StreamlitPage:
|
|
289
289
|
if callable(self._page):
|
290
290
|
self._page()
|
291
291
|
return
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
exec(code, module.__dict__) # noqa: S102
|
292
|
+
code = ctx.pages_manager.get_page_script_byte_code(str(self._page))
|
293
|
+
module = types.ModuleType("__main__")
|
294
|
+
# We want __file__ to be the string path to the script
|
295
|
+
module.__dict__["__file__"] = str(self._page)
|
296
|
+
exec(code, module.__dict__) # noqa: S102
|
298
297
|
|
299
298
|
@property
|
300
299
|
def _script_hash(self) -> str:
|
@@ -30,7 +30,7 @@ def get_cached_func_name_md(func: Any) -> str:
|
|
30
30
|
"""Get markdown representation of the function name."""
|
31
31
|
if hasattr(func, "__name__"):
|
32
32
|
return f"`{func.__name__}()`"
|
33
|
-
|
33
|
+
if hasattr(type(func), "__name__"):
|
34
34
|
return f"`{type(func).__name__}`"
|
35
35
|
return f"`{type(func)}`"
|
36
36
|
|
@@ -218,8 +218,7 @@ class CachedMessageReplayContext(threading.local):
|
|
218
218
|
"""
|
219
219
|
if len(self._seen_dg_stack) > 0 and acting_on_id in self._seen_dg_stack[-1]:
|
220
220
|
return acting_on_id
|
221
|
-
|
222
|
-
return invoked_id
|
221
|
+
return invoked_id
|
223
222
|
|
224
223
|
def save_image_data(
|
225
224
|
self, image_data: bytes | str, mimetype: str, image_id: str
|
@@ -131,9 +131,8 @@ class InMemoryCacheStorageWrapper(CacheStorage):
|
|
131
131
|
_LOGGER.debug("Memory cache HIT: %s", key)
|
132
132
|
return entry
|
133
133
|
|
134
|
-
|
135
|
-
|
136
|
-
raise CacheStorageKeyNotFoundError("Key not found in mem cache")
|
134
|
+
_LOGGER.debug("Memory cache MISS: %s", key)
|
135
|
+
raise CacheStorageKeyNotFoundError("Key not found in mem cache")
|
137
136
|
|
138
137
|
def _write_to_mem_cache(self, key: str, entry_bytes: bytes) -> None:
|
139
138
|
with self._mem_cache_lock:
|
streamlit/runtime/context.py
CHANGED
@@ -328,11 +328,7 @@ class ContextProxy:
|
|
328
328
|
url_without_page_prefix = maybe_trim_page_path(
|
329
329
|
url_from_frontend, ctx.pages_manager
|
330
330
|
)
|
331
|
-
|
332
|
-
url_without_page_prefix, ctx.pages_manager
|
333
|
-
)
|
334
|
-
|
335
|
-
return url_with_page_prefix
|
331
|
+
return maybe_add_page_path(url_without_page_prefix, ctx.pages_manager)
|
336
332
|
|
337
333
|
@property
|
338
334
|
@gather_metrics("context.ip_address")
|
@@ -38,8 +38,7 @@ def _get_session_id() -> str:
|
|
38
38
|
# "streamlit run myscript.py". In which case the session ID doesn't
|
39
39
|
# matter and can just be a constant, as there's only ever "session".
|
40
40
|
return "dontcare"
|
41
|
-
|
42
|
-
return ctx.session_id
|
41
|
+
return ctx.session_id
|
43
42
|
|
44
43
|
|
45
44
|
class MediaFileMetadata:
|
@@ -252,8 +252,7 @@ class WStates(MutableMapping[str, Any]):
|
|
252
252
|
for widget_id in self.states
|
253
253
|
if self.get_serialized(widget_id)
|
254
254
|
]
|
255
|
-
|
256
|
-
return states
|
255
|
+
return cast("list[WidgetStateProto]", states)
|
257
256
|
|
258
257
|
def call_callback(self, widget_id: str) -> None:
|
259
258
|
"""Call the given widget's callback and return the callback's
|
streamlit/static/index.html
CHANGED
@@ -51,7 +51,7 @@
|
|
51
51
|
<script>
|
52
52
|
window.prerenderReady = false
|
53
53
|
</script>
|
54
|
-
<script type="module" crossorigin src="./static/js/index.
|
54
|
+
<script type="module" crossorigin src="./static/js/index.DgQ-i_4o.js"></script>
|
55
55
|
<link rel="stylesheet" crossorigin href="./static/css/index.C6rq3aMZ.css">
|
56
56
|
</head>
|
57
57
|
<body>
|
@@ -1 +1 @@
|
|
1
|
-
import{r,E as a,_ as n}from"./index.
|
1
|
+
import{r,E as a,_ as n}from"./index.DgQ-i_4o.js";var i=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(a,n({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{d:"M11 15h2v2h-2v-2zm0-8h2v6h-2V7zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))});i.displayName="ErrorOutline";export{i as E};
|
@@ -1 +1 @@
|
|
1
|
-
import{r as e,E as n,_ as a}from"./index.
|
1
|
+
import{r as e,E as n,_ as a}from"./index.DgQ-i_4o.js";var o=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),e.createElement("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}))});o.displayName="Delete";var i=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("rect",{width:24,height:24,fill:"none"}),e.createElement("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4l-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z"}))});i.displayName="FileDownload";export{o as D,i as F};
|