diff --git a/python/cucim/ci/bootstrap.py b/python/cucim/ci/bootstrap.py index bec7bb204..2e58b769c 100755 --- a/python/cucim/ci/bootstrap.py +++ b/python/cucim/ci/bootstrap.py @@ -1,16 +1,11 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals +from __future__ import absolute_import, print_function, unicode_literals import os import subprocess import sys -from os.path import abspath -from os.path import dirname -from os.path import exists -from os.path import join +from os.path import abspath, dirname, exists, join base_path = dirname(dirname(abspath(__file__))) diff --git a/python/cucim/setup.py b/python/cucim/setup.py index b1cdabad2..a0c06de23 100755 --- a/python/cucim/setup.py +++ b/python/cucim/setup.py @@ -1,17 +1,13 @@ #!/usr/bin/env python # -*- encoding: utf-8 -*- -from __future__ import absolute_import -from __future__ import print_function +from __future__ import absolute_import, print_function import io import sys -from os.path import dirname -from os.path import join - -from setuptools import find_packages -from setuptools import setup +from os.path import dirname, join import versioneer +from setuptools import find_packages, setup # Give setuptools a hint to complain if it's too old a version # 24.2.0 added the python_requires option diff --git a/python/cucim/src/cucim/__init__.py b/python/cucim/src/cucim/__init__.py index 2ade85d92..52a1ebb20 100644 --- a/python/cucim/src/cucim/__init__.py +++ b/python/cucim/src/cucim/__init__.py @@ -41,7 +41,7 @@ pass try: - from .clara import __version__, CuImage, cli + from .clara import CuImage, __version__, cli except ImportError: from ._version import get_versions __version__ = get_versions()['version'] diff --git a/python/cucim/src/cucim/clara/__init__.py b/python/cucim/src/cucim/clara/__init__.py index ea731bbad..073c836a7 100644 --- a/python/cucim/src/cucim/clara/__init__.py +++ b/python/cucim/src/cucim/clara/__init__.py @@ -17,7 +17,7 @@ from . import cli, converter # import hidden methods -from ._cucim import CuImage, __version__, filesystem, io, cache +from ._cucim import CuImage, __version__, cache, filesystem, io __all__ = ['cli', 'CuImage', 'filesystem', 'io', 'cache', 'converter', '__version__'] diff --git a/python/cucim/src/cucim/clara/cache/__init__.py b/python/cucim/src/cucim/clara/cache/__init__.py index 3b1f603c1..8d36d8fb5 100644 --- a/python/cucim/src/cucim/clara/cache/__init__.py +++ b/python/cucim/src/cucim/clara/cache/__init__.py @@ -13,6 +13,7 @@ # limitations under the License. # -from cucim.clara._cucim.cache import CacheType, ImageCache, preferred_memory_capacity +from cucim.clara._cucim.cache import (CacheType, ImageCache, + preferred_memory_capacity) __all__ = ['CacheType', 'ImageCache', 'preferred_memory_capacity'] diff --git a/python/cucim/src/cucim/skimage/color/tests/test_colorconv.py b/python/cucim/src/cucim/skimage/color/tests/test_colorconv.py index 0a2791862..7eb8cce32 100644 --- a/python/cucim/src/cucim/skimage/color/tests/test_colorconv.py +++ b/python/cucim/src/cucim/skimage/color/tests/test_colorconv.py @@ -22,12 +22,12 @@ from cucim.skimage.color import (combine_stains, convert_colorspace, gray2rgb, gray2rgba, hed2rgb, hsv2rgb, lab2lch, lab2rgb, lab2xyz, lch2lab, luv2rgb, luv2xyz, rgb2gray, - rgb2hed, rgb2hsv, rgb2lab, rgb2luv, rgb2rgbcie, - rgb2xyz, rgb2ycbcr, rgb2ydbdr, rgb2yiq, - rgb2ypbpr, rgb2yuv, rgba2rgb, rgbcie2rgb, - separate_stains, xyz2lab, xyz2luv, xyz2rgb, - ycbcr2rgb, ydbdr2rgb, yiq2rgb, ypbpr2rgb, - yuv2rgb) + rgb2hed, rgb2hsv, rgb2lab, rgb2luv, + rgb2rgbcie, rgb2xyz, rgb2ycbcr, rgb2ydbdr, + rgb2yiq, rgb2ypbpr, rgb2yuv, rgba2rgb, + rgbcie2rgb, separate_stains, xyz2lab, xyz2luv, + xyz2rgb, ycbcr2rgb, ydbdr2rgb, yiq2rgb, + ypbpr2rgb, yuv2rgb) from cucim.skimage.util import img_as_float, img_as_float32, img_as_ubyte diff --git a/python/cucim/src/cucim/skimage/filters/__init__.py b/python/cucim/src/cucim/skimage/filters/__init__.py index 24c8402a0..4ea51df50 100644 --- a/python/cucim/src/cucim/skimage/filters/__init__.py +++ b/python/cucim/src/cucim/skimage/filters/__init__.py @@ -16,8 +16,9 @@ from .thresholding import (apply_hysteresis_threshold, threshold_isodata, threshold_li, threshold_local, threshold_mean, threshold_minimum, threshold_multiotsu, - threshold_niblack, threshold_otsu, threshold_sauvola, - threshold_triangle, threshold_yen, try_all_threshold) + threshold_niblack, threshold_otsu, + threshold_sauvola, threshold_triangle, + threshold_yen, try_all_threshold) __all__ = [ "inverse", diff --git a/python/cucim/src/cucim/skimage/filters/tests/test_thresholding.py b/python/cucim/src/cucim/skimage/filters/tests/test_thresholding.py index d1dddfad4..8e9945dff 100644 --- a/python/cucim/src/cucim/skimage/filters/tests/test_thresholding.py +++ b/python/cucim/src/cucim/skimage/filters/tests/test_thresholding.py @@ -14,8 +14,9 @@ from cucim.skimage.color import rgb2gray from cucim.skimage.exposure import histogram from cucim.skimage.filters.thresholding import _cross_entropy # _mean_std, -from cucim.skimage.filters.thresholding import (threshold_isodata, threshold_li, - threshold_local, threshold_mean, +from cucim.skimage.filters.thresholding import (threshold_isodata, + threshold_li, threshold_local, + threshold_mean, threshold_minimum, threshold_multiotsu, threshold_niblack, diff --git a/python/cucim/src/cucim/skimage/transform/__init__.py b/python/cucim/src/cucim/skimage/transform/__init__.py index fa728720d..02527dd22 100644 --- a/python/cucim/src/cucim/skimage/transform/__init__.py +++ b/python/cucim/src/cucim/skimage/transform/__init__.py @@ -3,8 +3,8 @@ PiecewiseAffineTransform, PolynomialTransform, ProjectiveTransform, SimilarityTransform, estimate_transform, matrix_transform) -from ._warps import (downscale_local_mean, rescale, resize, rotate, swirl, warp, - warp_coords, warp_polar) +from ._warps import (downscale_local_mean, rescale, resize, rotate, swirl, + warp, warp_coords, warp_polar) from .integral import integral_image, integrate from .pyramids import (pyramid_expand, pyramid_gaussian, pyramid_laplacian, pyramid_reduce) diff --git a/python/cucim/tests/fixtures/testimage.py b/python/cucim/tests/fixtures/testimage.py index 72ab85fe8..7e3e2c234 100644 --- a/python/cucim/tests/fixtures/testimage.py +++ b/python/cucim/tests/fixtures/testimage.py @@ -14,10 +14,12 @@ # import shutil + import pytest -from ..util.gen_image import ImageGenerator from pytest_lazyfixture import lazy_fixture +from ..util.gen_image import ImageGenerator + def gen_image(tmpdir_factory, recipe): dataset_path = tmpdir_factory.mktemp('datasets').strpath diff --git a/python/cucim/tests/performance/clara/test_read_region_memory_usage.py b/python/cucim/tests/performance/clara/test_read_region_memory_usage.py index 06bf9b3d1..fe2a3b976 100644 --- a/python/cucim/tests/performance/clara/test_read_region_memory_usage.py +++ b/python/cucim/tests/performance/clara/test_read_region_memory_usage.py @@ -14,6 +14,7 @@ # import pytest + from ...util.io import open_image_cucim @@ -46,6 +47,7 @@ def test_read_region_cuda_memleak(testimg_tiff_stripe_4096x4096_256): def test_read_region_cpu_memleak(testimg_tiff_stripe_4096x4096_256): import os + import psutil process = psutil.Process(os.getpid()) @@ -65,8 +67,9 @@ def test_read_region_cpu_memleak(testimg_tiff_stripe_4096x4096_256): def test_read_random_region_cpu_memleak(testimg_tiff_stripe_4096x4096_256): import os - import psutil import random + + import psutil process = psutil.Process(os.getpid()) img = open_image_cucim(testimg_tiff_stripe_4096x4096_256) diff --git a/python/cucim/tests/unit/clara/test_load_image.py b/python/cucim/tests/unit/clara/test_load_image.py index 8483ad847..7c173ba46 100644 --- a/python/cucim/tests/unit/clara/test_load_image.py +++ b/python/cucim/tests/unit/clara/test_load_image.py @@ -14,6 +14,7 @@ # import pytest + from ...util.io import open_image_cucim diff --git a/python/cucim/tests/unit/clara/test_tiff_read_region.py b/python/cucim/tests/unit/clara/test_tiff_read_region.py index a2afe6d36..3b788597d 100644 --- a/python/cucim/tests/unit/clara/test_tiff_read_region.py +++ b/python/cucim/tests/unit/clara/test_tiff_read_region.py @@ -15,6 +15,7 @@ import numpy as np import pytest + from ...util.io import open_image_cucim diff --git a/python/cucim/tests/util/gen_tiff.py b/python/cucim/tests/util/gen_tiff.py index 8290fae20..764a8ffab 100644 --- a/python/cucim/tests/util/gen_tiff.py +++ b/python/cucim/tests/util/gen_tiff.py @@ -13,12 +13,13 @@ # limitations under the License. # -from tifffile import TiffWriter -import numpy as np -from pathlib import Path from functools import reduce +from pathlib import Path from tempfile import mkdtemp +import numpy as np +from tifffile import TiffWriter + COMPRESSION_MAP = {'jpeg': ('jpeg', 95), 'deflate': 'deflate'}