💾 Archived View for tris.fyi › pydoc › warnings captured on 2023-04-26 at 13:33:02. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-01-08)

-=-=-=-=-=-=-

Back to module index

Go to module by name

warnings

Python part of the warnings subsystem.

Classes

WarningMessage

catch_warnings

A context manager that copies and restores the warnings filter upon
    exiting the context.

    The 'record' argument specifies whether warnings should be captured by a
    custom implementation of warnings.showwarning() and be appended to a list
    returned by the context manager. Otherwise None is returned by the context
    manager. The objects appended to the list are arguments whose attributes
    mirror the arguments to showwarning().

    The 'module' argument is to specify an alternative module to the module
    named 'warnings' and imported under that name. This argument is only useful
    when testing the warnings module itself.

    

Functions

filterwarnings

filterwarnings(action, message='', category=<class 'Warning'>, module='', lineno=0, append=False)

  Insert an entry into the list of warnings filters (at the front).

      'action' -- one of "error", "ignore", "always", "default", "module",
                  or "once"
      'message' -- a regex that the warning message must match
      'category' -- a class that the warning must be a subclass of
      'module' -- a regex that the module name must match
      'lineno' -- an integer line number, 0 matches all warnings
      'append' -- if true, append to the list of filters
    

formatwarning

formatwarning(message, category, filename, lineno, line=None)

  Function to format a warning the standard way.

resetwarnings

resetwarnings()

  Clear the list of warning filters, so that no filters are active.

showwarning

showwarning(message, category, filename, lineno, file=None, line=None)

  Hook to write a warning to a file; replace if you like.

simplefilter

simplefilter(action, category=<class 'Warning'>, lineno=0, append=False)

  Insert a simple entry into the list of warnings filters (at the front).

      A simple filter matches all modules and messages.
      'action' -- one of "error", "ignore", "always", "default", "module",
                  or "once"
      'category' -- a class that the warning must be a subclass of
      'lineno' -- an integer line number, 0 matches all warnings
      'append' -- if true, append to the list of filters
    

warn

warn(message, category=None, stacklevel=1, source=None)

  Issue a warning, or maybe ignore it or raise an exception.

warn_explicit

warn_explicit(...)

  Low-level interface to warnings functionality.

Other members

defaultaction = 'default'
filters = [('default', None, <class 'DeprecationWarning'>, '__main__', 0), ('ignore', None, <class 'DeprecationWarning'>, None, 0), ('ignore', None, <class 'PendingDeprecationWarning'>, None, 0), ('ignore', None, <class 'ImportWarning'>, None, 0), ('ignore', None, <class 'ResourceWarning'>, None, 0)]
onceregistry = {}

Modules

sys