Skip to content

Commit 3aaf8d1

Browse files
committed
MNT: Remove gifti.gifti.data_tag and accommodating hacks
1 parent 494ad70 commit 3aaf8d1

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

nibabel/gifti/gifti.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -378,35 +378,15 @@ def print_summary(self):
378378
print('Affine Transformation Matrix: \n', self.xform)
379379

380380

381-
@deprecate_with_version(
382-
"data_tag is an internal API that will be discontinued.",
383-
'2.1', '4.0')
384-
def data_tag(dataarray, encoding, datatype, ordering):
385-
class DataTag(xml.XmlSerializable):
386-
387-
def __init__(self, *args):
388-
self.args = args
389-
390-
def _to_xml_element(self):
391-
return _data_tag_element(*self.args)
392-
393-
return DataTag(dataarray, encoding, datatype, ordering).to_xml()
394-
395-
396381
def _data_tag_element(dataarray, encoding, dtype, ordering):
397382
""" Creates data tag with given `encoding`, returns as XML element
398383
"""
399384
import zlib
400385
order = array_index_order_codes.npcode[ordering]
401386
enclabel = gifti_encoding_codes.label[encoding]
402387
if enclabel == 'ASCII':
403-
# XXX Accommodating data_tag API
404-
# On removal (nibabel 4.0) drop str case
405-
da = _arr2txt(dataarray, dtype if isinstance(dtype, str) else KIND2FMT[dtype.kind])
388+
da = _arr2txt(dataarray, KIND2FMT[dtype.kind])
406389
elif enclabel in ('B64BIN', 'B64GZ'):
407-
# XXX Accommodating data_tag API - don't try to fix dtype
408-
if isinstance(dtype, str):
409-
dtype = dataarray.dtype
410390
out = np.asanyarray(dataarray, dtype).tobytes(order)
411391
if enclabel == 'B64GZ':
412392
out = zlib.compress(out)

nibabel/gifti/tests/test_gifti.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from .. import (GiftiImage, GiftiDataArray, GiftiLabel,
1313
GiftiLabelTable, GiftiMetaData, GiftiNVPairs,
1414
GiftiCoordSystem)
15-
from ..gifti import data_tag
1615
from ...nifti1 import data_type_codes
1716
from ...fileholders import FileHolder
1817
from ...deprecator import ExpiredDeprecationError
@@ -376,11 +375,6 @@ def test_gifti_coord():
376375
gcs.to_xml()
377376

378377

379-
def test_data_tag_deprecated():
380-
with pytest.raises(ExpiredDeprecationError):
381-
data_tag(np.array([]), 'ASCII', '%i', 1)
382-
383-
384378
def test_gifti_round_trip():
385379
# From section 14.4 in GIFTI Surface Data Format Version 1.0
386380
# (with some adaptations)

0 commit comments

Comments
 (0)