From e7579995c925dcb52ae6f6f9732ba43aac28578c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=BDiga=20Luk=C5=A1i=C4=8D?=
<31988337+zigaLuksic@users.noreply.github.com>
Date: Tue, 24 Oct 2023 14:56:40 +0200
Subject: [PATCH] Prepare for release (#484)
* update pre-commit
* update version
* satisfy linters
* update changelog
* update changelog
* update read-the-docs configuration
---
.pre-commit-config.yaml | 6 +++---
.readthedocs.yml | 14 +++++++++-----
CHANGELOG.MD | 7 +++++++
examples/utils.py | 1 +
sentinelhub/_version.py | 2 +-
sentinelhub/api/__init__.py | 1 +
sentinelhub/api/base.py | 1 +
sentinelhub/api/base_request.py | 1 +
sentinelhub/api/batch/__init__.py | 1 +
sentinelhub/api/batch/base.py | 1 +
sentinelhub/api/batch/process.py | 1 +
sentinelhub/api/batch/statistical.py | 1 +
sentinelhub/api/batch/utils.py | 1 +
sentinelhub/api/byoc.py | 1 +
sentinelhub/api/catalog.py | 1 +
sentinelhub/api/fis.py | 1 +
sentinelhub/api/ogc.py | 1 +
sentinelhub/api/opensearch.py | 1 +
sentinelhub/api/process.py | 1 +
sentinelhub/api/statistical.py | 1 +
sentinelhub/api/utils.py | 1 +
sentinelhub/api/wfs.py | 1 +
sentinelhub/areas.py | 1 +
sentinelhub/aws/batch.py | 1 +
sentinelhub/aws/client.py | 1 +
sentinelhub/aws/commands.py | 1 +
sentinelhub/aws/constants.py | 1 +
sentinelhub/aws/request.py | 1 +
sentinelhub/base.py | 1 +
sentinelhub/commands.py | 1 +
sentinelhub/config.py | 1 +
sentinelhub/constants.py | 3 ++-
sentinelhub/data_collections.py | 1 +
sentinelhub/data_collections_bands.py | 1 +
sentinelhub/data_utils.py | 1 +
sentinelhub/decoding.py | 1 +
sentinelhub/download/client.py | 1 +
sentinelhub/download/handlers.py | 1 +
sentinelhub/download/models.py | 1 +
sentinelhub/download/rate_limit.py | 1 +
sentinelhub/download/sentinelhub_client.py | 1 +
.../sentinelhub_statistical_client.py | 1 +
sentinelhub/download/session.py | 9 ++-------
sentinelhub/evalscript.py | 1 +
sentinelhub/exceptions.py | 1 +
sentinelhub/geo_utils.py | 1 +
sentinelhub/geometry.py | 1 +
sentinelhub/geopedia/core.py | 11 +++++------
sentinelhub/testing_utils.py | 1 +
sentinelhub/time_utils.py | 19 +++++++------------
sentinelhub/types.py | 1 +
tests/api/batch/test_process.py | 1 +
tests/api/batch/test_statistical.py | 1 +
tests/api/batch/test_utils.py | 1 +
tests/api/test_byoc.py | 1 +
tests/api/test_catalog.py | 1 +
tests/api/test_opensearch.py | 1 +
tests/api/test_process.py | 1 +
tests/api/test_process_async.py | 1 +
tests/api/test_statistical.py | 1 +
tests/api/test_wfs.py | 1 +
tests/aws/test_batch.py | 1 +
tests/conftest.py | 1 +
tests/download/test_client.py | 1 +
tests/download/test_handlers.py | 1 +
tests/download/test_models.py | 1 +
tests/download/test_rate_limit.py | 1 +
.../test_sentinelhub_statistical_client.py | 1 +
tests/test_base.py | 1 +
tests/test_config.py | 1 +
tests/test_constants.py | 1 -
tests/test_data_collections.py | 1 +
tests/test_geo_utils.py | 1 +
tests/test_time_utils.py | 1 +
74 files changed, 101 insertions(+), 36 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index e6da8491..567b1655 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.4.0
+ rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: requirements-txt-fixer
@@ -13,13 +13,13 @@ repos:
- id: debug-statements
- repo: https://github.com/psf/black
- rev: 23.7.0
+ rev: 23.10.1
hooks:
- id: black
language_version: python3
- repo: https://github.com/charliermarsh/ruff-pre-commit
- rev: "v0.0.282"
+ rev: "v0.1.1"
hooks:
- id: ruff
diff --git a/.readthedocs.yml b/.readthedocs.yml
index 3a40d135..2107520f 100644
--- a/.readthedocs.yml
+++ b/.readthedocs.yml
@@ -1,12 +1,16 @@
version: 2
+build:
+ os: ubuntu-22.04
+ tools:
+ python: "3.11"
+
sphinx:
configuration: docs/source/conf.py
python:
- version: 3.8
install:
- - method: pip
- path: .
- extra_requirements:
- - docs
+ - method: pip
+ path: .
+ extra_requirements:
+ - docs
diff --git a/CHANGELOG.MD b/CHANGELOG.MD
index d6efc472..1da35a8c 100644
--- a/CHANGELOG.MD
+++ b/CHANGELOG.MD
@@ -1,3 +1,10 @@
+## [Version 3.9.2] - 2023-10-24
+
+- Adjusted how user credentials are passed to the OAuth service.
+- Added `QUALITY_FLAGS` band to `S3_OLCI`
+- Batch statistical API now supports IAM role style credentials.
+- Various minor improvements
+
## [Version 3.9.1] - 2023-05-04
- The parameter `sh_auth_base_url` has been replaced with `sh_token_url` to allow authentication on endpoints with suffixes other than `oauth/token`. For the new parameter the address must be provided in full, e.g. `https://services.sentinel-hub.com/oauth/token` instead of `https://services.sentinel-hub.com`. The change only affects users who manually adjusted this field.
diff --git a/examples/utils.py b/examples/utils.py
index c752b2e2..a82dfe71 100644
--- a/examples/utils.py
+++ b/examples/utils.py
@@ -1,6 +1,7 @@
"""
Utilities used by example notebooks
"""
+
from __future__ import annotations
from typing import Any
diff --git a/sentinelhub/_version.py b/sentinelhub/_version.py
index 464122ba..1967ddbf 100644
--- a/sentinelhub/_version.py
+++ b/sentinelhub/_version.py
@@ -1,3 +1,3 @@
"""Version of the sentinelhub package."""
-__version__ = "3.9.1"
+__version__ = "3.9.2"
diff --git a/sentinelhub/api/__init__.py b/sentinelhub/api/__init__.py
index 6a0b6d58..62557596 100644
--- a/sentinelhub/api/__init__.py
+++ b/sentinelhub/api/__init__.py
@@ -1,6 +1,7 @@
"""
The part of the package that implements interface with Sentinel Hub services.
"""
+
from .batch import (
BatchCollection,
BatchRequest,
diff --git a/sentinelhub/api/base.py b/sentinelhub/api/base.py
index 7926e992..9911767d 100644
--- a/sentinelhub/api/base.py
+++ b/sentinelhub/api/base.py
@@ -1,6 +1,7 @@
"""
Module implementing some utility functions not suitable for other utility modules
"""
+
# ruff: noqa: FA100
# do not use `from __future__ import annotations`, it clashes with `dataclass_json`
from abc import ABCMeta, abstractmethod
diff --git a/sentinelhub/api/base_request.py b/sentinelhub/api/base_request.py
index 5a680563..f558c7be 100644
--- a/sentinelhub/api/base_request.py
+++ b/sentinelhub/api/base_request.py
@@ -1,6 +1,7 @@
"""
Implementation of base Sentinel Hub interfaces
"""
+
from __future__ import annotations
from abc import ABCMeta, abstractmethod
diff --git a/sentinelhub/api/batch/__init__.py b/sentinelhub/api/batch/__init__.py
index 5bc7bd8a..71dc7208 100644
--- a/sentinelhub/api/batch/__init__.py
+++ b/sentinelhub/api/batch/__init__.py
@@ -1,6 +1,7 @@
"""
The part of the package that implements interface with Sentinel Hub services.
"""
+
from .base import BatchRequestStatus, BatchUserAction
from .process import BatchCollection, BatchRequest, BatchTileStatus, SentinelHubBatch
from .statistical import BatchStatisticalRequest, SentinelHubBatchStatistical
diff --git a/sentinelhub/api/batch/base.py b/sentinelhub/api/batch/base.py
index 61cce22f..b770e0f4 100644
--- a/sentinelhub/api/batch/base.py
+++ b/sentinelhub/api/batch/base.py
@@ -1,6 +1,7 @@
"""
Module containing shared code of Batch Process API and Batch Statistical API
"""
+
# ruff: noqa: FA100
# do not use `from __future__ import annotations`, it clashes with `dataclass_json` (even through inheritance)
from abc import ABCMeta
diff --git a/sentinelhub/api/batch/process.py b/sentinelhub/api/batch/process.py
index bb2cce69..49e402cf 100644
--- a/sentinelhub/api/batch/process.py
+++ b/sentinelhub/api/batch/process.py
@@ -2,6 +2,7 @@
Module implementing an interface with
`Sentinel Hub Batch Processing API `__.
"""
+
# ruff: noqa: FA100
# do not use `from __future__ import annotations`, it clashes with `dataclass_json`
import datetime as dt
diff --git a/sentinelhub/api/batch/statistical.py b/sentinelhub/api/batch/statistical.py
index 8400afd4..41de655f 100644
--- a/sentinelhub/api/batch/statistical.py
+++ b/sentinelhub/api/batch/statistical.py
@@ -2,6 +2,7 @@
Module implementing an interface with
`Sentinel Hub Batch Processing API `__.
"""
+
# ruff: noqa: FA100
# do not use `from __future__ import annotations`, it clashes with `dataclass_json`
import datetime as dt
diff --git a/sentinelhub/api/batch/utils.py b/sentinelhub/api/batch/utils.py
index 0860786d..be841d2c 100644
--- a/sentinelhub/api/batch/utils.py
+++ b/sentinelhub/api/batch/utils.py
@@ -1,6 +1,7 @@
"""
Module implementing utilities for working with batch jobs.
"""
+
from __future__ import annotations
import logging
diff --git a/sentinelhub/api/byoc.py b/sentinelhub/api/byoc.py
index b46cbea2..b379dd29 100644
--- a/sentinelhub/api/byoc.py
+++ b/sentinelhub/api/byoc.py
@@ -2,6 +2,7 @@
Module implementing an interface with
`Sentinel Hub Bring Your Own COG API `__.
"""
+
# ruff: noqa: FA100
# do not use `from __future__ import annotations`, it clashes with `dataclass_json`
from dataclasses import dataclass, field
diff --git a/sentinelhub/api/catalog.py b/sentinelhub/api/catalog.py
index 450f3756..3c41da7a 100644
--- a/sentinelhub/api/catalog.py
+++ b/sentinelhub/api/catalog.py
@@ -1,6 +1,7 @@
"""
A client interface for `Sentinel Hub Catalog API `__.
"""
+
from __future__ import annotations
import datetime as dt
diff --git a/sentinelhub/api/fis.py b/sentinelhub/api/fis.py
index 9c7b42bc..e33005f6 100644
--- a/sentinelhub/api/fis.py
+++ b/sentinelhub/api/fis.py
@@ -1,6 +1,7 @@
"""
Module for working with Sentinel Hub FIS service
"""
+
from __future__ import annotations
import datetime
diff --git a/sentinelhub/api/ogc.py b/sentinelhub/api/ogc.py
index 47cbf9ba..b5d6a482 100644
--- a/sentinelhub/api/ogc.py
+++ b/sentinelhub/api/ogc.py
@@ -2,6 +2,7 @@
Module for working with Sentinel Hub OGC services
`Sentinel Hub OGC services `__.
"""
+
from __future__ import annotations
import datetime
diff --git a/sentinelhub/api/opensearch.py b/sentinelhub/api/opensearch.py
index c8bdbbe0..f5e1bf4b 100644
--- a/sentinelhub/api/opensearch.py
+++ b/sentinelhub/api/opensearch.py
@@ -4,6 +4,7 @@
For more search parameters check
`service description `__.
"""
+
from __future__ import annotations
import datetime as dt
diff --git a/sentinelhub/api/process.py b/sentinelhub/api/process.py
index 3404d911..87e196da 100644
--- a/sentinelhub/api/process.py
+++ b/sentinelhub/api/process.py
@@ -1,6 +1,7 @@
"""
Implementation of `Sentinel Hub Process API interface `__.
"""
+
from __future__ import annotations
from typing import Any, Iterable
diff --git a/sentinelhub/api/statistical.py b/sentinelhub/api/statistical.py
index 42164c27..5b034531 100644
--- a/sentinelhub/api/statistical.py
+++ b/sentinelhub/api/statistical.py
@@ -2,6 +2,7 @@
Implementation of
`Sentinel Hub Statistical API interface `__.
"""
+
from __future__ import annotations
from typing import Any, Sequence
diff --git a/sentinelhub/api/utils.py b/sentinelhub/api/utils.py
index 58266751..8a58ebf1 100644
--- a/sentinelhub/api/utils.py
+++ b/sentinelhub/api/utils.py
@@ -1,6 +1,7 @@
"""
Module implementing some common utility functions
"""
+
# ruff: noqa: FA100
# do not use `from __future__ import annotations`, it clashes with `dataclass_json`
from enum import Enum
diff --git a/sentinelhub/api/wfs.py b/sentinelhub/api/wfs.py
index 4d33535a..09124291 100644
--- a/sentinelhub/api/wfs.py
+++ b/sentinelhub/api/wfs.py
@@ -2,6 +2,7 @@
Interface of
`Sentinel Hub Web Feature Service (WFS) `__.
"""
+
from __future__ import annotations
import datetime as dt
diff --git a/sentinelhub/areas.py b/sentinelhub/areas.py
index c27f97ea..2580c599 100644
--- a/sentinelhub/areas.py
+++ b/sentinelhub/areas.py
@@ -1,6 +1,7 @@
"""
Module for working with large geographical areas
"""
+
from __future__ import annotations
import itertools
diff --git a/sentinelhub/aws/batch.py b/sentinelhub/aws/batch.py
index aa7360c6..9afbeeec 100644
--- a/sentinelhub/aws/batch.py
+++ b/sentinelhub/aws/batch.py
@@ -1,6 +1,7 @@
"""
Module implementing utilities for collecting data, produced with Sentinel Hub Statistical Batch API, from an S3 bucket.
"""
+
from typing import List, Optional, Sequence, Union
from ..api.batch.statistical import BatchStatisticalRequest, BatchStatisticalRequestType, SentinelHubBatchStatistical
diff --git a/sentinelhub/aws/client.py b/sentinelhub/aws/client.py
index 86383682..15c3ecaa 100644
--- a/sentinelhub/aws/client.py
+++ b/sentinelhub/aws/client.py
@@ -1,6 +1,7 @@
"""
Module implementing a download client that is adjusted to download from AWS
"""
+
import logging
import warnings
from typing import Any, Dict, Optional
diff --git a/sentinelhub/aws/commands.py b/sentinelhub/aws/commands.py
index 374d1e08..cab8863d 100644
--- a/sentinelhub/aws/commands.py
+++ b/sentinelhub/aws/commands.py
@@ -1,6 +1,7 @@
"""
Module that implements command line interface for AWS package functionalities
"""
+
from typing import Optional, Tuple
import click
diff --git a/sentinelhub/aws/constants.py b/sentinelhub/aws/constants.py
index 7d1d7fb6..3571abef 100644
--- a/sentinelhub/aws/constants.py
+++ b/sentinelhub/aws/constants.py
@@ -1,6 +1,7 @@
"""
Constants related to AWS functionalities of the package
"""
+
import itertools as it
from enum import Enum
diff --git a/sentinelhub/aws/request.py b/sentinelhub/aws/request.py
index eed78a30..bb6a09f4 100644
--- a/sentinelhub/aws/request.py
+++ b/sentinelhub/aws/request.py
@@ -1,6 +1,7 @@
"""
Data request interface for downloading satellite data from AWS
"""
+
import functools
from abc import abstractmethod
from typing import Any, Generic, List, Optional, Tuple, TypeVar, Union
diff --git a/sentinelhub/base.py b/sentinelhub/base.py
index 6adf05b6..e41dc52f 100644
--- a/sentinelhub/base.py
+++ b/sentinelhub/base.py
@@ -1,6 +1,7 @@
"""
Implementation of base interface classes of this package.
"""
+
from __future__ import annotations
import copy
diff --git a/sentinelhub/commands.py b/sentinelhub/commands.py
index 27fc77f2..519ba5db 100644
--- a/sentinelhub/commands.py
+++ b/sentinelhub/commands.py
@@ -1,6 +1,7 @@
"""
Module that implements command line interface for the package
"""
+
from __future__ import annotations
import json
diff --git a/sentinelhub/config.py b/sentinelhub/config.py
index e59a3fef..a40e4df0 100644
--- a/sentinelhub/config.py
+++ b/sentinelhub/config.py
@@ -1,6 +1,7 @@
"""
Module for managing configuration data from `config.toml`
"""
+
from __future__ import annotations
import copy
diff --git a/sentinelhub/constants.py b/sentinelhub/constants.py
index be4201d6..4397e398 100644
--- a/sentinelhub/constants.py
+++ b/sentinelhub/constants.py
@@ -1,6 +1,7 @@
"""
Module defining constants and enumerate types used in the package
"""
+
from __future__ import annotations
import functools
@@ -104,7 +105,7 @@ def _parse_crs(value: object) -> object: # noqa: C901
if isinstance(value, dict) and "init" in value:
value = value["init"]
if hasattr(value, "to_epsg"):
- if value == CRSMeta._UNSUPPORTED_CRS: # noqa: SLF001
+ if value == CRSMeta._UNSUPPORTED_CRS:
message = (
"sentinelhub-py supports only WGS 84 coordinate reference system with "
"coordinate order lng-lat. Given pyproj.CRS(4326) has coordinate order lat-lng. Be careful "
diff --git a/sentinelhub/data_collections.py b/sentinelhub/data_collections.py
index 9c89af21..661dc38d 100644
--- a/sentinelhub/data_collections.py
+++ b/sentinelhub/data_collections.py
@@ -1,6 +1,7 @@
"""
Module defining data collections
"""
+
from __future__ import annotations
from dataclasses import dataclass, field, fields
diff --git a/sentinelhub/data_collections_bands.py b/sentinelhub/data_collections_bands.py
index 0a7d6654..a2999428 100644
--- a/sentinelhub/data_collections_bands.py
+++ b/sentinelhub/data_collections_bands.py
@@ -1,4 +1,5 @@
""" Contains information about data collections used by SH """
+
from __future__ import annotations
from dataclasses import dataclass
diff --git a/sentinelhub/data_utils.py b/sentinelhub/data_utils.py
index fbcbd498..37bf2d8d 100644
--- a/sentinelhub/data_utils.py
+++ b/sentinelhub/data_utils.py
@@ -1,6 +1,7 @@
"""
Module with statistics to dataframe transformation.
"""
+
from __future__ import annotations
from typing import Any, Iterable
diff --git a/sentinelhub/decoding.py b/sentinelhub/decoding.py
index 511f5295..67da0ee8 100644
--- a/sentinelhub/decoding.py
+++ b/sentinelhub/decoding.py
@@ -1,6 +1,7 @@
"""
Module for data decoding
"""
+
from __future__ import annotations
import json
diff --git a/sentinelhub/download/client.py b/sentinelhub/download/client.py
index 9a07658a..f457f378 100644
--- a/sentinelhub/download/client.py
+++ b/sentinelhub/download/client.py
@@ -1,6 +1,7 @@
"""
Module implementing the main download client class
"""
+
from __future__ import annotations
import json
diff --git a/sentinelhub/download/handlers.py b/sentinelhub/download/handlers.py
index dae9ce67..6176b6d9 100644
--- a/sentinelhub/download/handlers.py
+++ b/sentinelhub/download/handlers.py
@@ -1,6 +1,7 @@
"""
Module implementing error handlers which can occur during download procedure
"""
+
from __future__ import annotations
import functools
diff --git a/sentinelhub/download/models.py b/sentinelhub/download/models.py
index 40aaecff..5c7038f1 100644
--- a/sentinelhub/download/models.py
+++ b/sentinelhub/download/models.py
@@ -1,6 +1,7 @@
"""
Module implementing model classes to store download-related parameters and data.
"""
+
from __future__ import annotations
import datetime as dt
diff --git a/sentinelhub/download/rate_limit.py b/sentinelhub/download/rate_limit.py
index 9e334aae..6efd5ebb 100644
--- a/sentinelhub/download/rate_limit.py
+++ b/sentinelhub/download/rate_limit.py
@@ -1,6 +1,7 @@
"""
Module implementing rate limiting logic for Sentinel Hub service
"""
+
import time
from enum import Enum
diff --git a/sentinelhub/download/sentinelhub_client.py b/sentinelhub/download/sentinelhub_client.py
index ea4f3c9b..e714eb40 100644
--- a/sentinelhub/download/sentinelhub_client.py
+++ b/sentinelhub/download/sentinelhub_client.py
@@ -1,6 +1,7 @@
"""
Module implementing a rate-limited multithreaded download client for downloading from Sentinel Hub service
"""
+
from __future__ import annotations
import logging
diff --git a/sentinelhub/download/sentinelhub_statistical_client.py b/sentinelhub/download/sentinelhub_statistical_client.py
index 451bc4a7..8fec0e35 100644
--- a/sentinelhub/download/sentinelhub_statistical_client.py
+++ b/sentinelhub/download/sentinelhub_statistical_client.py
@@ -1,6 +1,7 @@
"""
Download process for Sentinel Hub Statistical API
"""
+
from __future__ import annotations
import concurrent.futures
diff --git a/sentinelhub/download/session.py b/sentinelhub/download/session.py
index e7205a3b..d73ea9b9 100644
--- a/sentinelhub/download/session.py
+++ b/sentinelhub/download/session.py
@@ -1,14 +1,15 @@
"""
Module implementing Sentinel Hub session object
"""
+
from __future__ import annotations
import base64
import json
import logging
-import sys
import time
import warnings
+from multiprocessing.shared_memory import SharedMemory
from threading import Event, Thread
from typing import Any, ClassVar
@@ -25,12 +26,6 @@
from ..exceptions import SHUserWarning
from ..types import JsonDict
-if sys.version_info < (3, 8):
- from shared_memory import SharedMemory
-else:
- from multiprocessing.shared_memory import SharedMemory
-
-
LOGGER = logging.getLogger(__name__)
diff --git a/sentinelhub/evalscript.py b/sentinelhub/evalscript.py
index 4a126cb6..800ce4f7 100644
--- a/sentinelhub/evalscript.py
+++ b/sentinelhub/evalscript.py
@@ -1,6 +1,7 @@
"""
Module defining evalscript generation utilities
"""
+
from __future__ import annotations
import numpy as np
diff --git a/sentinelhub/exceptions.py b/sentinelhub/exceptions.py
index ff312f4d..0bb44264 100644
--- a/sentinelhub/exceptions.py
+++ b/sentinelhub/exceptions.py
@@ -1,4 +1,5 @@
"""Module defining custom package exceptions."""
+
from __future__ import annotations
import functools
diff --git a/sentinelhub/geo_utils.py b/sentinelhub/geo_utils.py
index 14f6dfcb..6c2cdaf0 100644
--- a/sentinelhub/geo_utils.py
+++ b/sentinelhub/geo_utils.py
@@ -1,6 +1,7 @@
"""
Module for manipulation of geographical information
"""
+
from __future__ import annotations
from typing import TYPE_CHECKING, Sequence, Tuple, cast
diff --git a/sentinelhub/geometry.py b/sentinelhub/geometry.py
index cd4ed818..ba44218c 100644
--- a/sentinelhub/geometry.py
+++ b/sentinelhub/geometry.py
@@ -1,4 +1,5 @@
"""Module implementing geometry classes."""
+
from __future__ import annotations
import contextlib
diff --git a/sentinelhub/geopedia/core.py b/sentinelhub/geopedia/core.py
index ef9f36a9..d39f6294 100644
--- a/sentinelhub/geopedia/core.py
+++ b/sentinelhub/geopedia/core.py
@@ -1,6 +1,7 @@
"""
The core module for Geopedia interactions
"""
+
from __future__ import annotations
import datetime
@@ -34,13 +35,11 @@ def __init__(self, config: SHConfig | None = None):
@overload
-def _parse_geopedia_layer(layer: int | str, return_wms_name: Literal[False] = False) -> int:
- ...
+def _parse_geopedia_layer(layer: int | str, return_wms_name: Literal[False] = False) -> int: ...
@overload
-def _parse_geopedia_layer(layer: int | str, return_wms_name: Literal[True]) -> str:
- ...
+def _parse_geopedia_layer(layer: int | str, return_wms_name: Literal[True]) -> str: ...
def _parse_geopedia_layer(layer: int | str, return_wms_name: bool = False) -> int | str:
@@ -200,8 +199,8 @@ def _start_new_session(self) -> None:
self._make_login(self._session_info)
if self.is_global:
- GeopediaSession._global_session_info = self._session_info # noqa: SLF001
- GeopediaSession._global_session_start = self._session_start # noqa: SLF001
+ GeopediaSession._global_session_info = self._session_info
+ GeopediaSession._global_session_start = self._session_start
def _make_login(self, session_info: dict) -> None:
"""Private method that makes login"""
diff --git a/sentinelhub/testing_utils.py b/sentinelhub/testing_utils.py
index 3b76450d..5ddbdafc 100644
--- a/sentinelhub/testing_utils.py
+++ b/sentinelhub/testing_utils.py
@@ -1,6 +1,7 @@
"""
Utility tools for writing unit tests for packages which rely on `sentinelhub-py`
"""
+
from __future__ import annotations
import os
diff --git a/sentinelhub/time_utils.py b/sentinelhub/time_utils.py
index 5fe32bc2..c4db8ace 100644
--- a/sentinelhub/time_utils.py
+++ b/sentinelhub/time_utils.py
@@ -1,6 +1,7 @@
"""
Module with useful time/date functions
"""
+
from __future__ import annotations
import datetime as dt
@@ -34,29 +35,25 @@ def parse_time(
force_datetime: Literal[False] = False,
allow_undefined: Literal[False] = False,
**kwargs: Any,
-) -> dt.date:
- ...
+) -> dt.date: ...
@overload
def parse_time(
time_input: RawTimeType, *, force_datetime: Literal[True], allow_undefined: Literal[False] = False, **kwargs: Any
-) -> dt.datetime:
- ...
+) -> dt.datetime: ...
@overload
def parse_time(
time_input: RawTimeType, *, force_datetime: Literal[False] = False, allow_undefined: bool = False, **kwargs: Any
-) -> dt.date | None:
- ...
+) -> dt.date | None: ...
@overload
def parse_time(
time_input: RawTimeType, *, force_datetime: Literal[True], allow_undefined: bool = False, **kwargs: Any
-) -> dt.datetime | None:
- ...
+) -> dt.datetime | None: ...
def parse_time(
@@ -140,13 +137,11 @@ def parse_time_interval(
@overload
-def serialize_time(timestamp_input: dt.date | None, *, use_tz: bool = False) -> str:
- ...
+def serialize_time(timestamp_input: dt.date | None, *, use_tz: bool = False) -> str: ...
@overload
-def serialize_time(timestamp_input: Iterable[dt.date | None], *, use_tz: bool = False) -> tuple[str, ...]:
- ...
+def serialize_time(timestamp_input: Iterable[dt.date | None], *, use_tz: bool = False) -> tuple[str, ...]: ...
def serialize_time(
diff --git a/sentinelhub/types.py b/sentinelhub/types.py
index fc5b527e..c6b38e5e 100644
--- a/sentinelhub/types.py
+++ b/sentinelhub/types.py
@@ -1,4 +1,5 @@
"""Module with custom types and utilities used in sentinelhub-py."""
+
import datetime as dt
from typing import Any, Dict, Tuple, Union
diff --git a/tests/api/batch/test_process.py b/tests/api/batch/test_process.py
index 3c8ef1fe..a1518905 100644
--- a/tests/api/batch/test_process.py
+++ b/tests/api/batch/test_process.py
@@ -1,6 +1,7 @@
"""
A module that tests an interface for Sentinel Hub Batch processing
"""
+
import datetime as dt
import itertools as it
diff --git a/tests/api/batch/test_statistical.py b/tests/api/batch/test_statistical.py
index 9dd69079..5d4232eb 100644
--- a/tests/api/batch/test_statistical.py
+++ b/tests/api/batch/test_statistical.py
@@ -1,6 +1,7 @@
"""
A module that tests an interface for Sentinel Hub Batch processing
"""
+
import pytest
from requests_mock import Mocker
diff --git a/tests/api/batch/test_utils.py b/tests/api/batch/test_utils.py
index 847c818d..ac67fc72 100644
--- a/tests/api/batch/test_utils.py
+++ b/tests/api/batch/test_utils.py
@@ -7,6 +7,7 @@
Because of that the tests are very strict. If you break them make sure to understand what is happening before either
changing the code or the tests.
"""
+
from __future__ import annotations
import random
diff --git a/tests/api/test_byoc.py b/tests/api/test_byoc.py
index bd0cf9e8..b6f8213d 100644
--- a/tests/api/test_byoc.py
+++ b/tests/api/test_byoc.py
@@ -1,6 +1,7 @@
"""
A module that tests an interface for Sentinel Hub Batch processing
"""
+
import os
from datetime import datetime
diff --git a/tests/api/test_catalog.py b/tests/api/test_catalog.py
index 272b84c8..bac4f104 100644
--- a/tests/api/test_catalog.py
+++ b/tests/api/test_catalog.py
@@ -1,6 +1,7 @@
"""
Tests for the module with Catalog API interface
"""
+
from __future__ import annotations
import datetime as dt
diff --git a/tests/api/test_opensearch.py b/tests/api/test_opensearch.py
index 6fcb4685..615f796e 100644
--- a/tests/api/test_opensearch.py
+++ b/tests/api/test_opensearch.py
@@ -1,6 +1,7 @@
"""
Tests for Sentinel Hub Opensearch service interface
"""
+
from sentinelhub import CRS, BBox, get_area_dates, get_tile_info
diff --git a/tests/api/test_process.py b/tests/api/test_process.py
index aa08bc20..7a52bb69 100644
--- a/tests/api/test_process.py
+++ b/tests/api/test_process.py
@@ -1,5 +1,6 @@
""" Tests for the Process API requests
"""
+
from __future__ import annotations
import json
diff --git a/tests/api/test_process_async.py b/tests/api/test_process_async.py
index 7f170a98..b5d4cdad 100644
--- a/tests/api/test_process_async.py
+++ b/tests/api/test_process_async.py
@@ -1,5 +1,6 @@
""" Tests for the Async Process API requests
"""
+
import datetime as dt
import pytest
diff --git a/tests/api/test_statistical.py b/tests/api/test_statistical.py
index 20f9f5ac..cf26d489 100644
--- a/tests/api/test_statistical.py
+++ b/tests/api/test_statistical.py
@@ -1,6 +1,7 @@
"""
Tests for the module with Statistical API
"""
+
from __future__ import annotations
from typing import Any
diff --git a/tests/api/test_wfs.py b/tests/api/test_wfs.py
index f522c573..820c73ad 100644
--- a/tests/api/test_wfs.py
+++ b/tests/api/test_wfs.py
@@ -1,6 +1,7 @@
"""
Test for Sentinel Hub WFS
"""
+
from __future__ import annotations
import datetime
diff --git a/tests/aws/test_batch.py b/tests/aws/test_batch.py
index 6976b117..04c576f0 100644
--- a/tests/aws/test_batch.py
+++ b/tests/aws/test_batch.py
@@ -1,6 +1,7 @@
"""
Tests for AWS batch module
"""
+
from __future__ import annotations
import json
diff --git a/tests/conftest.py b/tests/conftest.py
index ab84c53c..3f00d27d 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,6 +1,7 @@
"""
Module with global fixtures
"""
+
import logging
import os
import shutil
diff --git a/tests/download/test_client.py b/tests/download/test_client.py
index 4e6f949c..b9f0dc60 100644
--- a/tests/download/test_client.py
+++ b/tests/download/test_client.py
@@ -1,6 +1,7 @@
"""
Unit tests for download utilities
"""
+
import copy
import os
diff --git a/tests/download/test_handlers.py b/tests/download/test_handlers.py
index fe7f9776..6072db5a 100644
--- a/tests/download/test_handlers.py
+++ b/tests/download/test_handlers.py
@@ -1,6 +1,7 @@
"""
Unit tests for download handlers
"""
+
import pytest
from requests import Response
from requests.exceptions import ChunkedEncodingError, ConnectionError, HTTPError, InvalidJSONError, Timeout
diff --git a/tests/download/test_models.py b/tests/download/test_models.py
index 5da86078..786e328c 100644
--- a/tests/download/test_models.py
+++ b/tests/download/test_models.py
@@ -1,6 +1,7 @@
"""
Unit tests for DownloadRequest object
"""
+
from __future__ import annotations
import datetime as dt
diff --git a/tests/download/test_rate_limit.py b/tests/download/test_rate_limit.py
index 75d9c299..5f21a67f 100644
--- a/tests/download/test_rate_limit.py
+++ b/tests/download/test_rate_limit.py
@@ -1,6 +1,7 @@
"""
Tests for utilities that implement rate-limiting in the package
"""
+
from __future__ import annotations
import concurrent.futures
diff --git a/tests/download/test_sentinelhub_statistical_client.py b/tests/download/test_sentinelhub_statistical_client.py
index 8d496a08..1872d37c 100644
--- a/tests/download/test_sentinelhub_statistical_client.py
+++ b/tests/download/test_sentinelhub_statistical_client.py
@@ -1,6 +1,7 @@
"""
Tests for the module with a special download client for Statistical API
"""
+
import pytest
from requests_mock import Mocker
diff --git a/tests/test_base.py b/tests/test_base.py
index 22ac899e..9371bb51 100644
--- a/tests/test_base.py
+++ b/tests/test_base.py
@@ -1,6 +1,7 @@
"""
Tests for sh_utils.py module
"""
+
from __future__ import annotations
import math
diff --git a/tests/test_config.py b/tests/test_config.py
index 9e6644a2..fe4b7d34 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -1,6 +1,7 @@
"""
Unit tests for config.py module
"""
+
import os
import shutil
from typing import Generator
diff --git a/tests/test_constants.py b/tests/test_constants.py
index 736d59fb..e07f0479 100644
--- a/tests/test_constants.py
+++ b/tests/test_constants.py
@@ -17,7 +17,6 @@
(13, 46, CRS("32633")),
(13, 0, CRS("32633")),
(13, -45, CRS("32733")),
- (13, 0, CRS("32633")),
(13, -0.0001, CRS("32733")),
(13, -46, CRS("32733")),
],
diff --git a/tests/test_data_collections.py b/tests/test_data_collections.py
index e56348ae..380e701e 100644
--- a/tests/test_data_collections.py
+++ b/tests/test_data_collections.py
@@ -1,6 +1,7 @@
"""
Unit tests for data_collections module
"""
+
from __future__ import annotations
from typing import Any
diff --git a/tests/test_geo_utils.py b/tests/test_geo_utils.py
index fb215c1e..7b3f9857 100644
--- a/tests/test_geo_utils.py
+++ b/tests/test_geo_utils.py
@@ -1,6 +1,7 @@
"""
Test for geo_utils module and correctness of geographical transformations
"""
+
from __future__ import annotations
import pytest
diff --git a/tests/test_time_utils.py b/tests/test_time_utils.py
index bb3ae6dc..7c19dddc 100644
--- a/tests/test_time_utils.py
+++ b/tests/test_time_utils.py
@@ -1,6 +1,7 @@
"""
Unit tests for time utility functions
"""
+
from __future__ import annotations
import datetime as dt