Skip to content

Commit 013741f

Browse files
committed
DOC: Update docstrings without Py2/3 discussion
1 parent fdcb7f4 commit 013741f

File tree

6 files changed

+9
-15
lines changed

6 files changed

+9
-15
lines changed

nibabel/fileutils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ def read_zt_byte_strings(fobj, n_strings=1, bufsize=1024):
2323
Parameters
2424
----------
2525
f : fileobj
26-
File object to use. Should implement ``read``, returning byte objects
27-
(str in Python 2), and ``seek(n, 1)`` to seek from current file
28-
position.
26+
File object to use. Should implement ``read``, returning byte objects,
27+
and ``seek(n, 1)`` to seek from current file position.
2928
n_strings : int, optional
3029
Number of byte strings to return
3130
bufsize: int, optional

nibabel/freesurfer/io.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def read_annot(filepath, orig_ids=False):
355355
to any label and orig_ids=False, its id will be set to -1.
356356
ctab : ndarray, shape (n_labels, 5)
357357
RGBT + label id colortable array.
358-
names : list of str (python 2), list of bytes (python 3)
358+
names : list of bytes
359359
The names of the labels. The length of the list is n_labels.
360360
"""
361361
with open(filepath, "rb") as fobj:

nibabel/gifti/gifti.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"""
1414

1515
import sys
16-
1716
import numpy as np
17+
import base64
1818

1919
from .. import xmlutils as xml
2020
from ..filebasedimages import SerializableImage
@@ -23,11 +23,6 @@
2323
gifti_endian_codes, KIND2FMT)
2424
from ..deprecated import deprecate_with_version
2525

26-
# {en,de}codestring in deprecated in Python3, but
27-
# {en,de}codebytes not available in Python2.
28-
# Therefore set the proper functions depending on the Python version.
29-
import base64
30-
3126

3227
class GiftiMetaData(xml.XmlSerializable):
3328
""" A sequence of GiftiNVPairs containing metadata for a gifti data array

nibabel/tests/scriptrunner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ def run_command(self, cmd, check_code=True):
112112
-------
113113
returncode : int
114114
return code from execution of `cmd`
115-
stdout : bytes (python 3) or str (python 2)
115+
stdout : bytes
116116
stdout from `cmd`
117-
stderr : bytes (python 3) or str (python 2)
117+
stderr : bytes
118118
stderr from `cmd`
119119
"""
120120
if isinstance(cmd, string_types):

nibabel/trackvis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def write(fileobj, streamlines, hdr_mapping=None, endianness=None,
325325
>>> pts1 = np.random.uniform(size=(10,3))
326326
>>> streamlines = ([(pts0, None, None), (pts1, None, None)])
327327
>>> write(file_obj, streamlines)
328-
>>> _ = file_obj.seek(0) # returns 0 in python 3
328+
>>> _ = file_obj.seek(0) # returns 0
329329
>>> streams, hdr = read(file_obj)
330330
>>> len(streams)
331331
2

nibabel/volumeutils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ def array_from_file(shape, in_dtype, infile, offset=0, order='F', mmap=True):
479479
>>> from io import BytesIO
480480
>>> bio = BytesIO()
481481
>>> arr = np.arange(6).reshape(1,2,3)
482-
>>> _ = bio.write(arr.tostring('F')) # outputs int in python3
482+
>>> _ = bio.write(arr.tostring('F')) # outputs int
483483
>>> arr2 = array_from_file((1,2,3), arr.dtype, bio)
484484
>>> np.all(arr == arr2)
485485
True
@@ -609,7 +609,7 @@ def array_to_file(data, fileobj, out_dtype=None, offset=0,
609609
>>> array_to_file(data, sio, np.float)
610610
>>> sio.getvalue() == data.tostring('F')
611611
True
612-
>>> _ = sio.truncate(0); _ = sio.seek(0) # outputs 0 in python 3
612+
>>> _ = sio.truncate(0); _ = sio.seek(0) # outputs 0
613613
>>> array_to_file(data, sio, np.int16)
614614
>>> sio.getvalue() == data.astype(np.int16).tostring()
615615
True

0 commit comments

Comments
 (0)