Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[STYLE] format with black #215

Merged
merged 3 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading