class_docstr: Provides threadsafe utilities to modify warning behavior for MLflow autologging, including:
  
  - Global disablement of MLflow warnings across all threads
  - Global rerouting of MLflow warnings to an MLflow event logger (i.e. `logger.warning()`)
    across all threads
  - Disablement of non-MLflow warnings for the current thread
  - Rerouting of non-MLflow warnings to an MLflow event logger for the current thread
docstr: A patched implementation of `warnings.showwarning` that enforces the warning configuration
  options configured on the controller (e.g. rerouting or disablement of MLflow warnings,
  disablement of all warnings for the current thread).
  
  Note that reassigning `warnings.showwarning` is the standard / recommended approach for
  modifying warning message display behaviors. For reference, see
  https://docs.python.org/3/library/warnings.html#warnings.showwarning
docstr_tok: ["A","patched","implementation","of","`","warnings.showwarning","`","that","enforces","the","warning","configuration","options","configured","on","the","controller","(","e.g",".","rerouting","or","disablement","of","MLflow","warnings",",","disablement","of","all","warnings","for","the","current","thread",")",".","Note","that","reassigning","`","warnings.showwarning","`","is","the","standard","\/","recommended","approach","for","modifying","warning","message","display","behaviors",".","For","reference",",","see","https",":","\/\/docs.python.org\/3\/library\/warnings.html","#","warnings.showwarning"]
code: def _patched_showwarning(
      self, message, category, filename, lineno, *args, **kwargs
  ):
      """
      A patched implementation of `warnings.showwarning` that enforces the warning configuration
      options configured on the controller (e.g. rerouting or disablement of MLflow warnings,
      disablement of all warnings for the current thread).
  
      Note that reassigning `warnings.showwarning` is the standard / recommended approach for
      modifying warning message display behaviors. For reference, see
      https://docs.python.org/3/library/warnings.html#warnings.showwarning
      """
      # NB: We explicitly avoid blocking on the `self._state_lock` lock during `showwarning`
      # to so that threads don't have to execute serially whenever they emit warnings with
      # `warnings.warn()`. We only lock during configuration changes to ensure that
      # `warnings.showwarning` is patched or unpatched at the correct times.
  
      from mlflow.utils.autologging_utils import _logger
  
      # If the warning's source file is contained within the MLflow package's base
      # directory, it is an MLflow warning and should be emitted via `logger.warning`
      warning_source_path = Path(filename).resolve()
      is_mlflow_warning = (
          self._mlflow_root_path in warning_source_path.parents
      )
      curr_thread = get_current_thread_id()
  
      if (curr_thread in self._disabled_threads) or (
          is_mlflow_warning and self._mlflow_warnings_disabled_globally
      ):
          return
      elif (
          curr_thread in self._rerouted_threads
          and not is_mlflow_warning
      ) or (
          is_mlflow_warning
          and self._mlflow_warnings_rerouted_to_event_logs
      ):
          _logger.warning(
              'MLflow autologging encountered a warning: "%s:%d: %s: %s"',
              filename,
              lineno,
              category.__name__,
              message,
          )
      else:
          self._original_showwarning(
              message, category, filename, lineno, *args, **kwargs
          )
  
imports: import os
  import warnings
  from contextlib import contextmanager
  from pathlib import Path
  from threading import RLock
  from threading import get_ident
  import mlflow
  from mlflow.utils import logging_utils
label_desc: Use image node_id 2 for calling the _WarningsController obj's underlying member method code with example usage: obj._patched_showwarning(message, category, filename, lineno) without return types