class_docstr: A utility for storing messages generated by `st` commands called inside
  a cached function.
  
  Data is stored in a thread-local object, so it's safe to use an instance
  of this class across multiple threads.
class_docstr_tok: ["A","utility","for","storing","messages","generated","by","`","st","`","commands","called","inside","a","cached","function",".","Data","is","stored","in","a","thread-local","object",",","so","it","'s","safe","to","use","an","instance","of","this","class","across","multiple","threads","."]
docstr: If appropriate, warn about calling st.foo inside @memo.
  
  DeltaGenerator's @_with_element and @_widget wrappers use this to warn
  the user when they're calling st.foo() from within a function that is
  wrapped in @st.cache.
  
  Parameters
  ----------
  dg : DeltaGenerator
      The DeltaGenerator to publish the warning to.
  
  st_func_name : str
      The name of the Streamlit function that was called.
code: def maybe_show_cached_st_function_warning(
      self,
      dg: "DeltaGenerator",
      st_func_name: str,
  ) -> None:
      """If appropriate, warn about calling st.foo inside @memo.
  
      DeltaGenerator's @_with_element and @_widget wrappers use this to warn
      the user when they're calling st.foo() from within a function that is
      wrapped in @st.cache.
  
      Parameters
      ----------
      dg : DeltaGenerator
          The DeltaGenerator to publish the warning to.
  
      st_func_name : str
          The name of the Streamlit function that was called.
  
      """
      # There are some elements not in either list, which we still want to warn about.
      # Ideally we will fix this by either updating the lists or creating a better
      # way of categorizing elements.
      if st_func_name in NONWIDGET_ELEMENTS:
          return
      if st_func_name in WIDGETS and self._allow_widgets > 0:
          return
  
      if (
          len(self._cached_func_stack) > 0
          and self._suppress_st_function_warning <= 0
      ):
          cached_func = self._cached_func_stack[-1]
          self._show_cached_st_function_warning(
              dg, st_func_name, cached_func
          )
  
imports: from __future__ import annotations
  import contextlib
  import hashlib
  import threading
  import types
  from dataclasses import dataclass
  from typing import TYPE_CHECKING, Any, Iterator, Union
  from google.protobuf.message import Message
  from typing_extensions import Protocol, runtime_checkable
  import streamlit
  from streamlit import runtime, util
  from streamlit.elements import NONWIDGET_ELEMENTS, WIDGETS
  from streamlit.logger import get_logger
  from streamlit.proto.Block_pb2 import Block
  from streamlit.runtime.caching.cache_errors import CachedStFunctionWarning, CacheReplayClosureError
  from streamlit.runtime.caching.cache_type import CacheType
  from streamlit.runtime.caching.hashing import update_hash
  from streamlit.runtime.scriptrunner.script_run_context import ScriptRunContext, get_script_run_ctx
  from streamlit.runtime.state.common import WidgetMetadata
  from streamlit.util import HASHLIB_KWARGS
label_desc: Use image node_id 10 for calling the CachedMessageReplayContext obj's underlying member method code with example usage: obj.maybe_show_cached_st_function_warning(dg, st_func_name) without return types