diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8f0e429..64688be 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,3 @@ -default_language_version: - python: python3.8 repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.1.0 @@ -15,6 +13,10 @@ repos: - id: pyupgrade language: python args: [--py37-plus] + - repo: https://github.com/pycqa/isort + rev: 5.10.1 + hooks: + - id: isort - repo: https://github.com/ambv/black rev: 22.1.0 hooks: @@ -27,7 +29,6 @@ repos: language: python additional_dependencies: - flake8-bugbear - - flake8-import-order - pep8-naming # The following is disabled due to a runtime error # - flake8-docstrings diff --git a/evalutils/io.py b/evalutils/io.py index 9b56bdc..df56c28 100644 --- a/evalutils/io.py +++ b/evalutils/io.py @@ -4,10 +4,10 @@ from pathlib import Path from typing import Dict, List -from SimpleITK import GetArrayFromImage, ReadImage from imageio import get_reader from pandas import read_csv from pandas.errors import EmptyDataError, ParserError +from SimpleITK import GetArrayFromImage, ReadImage from .exceptions import FileLoaderError diff --git a/evalutils/stats.py b/evalutils/stats.py index b1872f2..37cc6b0 100644 --- a/evalutils/stats.py +++ b/evalutils/stats.py @@ -6,7 +6,6 @@ from numpy import ndarray from scipy.ndimage import binary_erosion, convolve, generate_binary_structure - VOXELSPACING_TYPE = Optional[ Union[Tuple[Union[float, int], ...], List[Union[float, int]], float, int] ] diff --git a/pyproject.toml b/pyproject.toml index 4837ab8..057c801 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,6 +43,11 @@ sphinx_autodoc_typehints = "*" requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" +[tool.isort] +profile = "black" +known_first_party = ["evalutils", "tests"] +line_length = 79 + [tool.black] line-length = 79 target-version = ['py37'] diff --git a/setup.cfg b/setup.cfg index c1deb4a..b674feb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,10 +6,7 @@ python_version = 3.9 # disallow_untyped_defs = True [flake8] -application-import-names = - evalutils - tests -import-order-style = pycharm +max-line-length = 79 docstring-convention = numpy max-complexity = 10 select = diff --git a/tests/test_algorithm.py b/tests/test_algorithm.py index 4f300eb..923e6a1 100644 --- a/tests/test_algorithm.py +++ b/tests/test_algorithm.py @@ -4,8 +4,8 @@ from pathlib import Path from typing import Dict -import SimpleITK import numpy as np +import SimpleITK from pandas import DataFrame from scipy.ndimage import center_of_mass, label @@ -15,7 +15,6 @@ SegmentationAlgorithm, ) - TEMPLATE_TEST_DIR = ( Path(__file__).parent.parent / "evalutils" diff --git a/tests/test_stats.py b/tests/test_stats.py index 6dd8b6f..2534b66 100644 --- a/tests/test_stats.py +++ b/tests/test_stats.py @@ -1,9 +1,9 @@ from typing import Tuple -import SimpleITK import numpy as np import pytest import scipy.ndimage as ndimage +import SimpleITK import sklearn from numpy.testing import assert_array_almost_equal from scipy.ndimage import generate_binary_structure