98
98
import warnings
99
99
from multiprocessing import set_start_method
100
100
101
-
102
- def redirect_warnings (message , category , filename , lineno , file = None , line = None ):
103
- """Redirect other warnings."""
104
- import logging
105
- logger = logging .getLogger ()
106
- logger .debug ('Captured warning (%s): %s' , category , message )
107
-
108
-
109
101
# cmp is not used by fmriprep, so ignore nipype-generated warnings
110
- warnings .filterwarnings ('ignore' , r 'cmp not installed' )
111
- warnings .filterwarnings ('ignore' , r 'This has not been fully tested. Please report any failures.' )
112
- warnings .filterwarnings ('ignore' , r "can't resolve package from __spec__ or __package__" )
102
+ warnings .filterwarnings ('ignore' , 'cmp not installed' )
103
+ warnings .filterwarnings ('ignore' , 'This has not been fully tested. Please report any failures.' )
104
+ warnings .filterwarnings ('ignore' , "can't resolve package from __spec__ or __package__" )
113
105
warnings .simplefilter ('ignore' , DeprecationWarning )
114
106
warnings .simplefilter ('ignore' , FutureWarning )
115
107
warnings .simplefilter ('ignore' , ResourceWarning )
116
- warnings .showwarning = redirect_warnings
117
108
118
109
119
110
try :
@@ -135,6 +126,14 @@ def redirect_warnings(message, category, filename, lineno, file=None, line=None)
135
126
from . import __version__
136
127
137
128
129
+ def redirect_warnings (message , category , filename , lineno , file = None , line = None ):
130
+ """Redirect other warnings."""
131
+ logger = logging .getLogger ()
132
+ logger .debug ('Captured warning (%s): %s' , category , message )
133
+
134
+
135
+ warnings .showwarning = redirect_warnings
136
+
138
137
logging .addLevelName (25 , 'IMPORTANT' ) # Add a new level between INFO and WARNING
139
138
logging .addLevelName (15 , 'VERBOSE' ) # Add a new level between INFO and DEBUG
140
139
0 commit comments