prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  CachedStFunctionWarning with st.code
  ### Checklist
  
  - [X] I have searched the [existing issues](https://github.com/streamlit/streamlit/issues) for similar issues.
  - [X] I added a very descriptive title to this issue.
  - [X] I have provided sufficient information below to help reproduce this issue.
  
  ### Summary
  
  I am getting 'CachedStFunctionWarning' for st.code. Using `@st.cache_data(experimental_allow_widgets=True) ` as suggested in the warning does not help. 
  
  ![image](https://github.com/streamlit/streamlit/assets/122267325/ffe9ec4d-b07a-4310-8a21-6c51e751d757)
  
  ### Reproducible Code Example
  
  [![Open in Streamlit Cloud](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://issues.streamlit.app/?issue=gh-7055)
  
  ```Python
  @st.cache_data(experimental_allow_widgets=True, show_spinner=False)
  def foo(i):
      options = ["foo", "bar", "baz", "qux"]
      st.code(options)
      r = st.radio("radio", options, index=i)
      return r
  
  foo(1)
  ```
  
  
  ### Steps To Reproduce
  
  1. Use code provided above
  2. See warning message
  
  ### Expected Behavior
  
  Warning is not shown for st.code or using `@st.cache_data(experimental_allow_widgets=True) `  suppresses the warning.
  
  ### Current Behavior
  
  ![image](https://github.com/streamlit/streamlit/assets/122267325/de384f85-768b-49f2-ac4f-3a87a77de85c)
  
  
  ### Is this a regression?
  
  - [X] Yes, this used to work in a previous version.
  
  ### Debug info
  
  Streamlit version: 1.23.1
  Python version: 3.11.1
  
  
  ### Additional Information
  
  Further infos/community question [here](https://discuss.streamlit.io/t/st-cache-data-experimental-allow-widgets-true-is-not-working-with-st-code/47638)
  CachedStFunctionWarning with st.code
  ### Checklist
  
  - [X] I have searched the [existing issues](https://github.com/streamlit/streamlit/issues) for similar issues.
  - [X] I added a very descriptive title to this issue.
  - [X] I have provided sufficient information below to help reproduce this issue.
  
  ### Summary
  
  I am getting 'CachedStFunctionWarning' for st.code. Using `@st.cache_data(experimental_allow_widgets=True) ` as suggested in the warning does not help. 
  
  ![image](https://github.com/streamlit/streamlit/assets/122267325/ffe9ec4d-b07a-4310-8a21-6c51e751d757)
  
  ### Reproducible Code Example
  
  [![Open in Streamlit Cloud](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://issues.streamlit.app/?issue=gh-7055)
  
  ```Python
  @st.cache_data(experimental_allow_widgets=True, show_spinner=False)
  def foo(i):
      options = ["foo", "bar", "baz", "qux"]
      st.code(options)
      r = st.radio("radio", options, index=i)
      return r
  
  foo(1)
  ```
  
  
  ### Steps To Reproduce
  
  1. Use code provided above
  2. See warning message
  
  ### Expected Behavior
  
  Warning is not shown for st.code or using `@st.cache_data(experimental_allow_widgets=True) `  suppresses the warning.
  
  ### Current Behavior
  
  ![image](https://github.com/streamlit/streamlit/assets/122267325/de384f85-768b-49f2-ac4f-3a87a77de85c)
  
  
  ### Is this a regression?
  
  - [X] Yes, this used to work in a previous version.
  
  ### Debug info
  
  Streamlit version: 1.23.1
  Python version: 3.11.1
  
  
  ### Additional Information
  
  Further infos/community question [here](https://discuss.streamlit.io/t/st-cache-data-experimental-allow-widgets-true-is-not-working-with-st-code/47638)
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `lib/streamlit/elements/__init__.py`
  Content:
  ```
  1 # Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022)
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 WIDGETS = [
  16     "button",
  17     "camera_input",
  18     "chat_input",
  19     "checkbox",
  20     "color_picker",
  21     "component_instance",
  22     "download_button",
  23     "file_uploader",
  24     "form",
  25     "multiselect",
  26     "number_input",
  27     "radio",
  28     "selectbox",
  29     "select_slider",
  30     "slider",
  31     "text_input",
  32     "text_area",
  33     "time_input",
  34     "date_input",
  35 ]
  36 NONWIDGET_ELEMENTS = [
  37     "alert",
  38     "area_chart",
  39     "arrow_area_chart",
  40     "arrow_bar_chart",
  41     "arrow_data_frame",
  42     "arrow_line_chart",
  43     "arrow_table",
  44     "arrow_vega_lite_chart",
  45     "audio",
  46     "balloons",
  47     "bar_chart",
  48     "bokeh_chart",
  49     "data_frame",
  50     "dataframe_selector",
  51     "deck_gl_json_chart",
  52     "doc_string",
  53     "empty",
  54     "exception",
  55     "graphviz_chart",
  56     "heading",
  57     "iframe",
  58     "imgs",
  59     "json",
  60     "legacy_altair",
  61     "legacy_data_frame",
  62     "legacy_vega_lite",
  63     "line_chart",
  64     "markdown",
  65     "metric",
  66     "plotly_chart",
  67     "progress",
  68     "pyplot",
  69     "snow",
  70     "table",
  71     "text",
  72     "vega_lite_chart",
  73     "video",
  74     "write",
  75 ]
  76
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/lib/streamlit/elements/__init__.py b/lib/streamlit/elements/__init__.py
  --- a/lib/streamlit/elements/__init__.py
  +++ b/lib/streamlit/elements/__init__.py
  @@ -46,6 +46,7 @@
       "balloons",
       "bar_chart",
       "bokeh_chart",
  +    "code",
       "data_frame",
       "dataframe_selector",
       "deck_gl_json_chart",
  @@ -61,6 +62,9 @@
       "legacy_data_frame",
       "legacy_vega_lite",
       "line_chart",
  +    # link_button unlike button and download_button is not a widget. It only sends a
  +    # forward messages to the frontend, and not sends trigger value back.
  +    "link_button",
       "markdown",
       "metric",
       "plotly_chart",
  
verification_info: {"golden_diff": "diff --git a/lib/streamlit/elements/__init__.py b/lib/streamlit/elements/__init__.py\n--- a/lib/streamlit/elements/__init__.py\n+++ b/lib/streamlit/elements/__init__.py\n@@ -46,6 +46,7 @@\n     \"balloons\",\n     \"bar_chart\",\n     \"bokeh_chart\",\n+    \"code\",\n     \"data_frame\",\n     \"dataframe_selector\",\n     \"deck_gl_json_chart\",\n@@ -61,6 +62,9 @@\n     \"legacy_data_frame\",\n     \"legacy_vega_lite\",\n     \"line_chart\",\n+    # link_button unlike button and download_button is not a widget. It only sends a\n+    # forward messages to the frontend, and not sends trigger value back.\n+    \"link_button\",\n     \"markdown\",\n     \"metric\",\n     \"plotly_chart\",\n", "issue": "CachedStFunctionWarning with st.code\n### Checklist\r\n\r\n- [X] I have searched the [existing issues](https://github.com/streamlit/streamlit/issues) for similar issues.\r\n- [X] I added a very descriptive title to this issue.\r\n- [X] I have provided sufficient information below to help reproduce this issue.\r\n\r\n### Summary\r\n\r\nI am getting 'CachedStFunctionWarning' for st.code. Using `@st.cache_data(experimental_allow_widgets=True) ` as suggested in the warning does not help. \r\n\r\n![image](https://github.com/streamlit/streamlit/assets/122267325/ffe9ec4d-b07a-4310-8a21-6c51e751d757)\r\n\r\n### Reproducible Code Example\r\n\r\n[![Open in Streamlit Cloud](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://issues.streamlit.app/?issue=gh-7055)\r\n\r\n```Python\r\n@st.cache_data(experimental_allow_widgets=True, show_spinner=False)\r\ndef foo(i):\r\n    options = [\"foo\", \"bar\", \"baz\", \"qux\"]\r\n    st.code(options)\r\n    r = st.radio(\"radio\", options, index=i)\r\n    return r\r\n\r\nfoo(1)\r\n```\r\n\r\n\r\n### Steps To Reproduce\r\n\r\n1. Use code provided above\r\n2. See warning message\r\n\r\n### Expected Behavior\r\n\r\nWarning is not shown for st.code or using `@st.cache_data(experimental_allow_widgets=True) `  suppresses the warning.\r\n\r\n### Current Behavior\r\n\r\n![image](https://github.com/streamlit/streamlit/assets/122267325/de384f85-768b-49f2-ac4f-3a87a77de85c)\r\n\r\n\r\n### Is this a regression?\r\n\r\n- [X] Yes, this used to work in a previous version.\r\n\r\n### Debug info\r\n\r\nStreamlit version: 1.23.1\r\nPython version: 3.11.1\r\n\r\n\r\n### Additional Information\r\n\r\nFurther infos/community question [here](https://discuss.streamlit.io/t/st-cache-data-experimental-allow-widgets-true-is-not-working-with-st-code/47638)\nCachedStFunctionWarning with st.code\n### Checklist\r\n\r\n- [X] I have searched the [existing issues](https://github.com/streamlit/streamlit/issues) for similar issues.\r\n- [X] I added a very descriptive title to this issue.\r\n- [X] I have provided sufficient information below to help reproduce this issue.\r\n\r\n### Summary\r\n\r\nI am getting 'CachedStFunctionWarning' for st.code. Using `@st.cache_data(experimental_allow_widgets=True) ` as suggested in the warning does not help. \r\n\r\n![image](https://github.com/streamlit/streamlit/assets/122267325/ffe9ec4d-b07a-4310-8a21-6c51e751d757)\r\n\r\n### Reproducible Code Example\r\n\r\n[![Open in Streamlit Cloud](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://issues.streamlit.app/?issue=gh-7055)\r\n\r\n```Python\r\n@st.cache_data(experimental_allow_widgets=True, show_spinner=False)\r\ndef foo(i):\r\n    options = [\"foo\", \"bar\", \"baz\", \"qux\"]\r\n    st.code(options)\r\n    r = st.radio(\"radio\", options, index=i)\r\n    return r\r\n\r\nfoo(1)\r\n```\r\n\r\n\r\n### Steps To Reproduce\r\n\r\n1. Use code provided above\r\n2. See warning message\r\n\r\n### Expected Behavior\r\n\r\nWarning is not shown for st.code or using `@st.cache_data(experimental_allow_widgets=True) `  suppresses the warning.\r\n\r\n### Current Behavior\r\n\r\n![image](https://github.com/streamlit/streamlit/assets/122267325/de384f85-768b-49f2-ac4f-3a87a77de85c)\r\n\r\n\r\n### Is this a regression?\r\n\r\n- [X] Yes, this used to work in a previous version.\r\n\r\n### Debug info\r\n\r\nStreamlit version: 1.23.1\r\nPython version: 3.11.1\r\n\r\n\r\n### Additional Information\r\n\r\nFurther infos/community question [here](https://discuss.streamlit.io/t/st-cache-data-experimental-allow-widgets-true-is-not-working-with-st-code/47638)\n", "before_files": [{"content": "# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022)\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nWIDGETS = [\n    \"button\",\n    \"camera_input\",\n    \"chat_input\",\n    \"checkbox\",\n    \"color_picker\",\n    \"component_instance\",\n    \"download_button\",\n    \"file_uploader\",\n    \"form\",\n    \"multiselect\",\n    \"number_input\",\n    \"radio\",\n    \"selectbox\",\n    \"select_slider\",\n    \"slider\",\n    \"text_input\",\n    \"text_area\",\n    \"time_input\",\n    \"date_input\",\n]\nNONWIDGET_ELEMENTS = [\n    \"alert\",\n    \"area_chart\",\n    \"arrow_area_chart\",\n    \"arrow_bar_chart\",\n    \"arrow_data_frame\",\n    \"arrow_line_chart\",\n    \"arrow_table\",\n    \"arrow_vega_lite_chart\",\n    \"audio\",\n    \"balloons\",\n    \"bar_chart\",\n    \"bokeh_chart\",\n    \"data_frame\",\n    \"dataframe_selector\",\n    \"deck_gl_json_chart\",\n    \"doc_string\",\n    \"empty\",\n    \"exception\",\n    \"graphviz_chart\",\n    \"heading\",\n    \"iframe\",\n    \"imgs\",\n    \"json\",\n    \"legacy_altair\",\n    \"legacy_data_frame\",\n    \"legacy_vega_lite\",\n    \"line_chart\",\n    \"markdown\",\n    \"metric\",\n    \"plotly_chart\",\n    \"progress\",\n    \"pyplot\",\n    \"snow\",\n    \"table\",\n    \"text\",\n    \"vega_lite_chart\",\n    \"video\",\n    \"write\",\n]\n", "path": "lib/streamlit/elements/__init__.py"}], "after_files": [{"content": "# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022)\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nWIDGETS = [\n    \"button\",\n    \"camera_input\",\n    \"chat_input\",\n    \"checkbox\",\n    \"color_picker\",\n    \"component_instance\",\n    \"download_button\",\n    \"file_uploader\",\n    \"form\",\n    \"multiselect\",\n    \"number_input\",\n    \"radio\",\n    \"selectbox\",\n    \"select_slider\",\n    \"slider\",\n    \"text_input\",\n    \"text_area\",\n    \"time_input\",\n    \"date_input\",\n]\nNONWIDGET_ELEMENTS = [\n    \"alert\",\n    \"area_chart\",\n    \"arrow_area_chart\",\n    \"arrow_bar_chart\",\n    \"arrow_data_frame\",\n    \"arrow_line_chart\",\n    \"arrow_table\",\n    \"arrow_vega_lite_chart\",\n    \"audio\",\n    \"balloons\",\n    \"bar_chart\",\n    \"bokeh_chart\",\n    \"code\",\n    \"data_frame\",\n    \"dataframe_selector\",\n    \"deck_gl_json_chart\",\n    \"doc_string\",\n    \"empty\",\n    \"exception\",\n    \"graphviz_chart\",\n    \"heading\",\n    \"iframe\",\n    \"imgs\",\n    \"json\",\n    \"legacy_altair\",\n    \"legacy_data_frame\",\n    \"legacy_vega_lite\",\n    \"line_chart\",\n    # link_button unlike button and download_button is not a widget. It only sends a\n    # forward messages to the frontend, and not sends trigger value back.\n    \"link_button\",\n    \"markdown\",\n    \"metric\",\n    \"plotly_chart\",\n    \"progress\",\n    \"pyplot\",\n    \"snow\",\n    \"table\",\n    \"text\",\n    \"vega_lite_chart\",\n    \"video\",\n    \"write\",\n]\n", "path": "lib/streamlit/elements/__init__.py"}]}