Skip to content

Commit

Permalink
Adds isort (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsmkn authored Feb 25, 2022
1 parent f70b9dc commit d95ab0f
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 26 deletions.
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
default_language_version:
python: python3.8
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
Expand All @@ -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:
Expand All @@ -27,7 +29,6 @@ repos:
language: python
additional_dependencies:
- flake8-bugbear
- flake8-import-order
- pep8-naming
- flake8-docstrings
- mccabe
Expand Down
2 changes: 1 addition & 1 deletion panimg/contrib/oct_converter/image_types/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .oct import OCTVolumeWithMetaData
from .fundus import FundusImageWithMetaData
from .oct import OCTVolumeWithMetaData

__all__ = ["OCTVolumeWithMetaData", "FundusImageWithMetaData"]
2 changes: 1 addition & 1 deletion panimg/contrib/oct_converter/readers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .fds import FDS
from .e2e import E2E
from .fda import FDA
from .fds import FDS

__all__ = ["FDS", "E2E", "FDA"]
7 changes: 4 additions & 3 deletions panimg/contrib/oct_converter/readers/e2e.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import re
import struct
from pathlib import Path

import numpy as np
from construct import PaddedString, Int16un, Struct, Int32sn, Int32un, Int8un
from construct import Int8un, Int16un, Int32sn, Int32un, PaddedString, Struct

from panimg.contrib.oct_converter.image_types import (
OCTVolumeWithMetaData,
FundusImageWithMetaData,
OCTVolumeWithMetaData,
)
from pathlib import Path


class E2E:
Expand Down
10 changes: 6 additions & 4 deletions panimg/contrib/oct_converter/readers/fda.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from construct import PaddedString, Struct, Int32un
from pathlib import Path

import numpy as np
from construct import Int32un, PaddedString, Struct
from pylibjpeg import decode

from panimg.contrib.oct_converter.image_types import (
OCTVolumeWithMetaData,
FundusImageWithMetaData,
OCTVolumeWithMetaData,
)
from pylibjpeg import decode
from pathlib import Path


class FDA:
Expand Down
8 changes: 5 additions & 3 deletions panimg/contrib/oct_converter/readers/fds.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from construct import PaddedString, Struct, Int32un
from pathlib import Path

import numpy as np
from construct import Int32un, PaddedString, Struct

from panimg.contrib.oct_converter.image_types import (
OCTVolumeWithMetaData,
FundusImageWithMetaData,
OCTVolumeWithMetaData,
)
from pathlib import Path


class FDS:
Expand Down
2 changes: 1 addition & 1 deletion panimg/image_builders/dicom.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from pathlib import Path
from typing import DefaultDict, Iterator, List, Set

import SimpleITK
import numpy as np
import pydicom
import SimpleITK

from panimg.exceptions import UnconsumedFilesException
from panimg.models import (
Expand Down
2 changes: 1 addition & 1 deletion panimg/image_builders/fallback.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from pathlib import Path
from typing import DefaultDict, Iterator, List, Set

import SimpleITK
import numpy as np
import SimpleITK
from PIL import Image
from PIL.Image import DecompressionBombError

Expand Down
2 changes: 1 addition & 1 deletion panimg/image_builders/oct.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
Union,
)

import SimpleITK
import numpy as np
import numpy.typing as npt
import SimpleITK
from construct.core import Float64l, Int8ul, PaddedString, StreamError, Struct
from pydantic import BaseModel

Expand Down
2 changes: 1 addition & 1 deletion panimg/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from typing import Any, Dict, List, NamedTuple, Optional, Set, Tuple
from uuid import UUID, uuid4

from SimpleITK import Image, WriteImage
from pydantic import BaseModel, validator
from pydantic.dataclasses import dataclass
from SimpleITK import Image, WriteImage

from panimg.exceptions import ValidationError

Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ pytest-cov = "*"
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.isort]
profile = "black"
known_first_party = ["panimg", "tests"]
line_length = 79

[tool.black]
line-length = 79
target-version = ['py37']
Expand Down
4 changes: 0 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ warn_untyped_fields = True

[flake8]
max-line-length = 79
application-import-names =
tests
panimg
import-order-style = pycharm
docstring-convention = numpy
max-complexity = 10
select =
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mhd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from pathlib import Path
from typing import List, Union

import SimpleITK
import pytest
import SimpleITK

from panimg.exceptions import ValidationError
from panimg.image_builders.metaio_utils import (
Expand Down
4 changes: 2 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from pathlib import Path

import SimpleITK
import pytest
import SimpleITK
from pytest import approx

from panimg.image_builders.metaio_utils import load_sitk_image
from panimg.models import ColorSpace, EXTRA_METADATA, SimpleITKImage
from panimg.models import EXTRA_METADATA, ColorSpace, SimpleITKImage
from tests import RESOURCE_PATH


Expand Down

0 comments on commit d95ab0f

Please sign in to comment.