streamlit-nightly 1.45.1.dev20250511__py3-none-any.whl → 1.45.2.dev20250512__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.
Files changed (122) hide show
  1. streamlit/commands/experimental_query_params.py +1 -1
  2. streamlit/commands/navigation.py +1 -4
  3. streamlit/config.py +9 -11
  4. streamlit/config_util.py +1 -1
  5. streamlit/connections/sql_connection.py +1 -1
  6. streamlit/dataframe_util.py +50 -51
  7. streamlit/elements/arrow.py +1 -1
  8. streamlit/elements/deck_gl_json_chart.py +1 -4
  9. streamlit/elements/doc_string.py +1 -4
  10. streamlit/elements/exception.py +5 -7
  11. streamlit/elements/layouts.py +4 -3
  12. streamlit/elements/lib/built_in_chart_utils.py +9 -14
  13. streamlit/elements/lib/pandas_styler_utils.py +6 -8
  14. streamlit/elements/map.py +2 -8
  15. streamlit/elements/markdown.py +1 -4
  16. streamlit/elements/media.py +50 -2
  17. streamlit/elements/metric.py +9 -10
  18. streamlit/elements/widgets/audio_input.py +1 -4
  19. streamlit/elements/widgets/camera_input.py +1 -4
  20. streamlit/elements/widgets/chat.py +52 -5
  21. streamlit/elements/widgets/data_editor.py +1 -1
  22. streamlit/elements/widgets/slider.py +3 -4
  23. streamlit/elements/widgets/time_widgets.py +1 -4
  24. streamlit/env_util.py +2 -7
  25. streamlit/errors.py +1 -1
  26. streamlit/logger.py +4 -5
  27. streamlit/proto/Audio_pb2.py +4 -3
  28. streamlit/proto/Audio_pb2.pyi +8 -1
  29. streamlit/proto/Block_pb2.py +5 -5
  30. streamlit/proto/Block_pb2.pyi +7 -1
  31. streamlit/proto/ChatInput_pb2.py +8 -7
  32. streamlit/proto/ChatInput_pb2.pyi +10 -1
  33. streamlit/proto/Video_pb2.py +8 -7
  34. streamlit/proto/Video_pb2.pyi +8 -1
  35. streamlit/runtime/app_session.py +1 -1
  36. streamlit/runtime/caching/hashing.py +8 -8
  37. streamlit/runtime/credentials.py +5 -4
  38. streamlit/runtime/memory_media_file_storage.py +5 -4
  39. streamlit/runtime/metrics_util.py +1 -1
  40. streamlit/runtime/scriptrunner/script_runner.py +1 -1
  41. streamlit/runtime/state/query_params.py +2 -4
  42. streamlit/runtime/state/session_state.py +15 -15
  43. streamlit/static/index.html +1 -1
  44. streamlit/static/static/js/{ErrorOutline.esm.B5LmzpSn.js → ErrorOutline.esm.Cfhrjz42.js} +1 -1
  45. streamlit/static/static/js/{FileDownload.esm.BgWveG3s.js → FileDownload.esm.BN5DkI-d.js} +1 -1
  46. streamlit/static/static/js/{FileHelper.DepIpP48.js → FileHelper.BWWhRdUs.js} +1 -1
  47. streamlit/static/static/js/{FormClearHelper.C_BjP_35.js → FormClearHelper.CHPGUkGG.js} +1 -1
  48. streamlit/static/static/js/{Hooks.BpH4YuRQ.js → Hooks.DjxyUmgD.js} +1 -1
  49. streamlit/static/static/js/{InputInstructions.CjdwGigq.js → InputInstructions.Bkai2tFZ.js} +1 -1
  50. streamlit/static/static/js/{ProgressBar.D1hXcW3N.js → ProgressBar.DFiqS51i.js} +1 -1
  51. streamlit/static/static/js/{RenderInPortalIfExists.A1T2s6z-.js → RenderInPortalIfExists.DWTzV71R.js} +1 -1
  52. streamlit/static/static/js/{Toolbar.y7vr7z0G.js → Toolbar.Dk2A3VxL.js} +1 -1
  53. streamlit/static/static/js/{base-input.BKhd-BLG.js → base-input.DfiT3r4p.js} +1 -1
  54. streamlit/static/static/js/{checkbox.DC-GFdrh.js → checkbox.DLXFjls2.js} +1 -1
  55. streamlit/static/static/js/{createSuper.D5WUtJEy.js → createSuper.n2DV0o-4.js} +1 -1
  56. streamlit/static/static/js/{data-grid-overlay-editor.BPJ38mWp.js → data-grid-overlay-editor.v1LF25Ml.js} +1 -1
  57. streamlit/static/static/js/{downloader.C6a4LRBw.js → downloader.CI8EFE9Y.js} +1 -1
  58. streamlit/static/static/js/{es6.DgMlYq8q.js → es6.CH6Tf3Uw.js} +2 -2
  59. streamlit/static/static/js/{iframeResizer.contentWindow.BpQxex73.js → iframeResizer.contentWindow.VCjyiSg6.js} +1 -1
  60. streamlit/static/static/js/{index.C2GjbQtf.js → index.7XN_jSTW.js} +1 -1
  61. streamlit/static/static/js/{index.D5PANKHd.js → index.9p279joF.js} +1 -1
  62. streamlit/static/static/js/{index.BydIp_VR.js → index.B-Q1qQil.js} +1 -1
  63. streamlit/static/static/js/{index.B8ca7fYO.js → index.B1j5m20t.js} +1 -1
  64. streamlit/static/static/js/{index.CiO2JPl_.js → index.BEE4v1Vc.js} +1 -1
  65. streamlit/static/static/js/{index.CkBnHCIQ.js → index.BFEA8ufN.js} +1 -1
  66. streamlit/static/static/js/{index.BLpDfH1w.js → index.BROoC18J.js} +1 -1
  67. streamlit/static/static/js/{index.49Q6A5_9.js → index.BWVpiUBA.js} +1 -1
  68. streamlit/static/static/js/{index.BRN41-Jy.js → index.BgY_Js0s.js} +1 -1
  69. streamlit/static/static/js/{index.D3tgBU6x.js → index.C1P3O0oI.js} +1 -1
  70. streamlit/static/static/js/index.C1TEsRV0.js +779 -0
  71. streamlit/static/static/js/{index.DPiBGVm8.js → index.C9ORVZvA.js} +1 -1
  72. streamlit/static/static/js/{index.CcvbHTJu.js → index.CR4eM0Q3.js} +1 -1
  73. streamlit/static/static/js/{index.DAO4Lj-D.js → index.CXpQxU0G.js} +1 -1
  74. streamlit/static/static/js/{index.BhGEwO_d.js → index.Cdsxte9t.js} +1 -1
  75. streamlit/static/static/js/{index.20fI9wQF.js → index.CmsMgepL.js} +1 -1
  76. streamlit/static/static/js/{index.Cqla7uBZ.js → index.D1An7GDs.js} +1 -1
  77. streamlit/static/static/js/{index.ryD8hMpi.js → index.D1DxKfIm.js} +1 -1
  78. streamlit/static/static/js/{index.DB42JCH0.js → index.DKsDSPTo.js} +1 -1
  79. streamlit/static/static/js/{index._oOkpIXS.js → index.DMDjQhhk.js} +1 -1
  80. streamlit/static/static/js/{index.4Gtr9egA.js → index.DM_jnlWC.js} +1 -1
  81. streamlit/static/static/js/{index.xIQLhQKv.js → index.DUU38l7N.js} +1 -1
  82. streamlit/static/static/js/{index.BbhQIRth.js → index.DXDmqevk.js} +1 -1
  83. streamlit/static/static/js/{index.Bo-z1JM2.js → index.D_Bv6KD1.js} +1 -1
  84. streamlit/static/static/js/{index.Cfi3u2-T.js → index.DcH46Eo2.js} +1 -1
  85. streamlit/static/static/js/{index.CHnID3dI.js → index.DgeyRl4J.js} +1 -1
  86. streamlit/static/static/js/{index.5k30-U6O.js → index.DoM9A12Z.js} +1 -1
  87. streamlit/static/static/js/{index.DT0CWGt3.js → index.LqvX_Kr6.js} +1 -1
  88. streamlit/static/static/js/{index.br6zwNIk.js → index.Ovig-AMR.js} +62 -62
  89. streamlit/static/static/js/{index.CY8tg9lY.js → index.SPkHHODG.js} +1 -1
  90. streamlit/static/static/js/{index.sKXwUANU.js → index.STF1QdPr.js} +1 -1
  91. streamlit/static/static/js/{index.DSPS70gp.js → index.ZuW7Olhm.js} +1 -1
  92. streamlit/static/static/js/{index.VPO2zcSN.js → index.hFB9saa3.js} +1 -1
  93. streamlit/static/static/js/{index.Du1Pbz0y.js → index.jZkr87Ly.js} +1 -1
  94. streamlit/static/static/js/{index.BcbB70bz.js → index.nmbrjghZ.js} +1 -1
  95. streamlit/static/static/js/{index.Bj81ZRkx.js → index.uN3TP5oq.js} +1 -1
  96. streamlit/static/static/js/{index.B3UoUwtN.js → index.uhNJX5pn.js} +1 -1
  97. streamlit/static/static/js/{input.CNjMviuo.js → input.BAfiLByr.js} +1 -1
  98. streamlit/static/static/js/{memory.f8X97LPt.js → memory.CvD1KGKJ.js} +1 -1
  99. streamlit/static/static/js/{mergeWith.DU9BO8BA.js → mergeWith.Dy4BuY-h.js} +1 -1
  100. streamlit/static/static/js/{number-overlay-editor.xJPBNdGQ.js → number-overlay-editor.Bl84FLfp.js} +1 -1
  101. streamlit/static/static/js/{possibleConstructorReturn.BjPX9m9m.js → possibleConstructorReturn.gffiKeDQ.js} +1 -1
  102. streamlit/static/static/js/{sandbox.B23JuuVd.js → sandbox.BXw8ya9t.js} +1 -1
  103. streamlit/static/static/js/{textarea.DodnI6GX.js → textarea.DNNNKi6n.js} +1 -1
  104. streamlit/static/static/js/{timepicker.ClHKNfP9.js → timepicker.CgHlrhoy.js} +1 -1
  105. streamlit/static/static/js/{toConsumableArray.CK6YGgcW.js → toConsumableArray.MtZ-3vir.js} +1 -1
  106. streamlit/static/static/js/{uniqueId.BAAVLIKj.js → uniqueId.CFcd6g0d.js} +1 -1
  107. streamlit/static/static/js/{useBasicWidgetState.B1oropKY.js → useBasicWidgetState.DadZUraL.js} +1 -1
  108. streamlit/static/static/js/{useOnInputChange.CHQJz2sf.js → useOnInputChange.V6d5TCFH.js} +1 -1
  109. streamlit/static/static/js/{withFullScreenWrapper.DZ1W8JUx.js → withFullScreenWrapper.8qpius26.js} +1 -1
  110. streamlit/string_util.py +1 -4
  111. streamlit/testing/v1/element_tree.py +5 -4
  112. streamlit/testing/v1/local_script_runner.py +1 -4
  113. streamlit/type_util.py +2 -5
  114. streamlit/watcher/path_watcher.py +2 -5
  115. streamlit/watcher/polling_path_watcher.py +7 -6
  116. {streamlit_nightly-1.45.1.dev20250511.dist-info → streamlit_nightly-1.45.2.dev20250512.dist-info}/METADATA +1 -1
  117. {streamlit_nightly-1.45.1.dev20250511.dist-info → streamlit_nightly-1.45.2.dev20250512.dist-info}/RECORD +121 -121
  118. streamlit/static/static/js/index.BgEbLy94.js +0 -779
  119. {streamlit_nightly-1.45.1.dev20250511.data → streamlit_nightly-1.45.2.dev20250512.data}/scripts/streamlit.cmd +0 -0
  120. {streamlit_nightly-1.45.1.dev20250511.dist-info → streamlit_nightly-1.45.2.dev20250512.dist-info}/WHEEL +0 -0
  121. {streamlit_nightly-1.45.1.dev20250511.dist-info → streamlit_nightly-1.45.2.dev20250512.dist-info}/entry_points.txt +0 -0
  122. {streamlit_nightly-1.45.1.dev20250511.dist-info → streamlit_nightly-1.45.2.dev20250512.dist-info}/top_level.txt +0 -0
@@ -23,6 +23,7 @@ import google.protobuf.descriptor
23
23
  import google.protobuf.internal.containers
24
24
  import google.protobuf.internal.enum_type_wrapper
25
25
  import google.protobuf.message
26
+ import streamlit.proto.WidthConfig_pb2
26
27
  import sys
27
28
  import typing
28
29
 
@@ -76,6 +77,7 @@ class ChatInput(google.protobuf.message.Message):
76
77
  ACCEPT_FILE_FIELD_NUMBER: builtins.int
77
78
  FILE_TYPE_FIELD_NUMBER: builtins.int
78
79
  MAX_UPLOAD_SIZE_MB_FIELD_NUMBER: builtins.int
80
+ WIDTH_CONFIG_FIELD_NUMBER: builtins.int
79
81
  id: builtins.str
80
82
  placeholder: builtins.str
81
83
  max_chars: builtins.int
@@ -91,6 +93,10 @@ class ChatInput(google.protobuf.message.Message):
91
93
  def file_type(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
92
94
  """Supported file types: For example: ["png","jpg","img"]"""
93
95
 
96
+ @property
97
+ def width_config(self) -> streamlit.proto.WidthConfig_pb2.WidthConfig:
98
+ """Optional width configuration for the ChatInput"""
99
+
94
100
  def __init__(
95
101
  self,
96
102
  *,
@@ -105,7 +111,10 @@ class ChatInput(google.protobuf.message.Message):
105
111
  accept_file: global___ChatInput.AcceptFile.ValueType = ...,
106
112
  file_type: collections.abc.Iterable[builtins.str] | None = ...,
107
113
  max_upload_size_mb: builtins.int = ...,
114
+ width_config: streamlit.proto.WidthConfig_pb2.WidthConfig | None = ...,
108
115
  ) -> None: ...
109
- def ClearField(self, field_name: typing.Literal["accept_file", b"accept_file", "default", b"default", "disabled", b"disabled", "file_type", b"file_type", "id", b"id", "max_chars", b"max_chars", "max_upload_size_mb", b"max_upload_size_mb", "placeholder", b"placeholder", "position", b"position", "set_value", b"set_value", "value", b"value"]) -> None: ...
116
+ def HasField(self, field_name: typing.Literal["_width_config", b"_width_config", "width_config", b"width_config"]) -> builtins.bool: ...
117
+ def ClearField(self, field_name: typing.Literal["_width_config", b"_width_config", "accept_file", b"accept_file", "default", b"default", "disabled", b"disabled", "file_type", b"file_type", "id", b"id", "max_chars", b"max_chars", "max_upload_size_mb", b"max_upload_size_mb", "placeholder", b"placeholder", "position", b"position", "set_value", b"set_value", "value", b"value", "width_config", b"width_config"]) -> None: ...
118
+ def WhichOneof(self, oneof_group: typing.Literal["_width_config", b"_width_config"]) -> typing.Literal["width_config"] | None: ...
110
119
 
111
120
  global___ChatInput = ChatInput
@@ -12,9 +12,10 @@ from google.protobuf.internal import builder as _builder
12
12
  _sym_db = _symbol_database.Default()
13
13
 
14
14
 
15
+ from streamlit.proto import WidthConfig_pb2 as streamlit_dot_proto_dot_WidthConfig__pb2
15
16
 
16
17
 
17
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bstreamlit/proto/Video.proto\"+\n\rSubtitleTrack\x12\r\n\x05label\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t\"\x87\x02\n\x05Video\x12\x0b\n\x03url\x18\x06 \x01(\t\x12\x12\n\nstart_time\x18\x03 \x01(\x05\x12\x19\n\x04type\x18\x05 \x01(\x0e\x32\x0b.Video.Type\x12!\n\tsubtitles\x18\x07 \x03(\x0b\x32\x0e.SubtitleTrack\x12\x10\n\x08\x65nd_time\x18\x08 \x01(\x05\x12\x0c\n\x04loop\x18\t \x01(\x08\x12\x10\n\x08\x61utoplay\x18\n \x01(\x08\x12\r\n\x05muted\x18\x0b \x01(\x08\x12\n\n\x02id\x18\x0c \x01(\t\"2\n\x04Type\x12\n\n\x06UNUSED\x10\x00\x12\n\n\x06NATIVE\x10\x01\x12\x12\n\x0eYOUTUBE_IFRAME\x10\x02J\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03J\x04\x08\x04\x10\x05R\x06\x66ormatR\x04\x64\x61taB*\n\x1c\x63om.snowflake.apps.streamlitB\nVideoProtob\x06proto3')
18
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bstreamlit/proto/Video.proto\x1a!streamlit/proto/WidthConfig.proto\"+\n\rSubtitleTrack\x12\r\n\x05label\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t\"\xcb\x02\n\x05Video\x12\x0b\n\x03url\x18\x06 \x01(\t\x12\x12\n\nstart_time\x18\x03 \x01(\x05\x12\x19\n\x04type\x18\x05 \x01(\x0e\x32\x0b.Video.Type\x12!\n\tsubtitles\x18\x07 \x03(\x0b\x32\x0e.SubtitleTrack\x12\x10\n\x08\x65nd_time\x18\x08 \x01(\x05\x12\x0c\n\x04loop\x18\t \x01(\x08\x12\x10\n\x08\x61utoplay\x18\n \x01(\x08\x12\r\n\x05muted\x18\x0b \x01(\x08\x12\n\n\x02id\x18\x0c \x01(\t\x12\x31\n\x0cwidth_config\x18\r \x01(\x0b\x32\x16.streamlit.WidthConfigH\x00\x88\x01\x01\"2\n\x04Type\x12\n\n\x06UNUSED\x10\x00\x12\n\n\x06NATIVE\x10\x01\x12\x12\n\x0eYOUTUBE_IFRAME\x10\x02\x42\x0f\n\r_width_configJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03J\x04\x08\x04\x10\x05R\x06\x66ormatR\x04\x64\x61taB*\n\x1c\x63om.snowflake.apps.streamlitB\nVideoProtob\x06proto3')
18
19
 
19
20
  _globals = globals()
20
21
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -22,10 +23,10 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'streamlit.proto.Video_pb2',
22
23
  if not _descriptor._USE_C_DESCRIPTORS:
23
24
  _globals['DESCRIPTOR']._loaded_options = None
24
25
  _globals['DESCRIPTOR']._serialized_options = b'\n\034com.snowflake.apps.streamlitB\nVideoProto'
25
- _globals['_SUBTITLETRACK']._serialized_start=31
26
- _globals['_SUBTITLETRACK']._serialized_end=74
27
- _globals['_VIDEO']._serialized_start=77
28
- _globals['_VIDEO']._serialized_end=340
29
- _globals['_VIDEO_TYPE']._serialized_start=258
30
- _globals['_VIDEO_TYPE']._serialized_end=308
26
+ _globals['_SUBTITLETRACK']._serialized_start=66
27
+ _globals['_SUBTITLETRACK']._serialized_end=109
28
+ _globals['_VIDEO']._serialized_start=112
29
+ _globals['_VIDEO']._serialized_end=443
30
+ _globals['_VIDEO_TYPE']._serialized_start=344
31
+ _globals['_VIDEO_TYPE']._serialized_end=394
31
32
  # @@protoc_insertion_point(module_scope)
@@ -23,6 +23,7 @@ import google.protobuf.descriptor
23
23
  import google.protobuf.internal.containers
24
24
  import google.protobuf.internal.enum_type_wrapper
25
25
  import google.protobuf.message
26
+ import streamlit.proto.WidthConfig_pb2
26
27
  import sys
27
28
  import typing
28
29
 
@@ -82,6 +83,7 @@ class Video(google.protobuf.message.Message):
82
83
  AUTOPLAY_FIELD_NUMBER: builtins.int
83
84
  MUTED_FIELD_NUMBER: builtins.int
84
85
  ID_FIELD_NUMBER: builtins.int
86
+ WIDTH_CONFIG_FIELD_NUMBER: builtins.int
85
87
  url: builtins.str
86
88
  """A url pointing to a video file"""
87
89
  start_time: builtins.int
@@ -99,6 +101,8 @@ class Video(google.protobuf.message.Message):
99
101
  def subtitles(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___SubtitleTrack]:
100
102
  """Repeated field for subtitle tracks"""
101
103
 
104
+ @property
105
+ def width_config(self) -> streamlit.proto.WidthConfig_pb2.WidthConfig: ...
102
106
  def __init__(
103
107
  self,
104
108
  *,
@@ -111,7 +115,10 @@ class Video(google.protobuf.message.Message):
111
115
  autoplay: builtins.bool = ...,
112
116
  muted: builtins.bool = ...,
113
117
  id: builtins.str = ...,
118
+ width_config: streamlit.proto.WidthConfig_pb2.WidthConfig | None = ...,
114
119
  ) -> None: ...
115
- def ClearField(self, field_name: typing.Literal["autoplay", b"autoplay", "end_time", b"end_time", "id", b"id", "loop", b"loop", "muted", b"muted", "start_time", b"start_time", "subtitles", b"subtitles", "type", b"type", "url", b"url"]) -> None: ...
120
+ def HasField(self, field_name: typing.Literal["_width_config", b"_width_config", "width_config", b"width_config"]) -> builtins.bool: ...
121
+ def ClearField(self, field_name: typing.Literal["_width_config", b"_width_config", "autoplay", b"autoplay", "end_time", b"end_time", "id", b"id", "loop", b"loop", "muted", b"muted", "start_time", b"start_time", "subtitles", b"subtitles", "type", b"type", "url", b"url", "width_config", b"width_config"]) -> None: ...
122
+ def WhichOneof(self, oneof_group: typing.Literal["_width_config", b"_width_config"]) -> typing.Literal["width_config"] | None: ...
116
123
 
117
124
  global___Video = Video
@@ -905,7 +905,7 @@ def _get_toolbar_mode() -> Config.ToolbarMode.ValueType:
905
905
  Config.ToolbarMode, config_value.upper()
906
906
  )
907
907
  if enum_value is None:
908
- allowed_values = ", ".join(k.lower() for k in Config.ToolbarMode.keys())
908
+ allowed_values = ", ".join(k.lower() for k in Config.ToolbarMode.keys()) # noqa: SIM118
909
909
  raise ValueError(
910
910
  f"Config {config_key!r} expects to have one of "
911
911
  f"the following values: {allowed_values}. "
@@ -136,10 +136,11 @@ If you think this is actually a Streamlit bug, please
136
136
  elif self.cache_type is CacheType.DATA:
137
137
  decorator_name = "@st.cache_data"
138
138
 
139
- if hasattr(self.hash_func, "__name__"):
140
- hash_func_name = f"`{self.hash_func.__name__}()`"
141
- else:
142
- hash_func_name = "a function"
139
+ hash_func_name = (
140
+ f"`{self.hash_func.__name__}()`"
141
+ if hasattr(self.hash_func, "__name__")
142
+ else "a function"
143
+ )
143
144
 
144
145
  return {
145
146
  "orig_exception_desc": str(orig_exc),
@@ -313,9 +314,8 @@ class _CacheFuncHasher:
313
314
  key = (tname, _key(obj))
314
315
 
315
316
  # Memoize if possible.
316
- if key[1] is not NoResult:
317
- if key in self._hashes:
318
- return self._hashes[key]
317
+ if key[1] is not NoResult and key in self._hashes:
318
+ return self._hashes[key]
319
319
 
320
320
  # Break recursive cycles.
321
321
  if obj in hash_stacks.current:
@@ -362,7 +362,7 @@ class _CacheFuncHasher:
362
362
  # deep, so we don't try to hash them at all.
363
363
  return self.to_bytes(id(obj))
364
364
 
365
- if isinstance(obj, bytes) or isinstance(obj, bytearray):
365
+ if isinstance(obj, (bytes, bytearray)):
366
366
  return obj
367
367
 
368
368
  if type_util.get_fqn_type(obj) in self._hash_funcs:
@@ -29,10 +29,11 @@ from streamlit.logger import get_logger
29
29
  _LOGGER: Final = get_logger(__name__)
30
30
 
31
31
 
32
- if env_util.IS_WINDOWS:
33
- _CONFIG_FILE_PATH = r"%userprofile%/.streamlit/config.toml"
34
- else:
35
- _CONFIG_FILE_PATH = "~/.streamlit/config.toml"
32
+ _CONFIG_FILE_PATH = (
33
+ r"%userprofile%/.streamlit/config.toml"
34
+ if env_util.IS_WINDOWS
35
+ else "~/.streamlit/config.toml"
36
+ )
36
37
 
37
38
 
38
39
  class _Activation(NamedTuple):
@@ -110,10 +110,11 @@ class MemoryMediaFileStorage(MediaFileStorage, CacheStatsProvider):
110
110
  ) -> str:
111
111
  """Add a file to the manager and return its ID."""
112
112
  file_data: bytes
113
- if isinstance(path_or_data, str):
114
- file_data = self._read_file(path_or_data)
115
- else:
116
- file_data = path_or_data
113
+ file_data = (
114
+ self._read_file(path_or_data)
115
+ if isinstance(path_or_data, str)
116
+ else path_or_data
117
+ )
117
118
 
118
119
  # Because our file_ids are stable, if we already have a file with the
119
120
  # given ID, we don't need to create a new one.
@@ -487,7 +487,7 @@ def create_page_profile_message(
487
487
  # Collect all config options that have been manually set
488
488
  config_options: set[str] = set()
489
489
  if config._config_options:
490
- for option_name in config._config_options.keys():
490
+ for option_name in config._config_options:
491
491
  if not config.is_manually_set(option_name):
492
492
  # We only care about manually defined options
493
493
  continue
@@ -139,7 +139,7 @@ def _mpa_v1(main_script_path: str) -> None:
139
139
  for page in pages
140
140
  if page.name.endswith(".py")
141
141
  and not page.name.startswith(".")
142
- and not page.name == "__init__.py"
142
+ and page.name != "__init__.py"
143
143
  ],
144
144
  key=page_sort_key,
145
145
  )
@@ -47,9 +47,7 @@ class QueryParams(MutableMapping[str, str]):
47
47
  self._ensure_single_query_api_used()
48
48
 
49
49
  return iter(
50
- key
51
- for key in self._query_params.keys()
52
- if key not in EMBED_QUERY_PARAMS_KEYS
50
+ key for key in self._query_params if key not in EMBED_QUERY_PARAMS_KEYS
53
51
  )
54
52
 
55
53
  def __getitem__(self, key: str) -> str:
@@ -116,7 +114,7 @@ class QueryParams(MutableMapping[str, str]):
116
114
  # to ensure only one one ForwardMsg is sent.
117
115
  self._ensure_single_query_api_used()
118
116
  if hasattr(other, "keys") and hasattr(other, "__getitem__"):
119
- for key in other.keys():
117
+ for key in other.keys(): # noqa: SIM118
120
118
  self.__set_item_internal(key, other[key])
121
119
  else:
122
120
  for key, value in other:
@@ -249,7 +249,7 @@ class WStates(MutableMapping[str, Any]):
249
249
  """Return a list of serialized widget values for each widget with a value."""
250
250
  states = [
251
251
  self.get_serialized(widget_id)
252
- for widget_id in self.states.keys()
252
+ for widget_id in self.states
253
253
  if self.get_serialized(widget_id)
254
254
  ]
255
255
  states = cast("list[WidgetStateProto]", states)
@@ -429,10 +429,10 @@ class SessionState:
429
429
  for widgets that don't have user_keys defined, and which aren't
430
430
  exposed to user code).
431
431
  """
432
- old_keys = {self._get_widget_id(k) for k in self._old_state.keys()}
432
+ old_keys = {self._get_widget_id(k) for k in self._old_state}
433
433
  new_widget_keys = set(self._new_widget_state.keys())
434
434
  new_session_state_keys = {
435
- self._get_widget_id(k) for k in self._new_session_state.keys()
435
+ self._get_widget_id(k) for k in self._new_session_state
436
436
  }
437
437
  return old_keys | new_widget_keys | new_session_state_keys
438
438
 
@@ -729,19 +729,19 @@ class SessionState:
729
729
  We use pickleability as the metric for serializability, and test for
730
730
  pickleability by just trying it.
731
731
  """
732
- try:
733
- for k in self:
732
+ for k in self:
733
+ try:
734
734
  pickle.dumps(self[k])
735
- except Exception as e:
736
- err_msg = (
737
- f"Cannot serialize the value (of type `{type(self[k])}`) of '{k}' in "
738
- "st.session_state. Streamlit has been configured to use "
739
- "[pickle](https://docs.python.org/3/library/pickle.html) to "
740
- "serialize session_state values. Please convert the value to a "
741
- "pickle-serializable type. To learn more about this behavior, "
742
- "see [our docs](https://docs.streamlit.io/knowledge-base/using-streamlit/serializable-session-state)."
743
- )
744
- raise UnserializableSessionStateError(err_msg) from e
735
+ except Exception as e: # noqa: PERF203
736
+ err_msg = (
737
+ f"Cannot serialize the value (of type `{type(self[k])}`) of '{k}' in "
738
+ "st.session_state. Streamlit has been configured to use "
739
+ "[pickle](https://docs.python.org/3/library/pickle.html) to "
740
+ "serialize session_state values. Please convert the value to a "
741
+ "pickle-serializable type. To learn more about this behavior, "
742
+ "see [our docs](https://docs.streamlit.io/knowledge-base/using-streamlit/serializable-session-state)."
743
+ )
744
+ raise UnserializableSessionStateError(err_msg) from e
745
745
 
746
746
  def maybe_check_serializable(self) -> None:
747
747
  """Verify that session state can be serialized, if the relevant config
@@ -51,7 +51,7 @@
51
51
  <script>
52
52
  window.prerenderReady = false
53
53
  </script>
54
- <script type="module" crossorigin src="./static/js/index.BgEbLy94.js"></script>
54
+ <script type="module" crossorigin src="./static/js/index.C1TEsRV0.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.BgEbLy94.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
+ import{r,E as a,_ as n}from"./index.C1TEsRV0.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.BgEbLy94.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};
1
+ import{r as e,E as n,_ as a}from"./index.C1TEsRV0.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};