This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
default_filter_warning.py
125 lines (118 loc) · 4.83 KB
/
default_filter_warning.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
"""
@file
@brief Function which filters ou warnings after running the unit test
.. versionadded:: 1.5
"""
def default_filter_warning(w):
"""
filters out warning
@param w warning
@return boolean (True to keep it)
Interesting fields: ``w.message``, ``w.category``, ``w.filename``, ``w.lineno``.
.. todoext::
:title: filter warnings after the unit tests
:tag: done
:date: 2016-07-05
:hidden:
:issue: 19
:release: 1.4
:cost: 0.2
Parameter *filter_warning* was added to give users
a way to define their own filtering.
"""
if isinstance(w.message, DeprecationWarning):
if w.filename.endswith("kernelspec.py"):
return False
if "jupyter_client" in w.filename:
return False
if "IPython" in w.filename:
if "DisplayFormatter." in str(w.message):
return False
if "ScriptMagics." in str(w.message):
return False
if "HistoryManager." in str(w.message):
return False
if "ProfileDir." in str(w.message):
return False
if "InteractiveShell." in str(w.message):
return False
if "on_trait_change" in str(w.message):
return False
if "PlainTextFormatter." in str(w.message):
return False
if "Metadata should be set using the .tag()" in str(w.message):
return False
elif "nbconvert" in w.filename:
if "SlidesExporter." in str(w.message):
return False
if "TemplateExporter." in str(w.message):
return False
if "HTMLExporter." in str(w.message):
return False
if "SVG2PDFPreprocessor." in str(w.message):
return False
if "on_trait_change" in str(w.message):
return False
if "PresentExporter." in str(w.message):
return False
if "NbConvertApp." in str(w.message):
return False
if "RSTExporter." in str(w.message):
return False
if "PythonExporter." in str(w.message):
return False
if "LatexExporter." in str(w.message):
return False
if "metadata should be set using the .tag()" in str(w.message).lower():
return False
elif "jupyter_core" in w.filename:
if "JupyterApp." in str(w.message):
return False
if "metadata should be set using the .tag()" in str(w.message).lower():
return False
elif "nbextensions.py" in w.filename:
if "metadata should be set using the .tag()" in str(w.message).lower():
return False
elif "docutils" in w.filename:
if "'U' mode is deprecated" in str(w.message):
return False
if "Metadata should be set using the .tag()" in str(w.message):
return False
elif "sympy" in w.filename:
if "inspect.getargspec() is deprecated" in str(w.message):
return False
elif "_mode_cbc.py" in w.filename:
if "will be forbidden in the future" in str(w.message):
return False
elif "mpl_toolkits" in w.filename:
if "The ishold function was deprecated in version 2.0." in str(w.message):
return False
if "The hold function was deprecated in version 2.0." in str(w.message):
return False
if "axes.hold is deprecated." in str(w.message):
return False
elif "_bootstrap.py" in w.filename:
if "can't resolve package from __spec__" in str(w.message):
return False
elif "basemap" in w.filename:
if "The ishold function was deprecated in version 2.0." in str(w.message):
return False
elif "pandas" in w.filename:
if "ix is deprecated" in str(w.message):
return False
elif "sphinx" in w.filename:
if "sphinx.util.compat.Directive is deprecated and will be removed" in str(w.message):
return False
elif "\markdown_mistune.py" in w.filename:
if "cgi.escape is deprecated, use html.escape instead" in str(w.message):
return False
elif isinstance(w.message, ImportWarning):
if "_bootstrap.py" in w.filename:
if "can't resolve package from __spec__" in str(w.message):
return False
elif w.filename.endswith("_bootstrap_external.py"):
return False
elif "MatplotlibDeprecationWarning" in str(type(w.message)):
if "basemap" in w.filename:
return False
return True