Skip to content

Commit 11d2a21

Browse files
committed
ENH: Add CaretMetaData._sanitize static method to focus warning code
1 parent 434e2d2 commit 11d2a21

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

nibabel/caret.py

+7
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,15 @@ class CaretMetaData(xml.XmlSerializable, MutableMapping):
3737
b'<MetaData><MD><Name>key</Name><Value>val</Value></MD></MetaData>'
3838
"""
3939
def __init__(self, *args, **kwargs):
40+
args, kwargs = self._sanitize(args, kwargs)
4041
self._data = dict(*args, **kwargs)
4142

43+
@staticmethod
44+
def _sanitize(args, kwargs):
45+
""" Override in subclasses to accept and warn on previous invocations
46+
"""
47+
return args, kwargs
48+
4249
def __getitem__(self, key):
4350
""" Get metadata entry by name
4451

0 commit comments

Comments
 (0)