Skip to content

Commit

Permalink
[STYLE] format with black (#215)
Browse files Browse the repository at this point in the history
* format with black

* rm unused package data file

* flake8 ignore E701
  • Loading branch information
kaczmarj authored Feb 13, 2024
1 parent d28caf1 commit 5d0d322
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 21 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ Repository = "https://github.com/SBU-BMI/wsinfer"
wsinfer = "wsinfer.cli.cli:cli"

[tool.setuptools.package-data]
wsinfer = ["py.typed", "patchlib/presets/*.csv", "schemas/*.json"]
wsinfer = ["py.typed", "schemas/*.json"]

[tool.setuptools.packages.find]
include = ["wsinfer*"]

# Flake8-pyproject (https://pypi.org/project/Flake8-pyproject/)
[tool.flake8]
max-line-length = 88
extend-ignore = ['E203']
extend-ignore = ['E203', 'E701']
exclude = "wsinfer/_version.py"

[tool.mypy]
Expand Down
18 changes: 6 additions & 12 deletions wsinfer/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class UnknownArchitectureError(WsinferException):
"""Architecture is unknown and cannot be found."""


class WholeSlideImageDirectoryNotFound(WsinferException, FileNotFoundError):
...
class WholeSlideImageDirectoryNotFound(WsinferException, FileNotFoundError): ...


class DuplicateFilePrefixesFound(WsinferException):
Expand All @@ -23,24 +22,19 @@ class DuplicateFilePrefixesFound(WsinferException):
"""


class WholeSlideImagesNotFound(WsinferException, FileNotFoundError):
...
class WholeSlideImagesNotFound(WsinferException, FileNotFoundError): ...


class ResultsDirectoryNotFound(WsinferException, FileNotFoundError):
...
class ResultsDirectoryNotFound(WsinferException, FileNotFoundError): ...


class PatchDirectoryNotFound(WsinferException, FileNotFoundError):
...
class PatchDirectoryNotFound(WsinferException, FileNotFoundError): ...


class CannotReadSpacing(WsinferException):
...
class CannotReadSpacing(WsinferException): ...


class NoBackendException(WsinferException):
...
class NoBackendException(WsinferException): ...


class BackendNotAvailable(WsinferException):
Expand Down
3 changes: 1 addition & 2 deletions wsinfer/modellib/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@


@dataclasses.dataclass
class LocalModelTorchScript(Model):
...
class LocalModelTorchScript(Model): ...


def get_registered_model(name: str) -> HFModelTorchScript:
Expand Down
1 change: 1 addition & 0 deletions wsinfer/modellib/run_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
> In the prediction (test) phase, no data augmentation was applied except for the
> normalization of the color channels.
"""

from __future__ import annotations

import os
Expand Down
2 changes: 1 addition & 1 deletion wsinfer/write_geojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def _row_to_geojson(row: pd.Series, prob_cols: list[str]) -> dict:
# measurements is a list of {"name": str, "value": float} dicts.
# https://qupath.github.io/javadoc/docs/qupath/lib/measurements/MeasurementList.html
"measurements": measurements,
"objectType": "tile"
"objectType": "tile",
# classification is a dict of "name": str and optionally "color": int.
# https://qupath.github.io/javadoc/docs/qupath/lib/objects/classes/PathClass.html
# We do not include classification because we do not enforce a single class
Expand Down
6 changes: 2 additions & 4 deletions wsinfer/wsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,11 @@


@overload
def set_backend(name: Literal["openslide"]) -> type[openslide.OpenSlide]:
...
def set_backend(name: Literal["openslide"]) -> type[openslide.OpenSlide]: ...


@overload
def set_backend(name: Literal["tiffslide"]) -> type[tiffslide.TiffSlide]:
...
def set_backend(name: Literal["tiffslide"]) -> type[tiffslide.TiffSlide]: ...


def set_backend(
Expand Down

0 comments on commit 5d0d322

Please sign in to comment.