diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 20864026..d23218c8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,18 +13,18 @@ repos: - id: debug-statements - repo: https://github.com/psf/black - rev: 24.4.0 + rev: 24.8.0 hooks: - id: black language_version: python3 - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: "v0.4.1" + rev: "v0.5.7" hooks: - id: ruff - repo: https://github.com/nbQA-dev/nbQA - rev: 1.8.5 + rev: 1.8.7 hooks: - id: nbqa-black - id: nbqa-ruff diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 78c84994..e06cbd5c 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,3 +1,9 @@ +## [Version 3.10.3] - 2024-13-08 + +- Monitoring a batch job now concludes if the batch job is cancelled. +- The monitoring function now waits for the status of the batch job to change (even if all tiles have completed) before finalization in order to return the correct status. + + ## [Version 3.10.2] - 2024-24-04 - Added `max_retries` parameter to `SHConfig` class. It controls how many times the client will attempt to re-download before raising `OutOfRequestsException`. It is set to `None` by default, in which case it never stops trying. Contributed by @Regan-Koopmans. diff --git a/pyproject.toml b/pyproject.toml index 6ddbacc4..d1eb1c27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -110,7 +110,7 @@ preview = true [tool.ruff] line-length = 120 target-version = "py38" -select = [ +lint.select = [ "F", # pyflakes "E", # pycodestyle "W", # pycodestyle @@ -143,7 +143,7 @@ select = [ "RUF", # ruff rules ] fix = true -fixable = [ +lint.fixable = [ "I", # sort imports "F401", # remove redundant imports "UP007", # use new-style union type annotations @@ -151,7 +151,7 @@ fixable = [ "UP037", # remove quotes around types when not necessary "FA100", # import future annotations where necessary (not autofixable ATM) ] -ignore = [ +lint.ignore = [ "C408", # complains about `dict()` calls, we use them to avoid too many " in the code "SIM108", # tries to aggresively inline `if`, not always readable "COM812", # trailing comma missing, fights with black @@ -162,11 +162,11 @@ ignore = [ "B028", # always demands a stacklevel argument when warning "PT011", # complains for `pytest.raises(ValueError)` but we use it a lot ] -per-file-ignores = { "__init__.py" = ["F401"], "conf.py" = ["FA100"] } +lint.per-file-ignores = { "__init__.py" = ["F401"], "conf.py" = ["FA100"] } exclude = [".git", "__pycache__", "build", "dist", "sentinelhub/aws/*"] -[tool.ruff.isort] +[tool.ruff.lint.isort] section-order = [ "future", "standard-library", diff --git a/sentinelhub/_version.py b/sentinelhub/_version.py index 6b0145b6..39eb9311 100644 --- a/sentinelhub/_version.py +++ b/sentinelhub/_version.py @@ -1,3 +1,3 @@ """Version of the sentinelhub package.""" -__version__ = "3.10.2" +__version__ = "3.10.3" diff --git a/sentinelhub/constants.py b/sentinelhub/constants.py index 4397e398..0e08adb4 100644 --- a/sentinelhub/constants.py +++ b/sentinelhub/constants.py @@ -81,7 +81,7 @@ def __new__(mcs, cls, bases, classdict): # type: ignore[no-untyped-def] # noqa: return super().__new__(mcs, cls, bases, classdict) - def __call__(cls, crs_value, *args, **kwargs): # type: ignore[no-untyped-def] # noqa: N805 + def __call__(cls, crs_value, *args, **kwargs): # type: ignore[no-untyped-def] """This is executed whenever CRS('something') is called""" # pylint: disable=signature-differs crs_value = cls._parse_crs(crs_value) @@ -201,7 +201,7 @@ def is_utm(self) -> bool: """ return self.name.startswith("UTM") - @functools.lru_cache(maxsize=128) # noqa: B019 + @functools.lru_cache(maxsize=128) def projection(self) -> pyproj.Proj: """Returns a projection in form of pyproj class. @@ -212,7 +212,7 @@ def projection(self) -> pyproj.Proj: """ return pyproj.Proj(self._get_pyproj_projection_def(), preserve_units=True) - @functools.lru_cache(maxsize=128) # noqa: B019 + @functools.lru_cache(maxsize=128) def pyproj_crs(self) -> pyproj.CRS: """Returns a pyproj CRS class. @@ -223,7 +223,7 @@ def pyproj_crs(self) -> pyproj.CRS: """ return pyproj.CRS(self._get_pyproj_projection_def()) - @functools.lru_cache(maxsize=512) # noqa: B019 + @functools.lru_cache(maxsize=512) def get_transform_function(self, other: CRS, always_xy: bool = True) -> Callable[..., tuple]: """Returns a function for transforming geometrical objects from one CRS to another. The function will support transformations between any objects that pyproj supports. diff --git a/tests/download/test_sentinelhub_client.py b/tests/download/test_sentinelhub_client.py index 83af3201..52b30dc9 100644 --- a/tests/download/test_sentinelhub_client.py +++ b/tests/download/test_sentinelhub_client.py @@ -57,14 +57,14 @@ def test_session_caching_and_clearing( client_object: SentinelHubDownloadClient | type[SentinelHubDownloadClient], session: SentinelHubSession ) -> None: client_object.clear_cache() - assert {} == SentinelHubDownloadClient._CACHED_SESSIONS + assert SentinelHubDownloadClient._CACHED_SESSIONS == {} client_object.cache_session(session) assert len(SentinelHubDownloadClient._CACHED_SESSIONS) == 1 assert list(SentinelHubDownloadClient._CACHED_SESSIONS.values()) == [session] client_object.clear_cache() - assert {} == SentinelHubDownloadClient._CACHED_SESSIONS + assert SentinelHubDownloadClient._CACHED_SESSIONS == {} @pytest.mark.sh_integration()