diff --git a/pyproject.toml b/pyproject.toml index eff1ec5..e54b6e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,7 +92,7 @@ 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*"] @@ -100,7 +100,7 @@ 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] diff --git a/wsinfer/errors.py b/wsinfer/errors.py index 5a2a4b5..fa92b67 100644 --- a/wsinfer/errors.py +++ b/wsinfer/errors.py @@ -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): @@ -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): diff --git a/wsinfer/modellib/models.py b/wsinfer/modellib/models.py index f5f736f..7e6e541 100644 --- a/wsinfer/modellib/models.py +++ b/wsinfer/modellib/models.py @@ -11,8 +11,7 @@ @dataclasses.dataclass -class LocalModelTorchScript(Model): - ... +class LocalModelTorchScript(Model): ... def get_registered_model(name: str) -> HFModelTorchScript: diff --git a/wsinfer/modellib/run_inference.py b/wsinfer/modellib/run_inference.py index 8750984..4c0aec4 100644 --- a/wsinfer/modellib/run_inference.py +++ b/wsinfer/modellib/run_inference.py @@ -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 diff --git a/wsinfer/write_geojson.py b/wsinfer/write_geojson.py index 2db5c1d..ecd52bc 100644 --- a/wsinfer/write_geojson.py +++ b/wsinfer/write_geojson.py @@ -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 diff --git a/wsinfer/wsi.py b/wsinfer/wsi.py index 5bb8721..6e773f6 100644 --- a/wsinfer/wsi.py +++ b/wsinfer/wsi.py @@ -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(