MCPcopy Index your code
hub / github.com/numpy/numpy / warnings_errors_and_rng

Function warnings_errors_and_rng

numpy/conftest.py:171–206  ·  view source on GitHub ↗

Filter out the wall of DeprecationWarnings.

(test=None)

Source from the content-addressed store, hash-verified

169
170 @contextmanager
171 def warnings_errors_and_rng(test=None):
172 """Filter out the wall of DeprecationWarnings.
173 """
174 msgs = ["The numpy.linalg.linalg",
175 "The numpy.fft.helper",
176 "dep_util",
177 "pkg_resources",
178 "numpy.core.umath",
179 "msvccompiler",
180 "Deprecated call",
181 "numpy.core",
182 "Importing from numpy.matlib",
183 "This function is deprecated.", # random_integers
184 "Arrays of 2-dimensional vectors", # matlib.cross
185 "NumPy warning suppression and assertion utilities are deprecated.",
186 "numpy.fix is deprecated", # fix -> trunc
187 "The chararray class is deprecated", # char.chararray
188 "numpy.typename is deprecated", # typename -> dtype.name
189 "numpy.ma.round_ is deprecated", # ma.round_ -> ma.round
190 ]
191 msg = "|".join(msgs)
192
193 msgs_r = [
194 "invalid value encountered",
195 "divide by zero encountered"
196 ]
197 msg_r = "|".join(msgs_r)
198
199 with warnings.catch_warnings():
200 warnings.filterwarnings(
201 'ignore', category=DeprecationWarning, message=msg
202 )
203 warnings.filterwarnings(
204 'ignore', category=RuntimeWarning, message=msg_r
205 )
206 yield
207
208 # find and check doctests under this context manager
209 dt_config.user_context_mgr = warnings_errors_and_rng

Callers

nothing calls this directly

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…