Skip to content

Commit

Permalink
ENH: Do not import range from six (#61)
Browse files Browse the repository at this point in the history
Do not import `range` from `six`: `six` is a Python 2 and 3
compatibility library. Since support for Python 2 was dropped following
the discussion in #53, this
patch set removes `six` as a dependency of the project.

The built-in Python `range()` is equivalent to the `six.moves.range`
method, so adopt the former by avoiding to import it from `six.moves`.

Similarly, use `range()` instead of `xrange()`, which is only supported
in Python 2. Both are equivalent.

Documentation:
https://pypi.org/project/six/
  • Loading branch information
jhlegarreta authored Dec 6, 2024
1 parent e36ee38 commit df30662
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 14 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ classifiers = [
dependencies = [
"numpy>=1.23.0,<2.0.0",
"nibabel>=3.0.0",
"six>=1.10",
"vtk"
]
dynamic = ["version"]
Expand Down
4 changes: 0 additions & 4 deletions tract_querier/tract_label_indices.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import warnings

from six.moves import range

import numpy as np

from six.moves import range

from .aabb import BoundingBox

__all__ = ['TractographySpatialIndexing']
Expand Down
2 changes: 0 additions & 2 deletions tract_querier/tract_math/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import csv
from os import path

from six.moves import range

import nibabel

from ..tractography import (
Expand Down
2 changes: 0 additions & 2 deletions tract_querier/tract_math/operations.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from .decorator import tract_math_operation, set_dictionary_from_use_filenames_as_index

from six.moves import range

from warnings import warn

import numpy
Expand Down
3 changes: 1 addition & 2 deletions tract_querier/tractography/trackvis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from warnings import warn
from six.moves import range

import numpy

Expand Down Expand Up @@ -43,7 +42,7 @@ def tractography_to_trackvis_file(filename, tractography, affine=None, image_dim
#data_new = {}
# for k, v in data.iteritems():
# if (v[0].ndim > 1 and v[0].shape[1] > 1):
# for i in xrange(v[0].shape[1]):
# for i in range(v[0].shape[1]):
# data_new['%s_%02d' % (k, i)] = [
# v_[:, i] for v_ in v
# ]
Expand Down
1 change: 0 additions & 1 deletion tract_querier/tractography/tractography.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import numpy as np
from six.moves import range

__all__ = ['Tractography']

Expand Down
2 changes: 0 additions & 2 deletions tract_querier/tractography/vtkInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from vtk.util import numpy_support as ns
import numpy as np

from six.moves import range

from .tractography import Tractography
from functools import reduce

Expand Down

0 comments on commit df30662

Please sign in to comment.