Skip to content

Commit 9e8eb90

Browse files
authored
add kwargs to _warnings.py (#3483)
## Changes proposed in this pull request add kwargs to the fmriprep _warnings.py script to handle new version of matplotlib warnings closes #3478
2 parents adf472c + 09da4e8 commit 9e8eb90

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

.maint/CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Before every release, unlisted contributors will be invited again to add their n
1313
| Bellec | Pierre | | 0000-0002-9111-0699 | SIMEXP Lab, CRIUGM, University of Montréal, Montréal, Canada |
1414
| Benson | Noah C. | | 0000-0002-2365-8265 | Department of Psychology, New York University |
1515
| Bhagwat | Nikhil | | 0000-0001-6073-7141 | Montreal Neurological Institute, McGill University |
16+
| Camacho | Milton | | 0000-0002-5379-5076 | Department of Pediadrics, University of Calgary |
1617
| Callenberg | Keith | | 0000-0001-7786-9300 | Department of Psychiatry, University of Pittsburgh |
1718
| Cieslak | Matthew | | 0000-0002-1931-4734 | Perelman School of Medicine, University of Pennsylvania, PA, USA |
1819
| de la Vega | Alejandro | | 0000-0001-9062-3778 | University of Texas at Austin |

fmriprep/_warnings.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,20 @@
2929
_wlog.addHandler(logging.NullHandler())
3030

3131

32-
def _warn(message, category=None, stacklevel=1, source=None):
32+
def _warn(message, category=None, stacklevel=1, source=None, **kwargs):
3333
"""Redefine the warning function."""
3434
if category is not None:
3535
category = type(category).__name__
3636
category = category.replace('type', 'WARNING')
3737

38+
if kwargs:
39+
logging.getLogger('py.warnings').warning(f'Extra warning kwargs: {kwargs}')
40+
3841
logging.getLogger('py.warnings').warning(f'{category or "WARNING"}: {message}')
3942

4043

41-
def _showwarning(message, category, filename, lineno, file=None, line=None):
42-
_warn(message, category=category)
44+
def _showwarning(message, category, filename, lineno, file=None, line=None, **kwargs):
45+
_warn(message, category=category, **kwargs)
4346

4447

4548
warnings.warn = _warn

0 commit comments

Comments
 (0)