Skip to content

Commit

Permalink
Consolidate Python 2/3 compatibility code (#49)
Browse files Browse the repository at this point in the history
* Consolidate Python compatibility code

Move all of the Python compatibility code into a single module under
`dask_image` instead of per subpackage. Should make it a bit easier to
manage.

* Use shared Python 2/3 compatibility module

Update all of the subpackage code to use the shared Python 2/3
compatibility module for their needs.

* Consolidate Python 2/3 compatibility tests

Move the Python 2/3 compatibility tests into a shared module as was done
with the compatibility code itself. Should make this test code easier to
manage as well.

* Test shared Python 2/3 compatibility module

Update Python 2/3 compatibility tests to use the shared compatibility
module for testing.
  • Loading branch information
jakirkham committed Sep 2, 2018
1 parent 6be6b61 commit 693db91
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 29 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion dask_image/imread/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import numpy
import pims

from . import _pycompat
from .. import _pycompat


def imread(fname, nframes=1):
Expand Down
2 changes: 1 addition & 1 deletion dask_image/ndmeasure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import dask.array

from . import _compat
from . import _pycompat
from .. import _pycompat
from . import _utils


Expand Down
2 changes: 1 addition & 1 deletion dask_image/ndmeasure/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import dask.array

from . import _pycompat
from .. import _pycompat


def _asarray(a):
Expand Down
7 changes: 0 additions & 7 deletions dask_image/ndmeasure/_pycompat.py

This file was deleted.

2 changes: 1 addition & 1 deletion dask_image/ndmeasure/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import dask.array

from . import _compat
from . import _pycompat
from .. import _pycompat


def _norm_input_labels_index(input, labels=None, index=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

from __future__ import absolute_import

import dask_image.imread._pycompat
import dask_image._pycompat


def test_irange():
r = dask_image.imread._pycompat.irange(5)
r = dask_image._pycompat.irange(5)

assert not isinstance(r, list)

assert list(r) == [0, 1, 2, 3, 4]


def test_izip():
r = dask_image.imread._pycompat.izip([1, 2], [3, 4, 5])
r = dask_image._pycompat.izip([1, 2], [3, 4, 5])

assert not isinstance(r, list)

Expand Down
15 changes: 0 additions & 15 deletions tests/test_dask_image/test_ndmeasure/test__pycompat.py

This file was deleted.

0 comments on commit 693db91

Please sign in to comment.