numpy 1.22.4 Pypi GitHub Homepage
Other Docs
Parameters

Warnings can be slippery, because, whenever a warning is triggered, Python adds a __warningregistry__ member to the calling module. This makes it impossible to retrigger the warning in this module, whatever you put in the warnings filters. This context manager accepts a sequence of modules as a keyword argument to its constructor and:

This makes it possible to trigger any warning afresh inside the context manager without disturbing the state of warnings outside.

For compatibility with Python 3.0, please consider all arguments to be keyword-only.

Parameters

record : bool, optional

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() .

modules : sequence, optional

Sequence of modules for which to reset warnings registry on entry and restore on exit. To work correctly, all 'ignore' filters should filter by one of these modules.

Context manager that resets warning registry for catching warnings

Examples

This example is valid syntax, but we were not able to check execution
>>> import warnings
... with np.testing.clear_and_catch_warnings(
...  modules=[np.core.fromnumeric]):
...  warnings.simplefilter('always')
...  warnings.filterwarnings('ignore', module='np.core.fromnumeric')
...  # do something that raises a warning but ignore those in
...  # np.core.fromnumeric
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/testing/_private/utils.py#1964
type: <class 'type'>
Commit: