streamlit-nightly 1.45.1.dev20250508__py3-none-any.whl → 1.45.1.dev20250510__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/auth_util.py +3 -3
- streamlit/cli_util.py +3 -2
- streamlit/commands/execution_control.py +1 -1
- streamlit/commands/logo.py +2 -2
- streamlit/commands/navigation.py +6 -5
- streamlit/commands/page_config.py +3 -1
- streamlit/components/types/base_custom_component.py +7 -7
- streamlit/components/v1/custom_component.py +6 -6
- streamlit/config.py +9 -9
- streamlit/config_option.py +2 -2
- streamlit/connections/base_connection.py +3 -3
- streamlit/connections/snowflake_connection.py +5 -5
- streamlit/connections/snowpark_connection.py +3 -3
- streamlit/connections/sql_connection.py +9 -10
- streamlit/cursor.py +6 -6
- streamlit/delta_generator.py +7 -6
- streamlit/delta_generator_singletons.py +3 -3
- streamlit/deprecation_util.py +1 -1
- streamlit/elements/arrow.py +4 -5
- streamlit/elements/code.py +1 -1
- streamlit/elements/dialog_decorator.py +3 -3
- streamlit/elements/doc_string.py +20 -20
- streamlit/elements/layouts.py +26 -7
- streamlit/elements/lib/built_in_chart_utils.py +38 -40
- streamlit/elements/lib/color_util.py +3 -3
- streamlit/elements/lib/column_types.py +4 -4
- streamlit/elements/lib/dialog.py +2 -2
- streamlit/elements/lib/event_utils.py +1 -1
- streamlit/elements/lib/image_utils.py +1 -1
- streamlit/elements/lib/mutable_status_container.py +1 -1
- streamlit/elements/lib/options_selector_utils.py +2 -2
- streamlit/elements/lib/policies.py +3 -3
- streamlit/elements/lib/utils.py +5 -5
- streamlit/elements/metric.py +1 -1
- streamlit/elements/progress.py +9 -12
- streamlit/elements/vega_charts.py +3 -3
- streamlit/elements/widgets/audio_input.py +1 -1
- streamlit/elements/widgets/button.py +1 -1
- streamlit/elements/widgets/button_group.py +4 -4
- streamlit/elements/widgets/camera_input.py +1 -1
- streamlit/elements/widgets/checkbox.py +2 -2
- streamlit/elements/widgets/color_picker.py +1 -1
- streamlit/elements/widgets/data_editor.py +3 -3
- streamlit/elements/widgets/file_uploader.py +1 -1
- streamlit/elements/widgets/multiselect.py +3 -3
- streamlit/elements/widgets/number_input.py +2 -2
- streamlit/elements/widgets/radio.py +1 -1
- streamlit/elements/widgets/select_slider.py +1 -1
- streamlit/elements/widgets/selectbox.py +2 -2
- streamlit/elements/widgets/slider.py +19 -17
- streamlit/elements/widgets/text_widgets.py +2 -2
- streamlit/elements/widgets/time_widgets.py +2 -2
- streamlit/elements/write.py +3 -6
- streamlit/errors.py +34 -21
- streamlit/external/langchain/streamlit_callback_handler.py +2 -2
- streamlit/file_util.py +8 -8
- streamlit/git_util.py +2 -2
- streamlit/hello/dataframe_demo.py +1 -1
- streamlit/hello/mapping_demo.py +1 -1
- streamlit/navigation/page.py +1 -1
- streamlit/proto/Block_pb2.py +38 -29
- streamlit/proto/Block_pb2.pyi +68 -4
- streamlit/proto/DataFrame_pb2.pyi +1 -1
- streamlit/proto/GapSize_pb2.py +29 -0
- streamlit/proto/GapSize_pb2.pyi +70 -0
- streamlit/proto/HeightConfig_pb2.py +27 -0
- streamlit/proto/HeightConfig_pb2.pyi +48 -0
- streamlit/proto/NamedDataSet_pb2.pyi +1 -1
- streamlit/proto/WidthConfig_pb2.py +2 -2
- streamlit/proto/WidthConfig_pb2.pyi +15 -1
- streamlit/runtime/app_session.py +2 -2
- streamlit/runtime/caching/cache_data_api.py +9 -5
- streamlit/runtime/caching/cache_errors.py +3 -3
- streamlit/runtime/caching/cache_resource_api.py +7 -7
- streamlit/runtime/caching/cache_utils.py +9 -9
- streamlit/runtime/caching/cached_message_replay.py +1 -1
- streamlit/runtime/caching/hashing.py +70 -74
- streamlit/runtime/caching/legacy_cache_api.py +1 -1
- streamlit/runtime/caching/storage/in_memory_cache_storage_wrapper.py +3 -1
- streamlit/runtime/caching/storage/local_disk_cache_storage.py +1 -1
- streamlit/runtime/connection_factory.py +15 -15
- streamlit/runtime/context.py +2 -2
- streamlit/runtime/credentials.py +3 -3
- streamlit/runtime/fragment.py +3 -4
- streamlit/runtime/media_file_manager.py +2 -2
- streamlit/runtime/memory_media_file_storage.py +1 -1
- streamlit/runtime/memory_uploaded_file_manager.py +1 -1
- streamlit/runtime/metrics_util.py +5 -6
- streamlit/runtime/pages_manager.py +3 -3
- streamlit/runtime/runtime.py +1 -1
- streamlit/runtime/runtime_util.py +2 -2
- streamlit/runtime/scriptrunner/exec_code.py +10 -3
- streamlit/runtime/scriptrunner/magic.py +13 -8
- streamlit/runtime/scriptrunner/script_runner.py +2 -2
- streamlit/runtime/scriptrunner_utils/exceptions.py +1 -1
- streamlit/runtime/scriptrunner_utils/script_run_context.py +6 -5
- streamlit/runtime/secrets.py +8 -11
- streamlit/runtime/state/query_params.py +2 -2
- streamlit/runtime/state/query_params_proxy.py +1 -1
- streamlit/runtime/state/safe_session_state.py +2 -2
- streamlit/runtime/state/session_state.py +17 -15
- streamlit/runtime/stats.py +1 -1
- streamlit/runtime/uploaded_file_manager.py +1 -1
- streamlit/source_util.py +3 -4
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{ErrorOutline.esm.C9UoaGEN.js → ErrorOutline.esm.BewaDzzJ.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.DoToR9q0.js → FileDownload.esm.D6ilL7v-.js} +1 -1
- streamlit/static/static/js/{FileHelper.Bt4VJ--Q.js → FileHelper.q7erXtkb.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.D5PbW8FI.js → FormClearHelper.Dd0v0IXt.js} +1 -1
- streamlit/static/static/js/{Hooks.DgkQ2Xp9.js → Hooks.CchmJZGs.js} +1 -1
- streamlit/static/static/js/{InputInstructions.DLnLhwHI.js → InputInstructions.DI9h4PJ7.js} +1 -1
- streamlit/static/static/js/{ProgressBar.BtSgh_K-.js → ProgressBar.DfcVR_JA.js} +1 -1
- streamlit/static/static/js/{RenderInPortalIfExists.CjdyBvQX.js → RenderInPortalIfExists.BAkT-LV5.js} +1 -1
- streamlit/static/static/js/{Toolbar.CAYIzVZk.js → Toolbar.CNzefYiX.js} +1 -1
- streamlit/static/static/js/{base-input.CD4xW4_9.js → base-input.BmA1ZV9Y.js} +1 -1
- streamlit/static/static/js/{checkbox.Ba4jj5dR.js → checkbox.mT4TKcAG.js} +1 -1
- streamlit/static/static/js/{createSuper.BBGT9Ijd.js → createSuper.Duo43uhY.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.CYuk1Aj7.js → data-grid-overlay-editor.CY3l_gmP.js} +1 -1
- streamlit/static/static/js/{downloader.DM9KEOCw.js → downloader.CM5asV91.js} +1 -1
- streamlit/static/static/js/{es6.FqM62T4b.js → es6.uiOeU51e.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.s2B09mw2.js → iframeResizer.contentWindow.ClkMmI3q.js} +1 -1
- streamlit/static/static/js/{index.Cwtbhfaf.js → index.1tDlzcmX.js} +1 -1
- streamlit/static/static/js/index.3d64wPzr.js +1 -0
- streamlit/static/static/js/{index.DQi04JYE.js → index.B-oXGsp7.js} +1 -1
- streamlit/static/static/js/{index.0pkoyBcb.js → index.B2EfQ-qM.js} +1 -1
- streamlit/static/static/js/{index.DkGCnTMe.js → index.B5wTpdet.js} +1 -1
- streamlit/static/static/js/{index.DG8IxVeM.js → index.B6y8ns6u.js} +2 -2
- streamlit/static/static/js/{index.B9FiDQ3U.js → index.BArkjssT.js} +1 -1
- streamlit/static/static/js/{index.CpDFZQ4Y.js → index.BPK3aPVr.js} +1 -1
- streamlit/static/static/js/index.BWubePhz.js +1 -0
- streamlit/static/static/js/{index.T5LKPcND.js → index.BmBUBll0.js} +1 -1
- streamlit/static/static/js/{index.BMXmhMlZ.js → index.BnmoQ0mJ.js} +1 -1
- streamlit/static/static/js/{index.BsjuUMyW.js → index.C1_voZpt.js} +1 -1
- streamlit/static/static/js/index.C6tuB1Tp.js +2 -0
- streamlit/static/static/js/{index.BoMRR3tN.js → index.CB8SwV8L.js} +1 -1
- streamlit/static/static/js/{index.CEKMSkSh.js → index.CXmZFP__.js} +36 -36
- streamlit/static/static/js/{index.DTi8Lw0k.js → index.CYAmxIg2.js} +1 -1
- streamlit/static/static/js/{index.DMrO9G6A.js → index.D-zMZsin.js} +1 -1
- streamlit/static/static/js/{index.JTeVe9GQ.js → index.D56z-_rt.js} +1 -1
- streamlit/static/static/js/index.D6AKDy4z.js +1 -0
- streamlit/static/static/js/{index.BFqpCk2P.js → index.D9lEoddJ.js} +1 -1
- streamlit/static/static/js/index.DAEzs_UL.js +1 -0
- streamlit/static/static/js/{index.BDTYk2an.js → index.DLO5_tVd.js} +1 -1
- streamlit/static/static/js/{index.BY7-qCf5.js → index.DLyB6OQM.js} +1 -1
- streamlit/static/static/js/index.DNWXtL99.js +1 -0
- streamlit/static/static/js/index.DbgE46VI.js +1 -0
- streamlit/static/static/js/{index.b9kK7Vzl.js → index.DeLPvnoy.js} +1 -1
- streamlit/static/static/js/{index.CH9XN_-G.js → index.DeeFVG0Y.js} +2 -2
- streamlit/static/static/js/{index.BVA8TXNT.js → index.Dhu_cVNQ.js} +1 -1
- streamlit/static/static/js/{index.R0peMEpV.js → index.Dj8nqcpI.js} +1 -1
- streamlit/static/static/js/{index.D9FvPPrI.js → index.DpWg6flp.js} +1 -1
- streamlit/static/static/js/{index.CeiCniCg.js → index.IqYlA3jn.js} +1 -1
- streamlit/static/static/js/{index.DSDkXosb.js → index.JA6OF_5t.js} +2 -2
- streamlit/static/static/js/{index.C2qCX1Lh.js → index.PoIwzrI7.js} +151 -151
- streamlit/static/static/js/{index.CqaahZPf.js → index.SW3uv22k.js} +1 -1
- streamlit/static/static/js/{index.DWaB7Scf.js → index.WlA_Ju7i.js} +1 -1
- streamlit/static/static/js/{index.CP2PmB93.js → index.blwBIOHe.js} +1 -1
- streamlit/static/static/js/{index.CyE1OdOj.js → index.wiodyGjO.js} +1 -1
- streamlit/static/static/js/{input.DMOGBelK.js → input.B3uNJm6d.js} +1 -1
- streamlit/static/static/js/{memory.DmCktBGW.js → memory.BWtwV556.js} +1 -1
- streamlit/static/static/js/{mergeWith.DeWTsJ5h.js → mergeWith.BeTmYGS_.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.DDFelcUP.js → number-overlay-editor.MW9-6kFx.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.CYJtAqB-.js → possibleConstructorReturn.ZgHiGHSO.js} +1 -1
- streamlit/static/static/js/{sandbox.CfaU9Ih9.js → sandbox.BZyTt4zT.js} +1 -1
- streamlit/static/static/js/{textarea.7hWYKDw2.js → textarea.CgvEg9Xi.js} +1 -1
- streamlit/static/static/js/{timepicker.DZsgZ9oE.js → timepicker.CHPC9KOb.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.CqWB4Jry.js → toConsumableArray.6GvveewD.js} +1 -1
- streamlit/static/static/js/{uniqueId.DQ533D9O.js → uniqueId.BV5h1uCx.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.-99xbU_o.js → useBasicWidgetState.DzE2MsN8.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.B4G2Q7Bu.js → useOnInputChange.sGAnyCSU.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.BJQZ2aNc.js → withFullScreenWrapper.Bh08pTH8.js} +1 -1
- streamlit/string_util.py +6 -7
- streamlit/temporary_directory.py +12 -3
- streamlit/testing/v1/app_test.py +11 -6
- streamlit/testing/v1/element_tree.py +134 -158
- streamlit/testing/v1/local_script_runner.py +5 -5
- streamlit/testing/v1/util.py +11 -4
- streamlit/type_util.py +3 -4
- streamlit/user_info.py +3 -2
- streamlit/util.py +1 -1
- streamlit/vendor/pympler/asizeof.py +1 -1
- streamlit/watcher/event_based_path_watcher.py +1 -1
- streamlit/watcher/folder_black_list.py +1 -1
- streamlit/watcher/local_sources_watcher.py +5 -5
- streamlit/watcher/path_watcher.py +1 -1
- streamlit/web/cli.py +12 -11
- streamlit/web/server/browser_websocket_handler.py +1 -1
- streamlit/web/server/component_request_handler.py +1 -1
- streamlit/web/server/media_file_handler.py +2 -1
- streamlit/web/server/oauth_authlib_routes.py +2 -2
- streamlit/web/server/oidc_mixin.py +13 -6
- streamlit/web/server/routes.py +3 -3
- streamlit/web/server/server.py +1 -1
- streamlit/web/server/server_util.py +7 -6
- streamlit/web/server/upload_file_request_handler.py +5 -5
- {streamlit_nightly-1.45.1.dev20250508.dist-info → streamlit_nightly-1.45.1.dev20250510.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.45.1.dev20250508.dist-info → streamlit_nightly-1.45.1.dev20250510.dist-info}/RECORD +201 -197
- {streamlit_nightly-1.45.1.dev20250508.dist-info → streamlit_nightly-1.45.1.dev20250510.dist-info}/WHEEL +1 -1
- streamlit/static/static/js/index.CCD4LJ9Q.js +0 -1
- streamlit/static/static/js/index.CbLZDRQu.js +0 -1
- streamlit/static/static/js/index.D9qEk5xd.js +0 -1
- streamlit/static/static/js/index.DTXSsTgK.js +0 -1
- streamlit/static/static/js/index.DqVjOqxm.js +0 -1
- streamlit/static/static/js/index.RHbaxsqm.js +0 -1
- streamlit/static/static/js/index.hT9gkW3a.js +0 -2
- {streamlit_nightly-1.45.1.dev20250508.data → streamlit_nightly-1.45.1.dev20250510.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.45.1.dev20250508.dist-info → streamlit_nightly-1.45.1.dev20250510.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.45.1.dev20250508.dist-info → streamlit_nightly-1.45.1.dev20250510.dist-info}/top_level.txt +0 -0
@@ -420,7 +420,7 @@ class ButtonMixin:
|
|
420
420
|
data with a cached function. When working with a download button, it's
|
421
421
|
similarly recommended to convert your data into a downloadable format
|
422
422
|
with a cached function. Caching ensures that the app reruns
|
423
|
-
|
423
|
+
efficiently.
|
424
424
|
|
425
425
|
>>> import streamlit as st
|
426
426
|
>>> import pandas as pd
|
@@ -165,7 +165,7 @@ class ButtonGroupSerde(Generic[T]):
|
|
165
165
|
options: Sequence[T],
|
166
166
|
default_values: list[int],
|
167
167
|
type: Literal["single", "multi"],
|
168
|
-
):
|
168
|
+
) -> None:
|
169
169
|
self.options = options
|
170
170
|
self.default_values = default_values
|
171
171
|
self.type = type
|
@@ -250,7 +250,7 @@ def _build_proto(
|
|
250
250
|
return proto
|
251
251
|
|
252
252
|
|
253
|
-
def _maybe_raise_selection_mode_warning(selection_mode: SelectionMode):
|
253
|
+
def _maybe_raise_selection_mode_warning(selection_mode: SelectionMode) -> None:
|
254
254
|
"""Check if the selection_mode value is valid or raise exception otherwise."""
|
255
255
|
if selection_mode not in ["single", "multi"]:
|
256
256
|
raise StreamlitAPIException(
|
@@ -550,7 +550,7 @@ class ButtonGroupMixin:
|
|
550
550
|
label_visibility: "visible", "hidden", or "collapsed"
|
551
551
|
The visibility of the label. The default is ``"visible"``. If this
|
552
552
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
553
|
-
label, which can help keep the widget
|
553
|
+
label, which can help keep the widget aligned with other widgets.
|
554
554
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
555
555
|
|
556
556
|
Returns
|
@@ -759,7 +759,7 @@ class ButtonGroupMixin:
|
|
759
759
|
label_visibility: "visible", "hidden", or "collapsed"
|
760
760
|
The visibility of the label. The default is ``"visible"``. If this
|
761
761
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
762
|
-
label, which can help keep the widget
|
762
|
+
label, which can help keep the widget aligned with other widgets.
|
763
763
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
764
764
|
|
765
765
|
Returns
|
@@ -160,7 +160,7 @@ class CameraInputMixin:
|
|
160
160
|
label_visibility : "visible", "hidden", or "collapsed"
|
161
161
|
The visibility of the label. The default is ``"visible"``. If this
|
162
162
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
163
|
-
label, which can help keep the widget
|
163
|
+
label, which can help keep the widget aligned with other widgets.
|
164
164
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
165
165
|
|
166
166
|
width : "stretch" or int
|
@@ -130,7 +130,7 @@ class CheckboxMixin:
|
|
130
130
|
label_visibility : "visible", "hidden", or "collapsed"
|
131
131
|
The visibility of the label. The default is ``"visible"``. If this
|
132
132
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
133
|
-
label, which can help keep the widget
|
133
|
+
label, which can help keep the widget aligned with other widgets.
|
134
134
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
135
135
|
|
136
136
|
Returns
|
@@ -241,7 +241,7 @@ class CheckboxMixin:
|
|
241
241
|
label_visibility : "visible", "hidden", or "collapsed"
|
242
242
|
The visibility of the label. The default is ``"visible"``. If this
|
243
243
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
244
|
-
label, which can help keep the widget
|
244
|
+
label, which can help keep the widget aligned with other widgets.
|
245
245
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
246
246
|
|
247
247
|
Returns
|
@@ -133,7 +133,7 @@ class ColorPickerMixin:
|
|
133
133
|
label_visibility : "visible", "hidden", or "collapsed"
|
134
134
|
The visibility of the label. The default is ``"visible"``. If this
|
135
135
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
136
|
-
label, which can help keep the widget
|
136
|
+
label, which can help keep the widget aligned with other widgets.
|
137
137
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
138
138
|
|
139
139
|
Returns
|
@@ -477,7 +477,7 @@ def _fix_column_headers(data_df: pd.DataFrame) -> None:
|
|
477
477
|
)
|
478
478
|
|
479
479
|
|
480
|
-
def _check_column_names(data_df: pd.DataFrame):
|
480
|
+
def _check_column_names(data_df: pd.DataFrame) -> None:
|
481
481
|
"""Check if the column names in the provided dataframe are valid.
|
482
482
|
|
483
483
|
It's not allowed to have duplicate column names or column names that are
|
@@ -511,7 +511,7 @@ def _check_type_compatibilities(
|
|
511
511
|
data_df: pd.DataFrame,
|
512
512
|
columns_config: ColumnConfigMapping,
|
513
513
|
dataframe_schema: DataframeSchema,
|
514
|
-
):
|
514
|
+
) -> None:
|
515
515
|
"""Check column type to data type compatibility.
|
516
516
|
|
517
517
|
Iterates the index and all columns of the dataframe to check if
|
@@ -666,7 +666,7 @@ class DataEditorMixin:
|
|
666
666
|
Desired height of the data editor expressed in pixels. If ``height``
|
667
667
|
is ``None`` (default), Streamlit sets the height to show at most
|
668
668
|
ten rows. Vertical scrolling within the data editor element is
|
669
|
-
enabled when the height does not
|
669
|
+
enabled when the height does not accommodate all rows.
|
670
670
|
|
671
671
|
use_container_width : bool
|
672
672
|
Whether to override ``width`` with the width of the parent
|
@@ -330,7 +330,7 @@ class FileUploaderMixin:
|
|
330
330
|
label_visibility : "visible", "hidden", or "collapsed"
|
331
331
|
The visibility of the label. The default is ``"visible"``. If this
|
332
332
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
333
|
-
label, which can help keep the widget
|
333
|
+
label, which can help keep the widget aligned with other widgets.
|
334
334
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
335
335
|
|
336
336
|
width : "stretch" or int
|
@@ -75,7 +75,7 @@ class MultiSelectSerde(Generic[T]):
|
|
75
75
|
formatted_options: list[str],
|
76
76
|
formatted_option_to_option_index: dict[str, int],
|
77
77
|
default_options_indices: list[int] | None = None,
|
78
|
-
):
|
78
|
+
) -> None:
|
79
79
|
"""Initialize the MultiSelectSerde.
|
80
80
|
|
81
81
|
We do not store an option_to_formatted_option mapping because the generic
|
@@ -140,7 +140,7 @@ def _get_default_count(default: Sequence[Any] | Any | None) -> int:
|
|
140
140
|
|
141
141
|
def _check_max_selections(
|
142
142
|
selections: Sequence[Any] | Any | None, max_selections: int | None
|
143
|
-
):
|
143
|
+
) -> None:
|
144
144
|
if max_selections is None:
|
145
145
|
return
|
146
146
|
|
@@ -316,7 +316,7 @@ class MultiSelectMixin:
|
|
316
316
|
label_visibility: "visible", "hidden", or "collapsed"
|
317
317
|
The visibility of the label. The default is ``"visible"``. If this
|
318
318
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
319
|
-
label, which can help keep the widget
|
319
|
+
label, which can help keep the widget aligned with other widgets.
|
320
320
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
321
321
|
|
322
322
|
accept_new_options: bool
|
@@ -235,7 +235,7 @@ class NumberInputMixin:
|
|
235
235
|
|
236
236
|
.. note::
|
237
237
|
Integer values exceeding +/- ``(1<<53) - 1`` cannot be accurately
|
238
|
-
stored or returned by the widget due to serialization
|
238
|
+
stored or returned by the widget due to serialization constraints
|
239
239
|
between the Python server and JavaScript client. You must handle
|
240
240
|
such numbers as floats, leading to a loss in precision.
|
241
241
|
|
@@ -331,7 +331,7 @@ class NumberInputMixin:
|
|
331
331
|
label_visibility : "visible", "hidden", or "collapsed"
|
332
332
|
The visibility of the label. The default is ``"visible"``. If this
|
333
333
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
334
|
-
label, which can help keep the widget
|
334
|
+
label, which can help keep the widget aligned with other widgets.
|
335
335
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
336
336
|
|
337
337
|
icon : str, None
|
@@ -219,7 +219,7 @@ class RadioMixin:
|
|
219
219
|
label_visibility : "visible", "hidden", or "collapsed"
|
220
220
|
The visibility of the label. The default is ``"visible"``. If this
|
221
221
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
222
|
-
label, which can help keep the widget
|
222
|
+
label, which can help keep the widget aligned with other widgets.
|
223
223
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
224
224
|
|
225
225
|
Returns
|
@@ -255,7 +255,7 @@ class SelectSliderMixin:
|
|
255
255
|
label_visibility : "visible", "hidden", or "collapsed"
|
256
256
|
The visibility of the label. The default is ``"visible"``. If this
|
257
257
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
258
|
-
label, which can help keep the widget
|
258
|
+
label, which can help keep the widget aligned with other widgets.
|
259
259
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
260
260
|
|
261
261
|
width : "stretch" or int
|
@@ -72,7 +72,7 @@ class SelectboxSerde(Generic[T]):
|
|
72
72
|
formatted_options: list[str],
|
73
73
|
formatted_option_to_option_index: dict[str, int],
|
74
74
|
default_option_index: int | None = None,
|
75
|
-
):
|
75
|
+
) -> None:
|
76
76
|
"""Initialize the SelectboxSerde.
|
77
77
|
|
78
78
|
We do not store an option_to_formatted_option mapping because the generic
|
@@ -334,7 +334,7 @@ class SelectboxMixin:
|
|
334
334
|
label_visibility : "visible", "hidden", or "collapsed"
|
335
335
|
The visibility of the label. The default is ``"visible"``. If this
|
336
336
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
337
|
-
label, which can help keep the widget
|
337
|
+
label, which can help keep the widget aligned with other widgets.
|
338
338
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
339
339
|
|
340
340
|
accept_new_options : bool
|
@@ -85,8 +85,8 @@ SliderDatelikeSpanT: TypeAlias = Union[
|
|
85
85
|
StepNumericT: TypeAlias = SliderNumericT
|
86
86
|
StepDatelikeT: TypeAlias = timedelta
|
87
87
|
|
88
|
-
SliderStep = Union[int, float, timedelta]
|
89
|
-
SliderScalar = Union[int, float, date, time, datetime]
|
88
|
+
SliderStep: TypeAlias = Union[int, float, timedelta]
|
89
|
+
SliderScalar: TypeAlias = Union[int, float, date, time, datetime]
|
90
90
|
SliderValueT = TypeVar("SliderValueT", int, float, date, time, datetime)
|
91
91
|
SliderValueGeneric: TypeAlias = Union[
|
92
92
|
SliderValueT,
|
@@ -162,7 +162,7 @@ class SliderSerde:
|
|
162
162
|
single_value: bool
|
163
163
|
orig_tz: tzinfo | None
|
164
164
|
|
165
|
-
def deserialize_single_value(self, value: float):
|
165
|
+
def deserialize_single_value(self, value: float) -> SliderScalar:
|
166
166
|
if self.data_type == SliderProto.INT:
|
167
167
|
return int(value)
|
168
168
|
if self.data_type == SliderProto.DATETIME:
|
@@ -177,7 +177,7 @@ class SliderSerde:
|
|
177
177
|
)
|
178
178
|
return value
|
179
179
|
|
180
|
-
def deserialize(self, ui_value: list[float] | None):
|
180
|
+
def deserialize(self, ui_value: list[float] | None) -> Any:
|
181
181
|
if ui_value is not None:
|
182
182
|
val = ui_value
|
183
183
|
else:
|
@@ -185,8 +185,10 @@ class SliderSerde:
|
|
185
185
|
val = self.value
|
186
186
|
|
187
187
|
# The widget always returns a float array, so fix the return type if necessary
|
188
|
-
|
189
|
-
return
|
188
|
+
deserialized_values = [self.deserialize_single_value(v) for v in val]
|
189
|
+
return (
|
190
|
+
deserialized_values[0] if self.single_value else tuple(deserialized_values)
|
191
|
+
)
|
190
192
|
|
191
193
|
def serialize(self, v: Any) -> list[Any]:
|
192
194
|
range_value = isinstance(v, (list, tuple))
|
@@ -424,7 +426,7 @@ class SliderMixin:
|
|
424
426
|
|
425
427
|
.. note::
|
426
428
|
Integer values exceeding +/- ``(1<<53) - 1`` cannot be accurately
|
427
|
-
stored or returned by the widget due to serialization
|
429
|
+
stored or returned by the widget due to serialization constraints
|
428
430
|
between the Python server and JavaScript client. You must handle
|
429
431
|
such numbers as floats, leading to a loss in precision.
|
430
432
|
|
@@ -532,7 +534,7 @@ class SliderMixin:
|
|
532
534
|
label_visibility : "visible", "hidden", or "collapsed"
|
533
535
|
The visibility of the label. The default is ``"visible"``. If this
|
534
536
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
535
|
-
label, which can help keep the widget
|
537
|
+
label, which can help keep the widget aligned with other widgets.
|
536
538
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
537
539
|
|
538
540
|
width : "stretch" or pixel width
|
@@ -607,10 +609,10 @@ class SliderMixin:
|
|
607
609
|
def _slider(
|
608
610
|
self,
|
609
611
|
label: str,
|
610
|
-
min_value=None,
|
611
|
-
max_value=None,
|
612
|
-
value=None,
|
613
|
-
step=None,
|
612
|
+
min_value: Any = None,
|
613
|
+
max_value: Any = None,
|
614
|
+
value: Any = None,
|
615
|
+
step: Any = None,
|
614
616
|
format: str | None = None,
|
615
617
|
key: Key | None = None,
|
616
618
|
help: str | None = None,
|
@@ -659,7 +661,7 @@ class SliderMixin:
|
|
659
661
|
if value is None:
|
660
662
|
# We need to know if this is a single or range slider, but don't have
|
661
663
|
# a default value, so we check if session_state can tell us.
|
662
|
-
# We already
|
664
|
+
# We already calculated the id, so there is no risk of this causing
|
663
665
|
# the id to change.
|
664
666
|
|
665
667
|
single_value = True
|
@@ -693,12 +695,11 @@ class SliderMixin:
|
|
693
695
|
def value_to_generic_type(v):
|
694
696
|
if isinstance(v, Integral):
|
695
697
|
return SUPPORTED_TYPES[Integral]
|
696
|
-
|
698
|
+
if isinstance(v, Real):
|
697
699
|
return SUPPORTED_TYPES[Real]
|
698
|
-
|
699
|
-
return SUPPORTED_TYPES[type(v)]
|
700
|
+
return SUPPORTED_TYPES[type(v)]
|
700
701
|
|
701
|
-
def all_same_type(items):
|
702
|
+
def all_same_type(items: Any) -> bool:
|
702
703
|
return len(set(map(value_to_generic_type, items))) < 2
|
703
704
|
|
704
705
|
if not all_same_type(value):
|
@@ -930,6 +931,7 @@ class SliderMixin:
|
|
930
931
|
for value in serialized_values:
|
931
932
|
# Use the deserialized values for more readable error messages for dates/times
|
932
933
|
deserialized_value = serde.deserialize_single_value(value)
|
934
|
+
|
933
935
|
if value < slider_proto.min:
|
934
936
|
raise StreamlitValueBelowMinError(
|
935
937
|
value=deserialized_value,
|
@@ -218,7 +218,7 @@ class TextWidgetsMixin:
|
|
218
218
|
label_visibility : "visible", "hidden", or "collapsed"
|
219
219
|
The visibility of the label. The default is ``"visible"``. If this
|
220
220
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
221
|
-
label, which can help keep the widget
|
221
|
+
label, which can help keep the widget aligned with other widgets.
|
222
222
|
|
223
223
|
icon : str, None
|
224
224
|
An optional emoji or icon to display within the input field to the
|
@@ -531,7 +531,7 @@ class TextWidgetsMixin:
|
|
531
531
|
label_visibility : "visible", "hidden", or "collapsed"
|
532
532
|
The visibility of the label. The default is ``"visible"``. If this
|
533
533
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
534
|
-
label, which can help keep the widget
|
534
|
+
label, which can help keep the widget aligned with other widgets.
|
535
535
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
536
536
|
|
537
537
|
width : WidthWithoutContent
|
@@ -430,7 +430,7 @@ class TimeWidgetsMixin:
|
|
430
430
|
label_visibility : "visible", "hidden", or "collapsed"
|
431
431
|
The visibility of the label. The default is ``"visible"``. If this
|
432
432
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
433
|
-
label, which can help keep the widget
|
433
|
+
label, which can help keep the widget aligned with other widgets.
|
434
434
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
435
435
|
|
436
436
|
step : int or timedelta
|
@@ -771,7 +771,7 @@ class TimeWidgetsMixin:
|
|
771
771
|
label_visibility : "visible", "hidden", or "collapsed"
|
772
772
|
The visibility of the label. The default is ``"visible"``. If this
|
773
773
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
774
|
-
label, which can help keep the widget
|
774
|
+
label, which can help keep the widget aligned with other widgets.
|
775
775
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
776
776
|
|
777
777
|
width : "stretch" or int
|
streamlit/elements/write.py
CHANGED
@@ -245,7 +245,7 @@ class WriteMixin:
|
|
245
245
|
if not written_content:
|
246
246
|
# If nothing was streamed, return an empty string.
|
247
247
|
return ""
|
248
|
-
|
248
|
+
if len(written_content) == 1 and isinstance(written_content[0], str):
|
249
249
|
# If the output only contains a single string, return it as a string
|
250
250
|
return written_content[0]
|
251
251
|
|
@@ -253,7 +253,7 @@ class WriteMixin:
|
|
253
253
|
return written_content
|
254
254
|
|
255
255
|
@gather_metrics("write")
|
256
|
-
def write(self, *args: Any, unsafe_allow_html: bool = False, **kwargs) -> None:
|
256
|
+
def write(self, *args: Any, unsafe_allow_html: bool = False, **kwargs: Any) -> None:
|
257
257
|
"""Displays arguments in the app.
|
258
258
|
|
259
259
|
This is the Swiss Army knife of Streamlit commands: it does different
|
@@ -528,10 +528,7 @@ class WriteMixin:
|
|
528
528
|
):
|
529
529
|
flush_buffer()
|
530
530
|
self.write_stream(arg)
|
531
|
-
elif isinstance(arg, HELP_TYPES):
|
532
|
-
flush_buffer()
|
533
|
-
self.dg.help(arg)
|
534
|
-
elif dataclasses.is_dataclass(arg):
|
531
|
+
elif isinstance(arg, HELP_TYPES) or dataclasses.is_dataclass(arg):
|
535
532
|
flush_buffer()
|
536
533
|
self.dg.help(arg)
|
537
534
|
elif inspect.isclass(arg):
|
streamlit/errors.py
CHANGED
@@ -15,10 +15,13 @@
|
|
15
15
|
from __future__ import annotations
|
16
16
|
|
17
17
|
import os
|
18
|
-
from typing import Any, Literal
|
18
|
+
from typing import TYPE_CHECKING, Any, Literal
|
19
19
|
|
20
20
|
from streamlit import util
|
21
21
|
|
22
|
+
if TYPE_CHECKING:
|
23
|
+
from datetime import date, time
|
24
|
+
|
22
25
|
|
23
26
|
class Error(Exception):
|
24
27
|
"""The base class for all exceptions thrown by Streamlit.
|
@@ -104,7 +107,7 @@ class StreamlitAuthError(StreamlitAPIException):
|
|
104
107
|
class StreamlitDuplicateElementId(DuplicateWidgetID):
|
105
108
|
"""An exception raised when the auto-generated ID of an element is not unique."""
|
106
109
|
|
107
|
-
def __init__(self, element_type: str):
|
110
|
+
def __init__(self, element_type: str) -> None:
|
108
111
|
super().__init__(
|
109
112
|
f"There are multiple `{element_type}` elements with the same "
|
110
113
|
"auto-generated ID. When this element is created, it is assigned an "
|
@@ -118,7 +121,7 @@ class StreamlitDuplicateElementId(DuplicateWidgetID):
|
|
118
121
|
class StreamlitDuplicateElementKey(DuplicateWidgetID):
|
119
122
|
"""An exception raised when the key of an element is not unique."""
|
120
123
|
|
121
|
-
def __init__(self, user_key: str):
|
124
|
+
def __init__(self, user_key: str) -> None:
|
122
125
|
super().__init__(
|
123
126
|
f"There are multiple elements with the same `key='{user_key}'`. "
|
124
127
|
"To fix this, please make sure that the `key` argument is unique for "
|
@@ -162,7 +165,7 @@ class StreamlitModuleNotFoundError(StreamlitAPIWarning):
|
|
162
165
|
|
163
166
|
|
164
167
|
class LocalizableStreamlitException(StreamlitAPIException):
|
165
|
-
def __init__(self, message: str, **kwargs):
|
168
|
+
def __init__(self, message: str, **kwargs: Any) -> None:
|
166
169
|
super().__init__((message).format(**kwargs))
|
167
170
|
self._exec_kwargs = kwargs
|
168
171
|
|
@@ -187,7 +190,7 @@ class StreamlitSetPageConfigMustBeFirstCommandError(LocalizableStreamlitExceptio
|
|
187
190
|
class StreamlitInvalidPageLayoutError(LocalizableStreamlitException):
|
188
191
|
"""Exception raised when an invalid value is specified for layout."""
|
189
192
|
|
190
|
-
def __init__(self, layout: str):
|
193
|
+
def __init__(self, layout: str) -> None:
|
191
194
|
super().__init__(
|
192
195
|
'`layout` must be `"centered"` or `"wide"` (got `"{layout}"`)',
|
193
196
|
layout=layout,
|
@@ -197,7 +200,7 @@ class StreamlitInvalidPageLayoutError(LocalizableStreamlitException):
|
|
197
200
|
class StreamlitInvalidSidebarStateError(LocalizableStreamlitException):
|
198
201
|
"""Exception raised when an invalid value is specified for `initial_sidebar_state`."""
|
199
202
|
|
200
|
-
def __init__(self, initial_sidebar_state: str):
|
203
|
+
def __init__(self, initial_sidebar_state: str) -> None:
|
201
204
|
super().__init__(
|
202
205
|
'`initial_sidebar_state` must be `"auto"` or `"expanded"` or '
|
203
206
|
'`"collapsed"` (got `"{initial_sidebar_state}"`)',
|
@@ -208,7 +211,7 @@ class StreamlitInvalidSidebarStateError(LocalizableStreamlitException):
|
|
208
211
|
class StreamlitInvalidMenuItemKeyError(LocalizableStreamlitException):
|
209
212
|
"""Exception raised when an invalid key is specified."""
|
210
213
|
|
211
|
-
def __init__(self, key: str):
|
214
|
+
def __init__(self, key: str) -> None:
|
212
215
|
super().__init__(
|
213
216
|
'We only accept the keys: `"Get help"`, `"Report a bug"`, and `"About"` (`"{key}"` is not a valid key.)',
|
214
217
|
key=key,
|
@@ -218,7 +221,7 @@ class StreamlitInvalidMenuItemKeyError(LocalizableStreamlitException):
|
|
218
221
|
class StreamlitInvalidURLError(LocalizableStreamlitException):
|
219
222
|
"""Exception raised when an invalid URL is specified for any of the menu items except for “About”."""
|
220
223
|
|
221
|
-
def __init__(self, url: str):
|
224
|
+
def __init__(self, url: str) -> None:
|
222
225
|
super().__init__(
|
223
226
|
'"{url}" is a not a valid URL. '
|
224
227
|
'You must use a fully qualified domain beginning with "http://", "https://", or "mailto:".',
|
@@ -242,7 +245,7 @@ class StreamlitInvalidColumnSpecError(LocalizableStreamlitException):
|
|
242
245
|
class StreamlitInvalidVerticalAlignmentError(LocalizableStreamlitException):
|
243
246
|
"""Exception raised when an invalid value is specified for vertical_alignment."""
|
244
247
|
|
245
|
-
def __init__(self, vertical_alignment: str):
|
248
|
+
def __init__(self, vertical_alignment: str) -> None:
|
246
249
|
super().__init__(
|
247
250
|
'The `vertical_alignment` argument to `st.columns` must be `"top"`, `"center"`, or `"bottom"`. \n'
|
248
251
|
"The argument passed was {vertical_alignment}.",
|
@@ -253,7 +256,7 @@ class StreamlitInvalidVerticalAlignmentError(LocalizableStreamlitException):
|
|
253
256
|
class StreamlitInvalidColumnGapError(LocalizableStreamlitException):
|
254
257
|
"""Exception raised when an invalid value is specified for gap."""
|
255
258
|
|
256
|
-
def __init__(self, gap: str):
|
259
|
+
def __init__(self, gap: str) -> None:
|
257
260
|
super().__init__(
|
258
261
|
'The `gap` argument to `st.columns` must be `"small"`, `"medium"`, or `"large"`. \n'
|
259
262
|
"The argument passed was {gap}.",
|
@@ -265,7 +268,9 @@ class StreamlitInvalidColumnGapError(LocalizableStreamlitException):
|
|
265
268
|
class StreamlitSelectionCountExceedsMaxError(LocalizableStreamlitException):
|
266
269
|
"""Exception raised when there are more default selections specified than the max allowable selections."""
|
267
270
|
|
268
|
-
def __init__(
|
271
|
+
def __init__(
|
272
|
+
self, current_selections_count: int, max_selections_count: int
|
273
|
+
) -> None:
|
269
274
|
super().__init__(
|
270
275
|
"Multiselect has {current_selections_count} {current_selections_noun} "
|
271
276
|
"selected but `max_selections` is set to {max_selections_count}. "
|
@@ -292,7 +297,7 @@ class StreamlitMixedNumericTypesError(LocalizableStreamlitException):
|
|
292
297
|
min_value: int | float | None,
|
293
298
|
max_value: int | float | None,
|
294
299
|
step: int | float | None,
|
295
|
-
):
|
300
|
+
) -> None:
|
296
301
|
value_type = None
|
297
302
|
min_value_type = None
|
298
303
|
max_value_type = None
|
@@ -328,7 +333,11 @@ class StreamlitMixedNumericTypesError(LocalizableStreamlitException):
|
|
328
333
|
class StreamlitValueBelowMinError(LocalizableStreamlitException):
|
329
334
|
"""Exception raised when the `min_value` is greater than the `value`."""
|
330
335
|
|
331
|
-
def __init__(
|
336
|
+
def __init__(
|
337
|
+
self,
|
338
|
+
value: int | float | date | time,
|
339
|
+
min_value: int | float | date | time,
|
340
|
+
) -> None:
|
332
341
|
super().__init__(
|
333
342
|
"The `value` {value} is less than the `min_value` {min_value}.",
|
334
343
|
value=value,
|
@@ -339,7 +348,11 @@ class StreamlitValueBelowMinError(LocalizableStreamlitException):
|
|
339
348
|
class StreamlitValueAboveMaxError(LocalizableStreamlitException):
|
340
349
|
"""Exception raised when the `max_value` is less than the `value`."""
|
341
350
|
|
342
|
-
def __init__(
|
351
|
+
def __init__(
|
352
|
+
self,
|
353
|
+
value: int | float | date | time,
|
354
|
+
max_value: int | float | date | time,
|
355
|
+
) -> None:
|
343
356
|
super().__init__(
|
344
357
|
"The `value` {value} is greater than the `max_value` {max_value}.",
|
345
358
|
value=value,
|
@@ -350,7 +363,7 @@ class StreamlitValueAboveMaxError(LocalizableStreamlitException):
|
|
350
363
|
class StreamlitJSNumberBoundsError(LocalizableStreamlitException):
|
351
364
|
"""Exception raised when a number exceeds the Javascript limits."""
|
352
365
|
|
353
|
-
def __init__(self, message: str):
|
366
|
+
def __init__(self, message: str) -> None:
|
354
367
|
super().__init__(message)
|
355
368
|
|
356
369
|
|
@@ -359,7 +372,7 @@ class StreamlitInvalidNumberFormatError(LocalizableStreamlitException):
|
|
359
372
|
invalid characters.
|
360
373
|
"""
|
361
374
|
|
362
|
-
def __init__(self, format: str):
|
375
|
+
def __init__(self, format: str) -> None:
|
363
376
|
super().__init__(
|
364
377
|
"Format string for `st.number_input` contains invalid characters: {format}",
|
365
378
|
format=format,
|
@@ -381,7 +394,7 @@ class StreamlitPageNotFoundError(LocalizableStreamlitException):
|
|
381
394
|
|
382
395
|
def __init__(
|
383
396
|
self, page: str, main_script_directory: str, uses_pages_directory: bool
|
384
|
-
):
|
397
|
+
) -> None:
|
385
398
|
directory = os.path.basename(main_script_directory)
|
386
399
|
|
387
400
|
message = (
|
@@ -428,7 +441,7 @@ class StreamlitInvalidFormCallbackError(LocalizableStreamlitException):
|
|
428
441
|
class StreamlitValueAssignmentNotAllowedError(LocalizableStreamlitException):
|
429
442
|
"""Exception raised when trying to set values where writes are not allowed."""
|
430
443
|
|
431
|
-
def __init__(self, key: str):
|
444
|
+
def __init__(self, key: str) -> None:
|
432
445
|
super().__init__(
|
433
446
|
"Values for the widget with `key` '{key}' cannot be set using `st.session_state`.",
|
434
447
|
key=key,
|
@@ -449,7 +462,7 @@ class StreamlitInvalidColorError(LocalizableStreamlitException):
|
|
449
462
|
class StreamlitBadTimeStringError(LocalizableStreamlitException):
|
450
463
|
"""Exception Raised when a time string argument is passed that cannot be parsed."""
|
451
464
|
|
452
|
-
def __init__(self, time_string: str):
|
465
|
+
def __init__(self, time_string: str) -> None:
|
453
466
|
super().__init__(
|
454
467
|
"Time string doesn't look right. It should be formatted as"
|
455
468
|
"`'1d2h34m'` or `2 days`, for example. Got: {time_string}",
|
@@ -460,14 +473,14 @@ class StreamlitBadTimeStringError(LocalizableStreamlitException):
|
|
460
473
|
class StreamlitSecretNotFoundError(LocalizableStreamlitException, FileNotFoundError):
|
461
474
|
"""Exception raised when a secret cannot be found or parsed in the secrets.toml file."""
|
462
475
|
|
463
|
-
def __init__(self, message: str):
|
476
|
+
def __init__(self, message: str) -> None:
|
464
477
|
super().__init__(message)
|
465
478
|
|
466
479
|
|
467
480
|
class StreamlitInvalidWidthError(LocalizableStreamlitException):
|
468
481
|
"""Exception raised when an invalid width value is provided."""
|
469
482
|
|
470
|
-
def __init__(self, width: Any, allow_content: bool = False):
|
483
|
+
def __init__(self, width: Any, allow_content: bool = False) -> None:
|
471
484
|
valid_values = "an integer (pixels) or 'stretch'"
|
472
485
|
if allow_content:
|
473
486
|
valid_values = "an integer (pixels), 'stretch', or 'content'"
|
@@ -155,7 +155,7 @@ class LLMThought:
|
|
155
155
|
labeler: LLMThoughtLabeler,
|
156
156
|
expanded: bool,
|
157
157
|
collapse_on_complete: bool,
|
158
|
-
):
|
158
|
+
) -> None:
|
159
159
|
self._container = parent_container.status(
|
160
160
|
labeler.get_initial_label(), expanded=expanded
|
161
161
|
)
|
@@ -283,7 +283,7 @@ class StreamlitCallbackHandler(BaseCallbackHandler):
|
|
283
283
|
expand_new_thoughts: bool = False,
|
284
284
|
collapse_completed_thoughts: bool = False,
|
285
285
|
thought_labeler: LLMThoughtLabeler | None = None,
|
286
|
-
):
|
286
|
+
) -> None:
|
287
287
|
"""Construct a new StreamlitCallbackHandler. This CallbackHandler is geared
|
288
288
|
towards use with a LangChain Agent; it displays the Agent's LLM and tool-usage
|
289
289
|
"thoughts" inside a series of Streamlit expanders.
|