Skip to content

Commit 29ad017

Browse files
authored
Merge pull request #84 from sentinel-hub/develop
Release 1.7.2
2 parents 308c7ed + fd7ac82 commit 29ad017

7 files changed

+14
-11
lines changed

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: v4.5.0
44
hooks:
55
- id: end-of-file-fixer
66
- id: requirements-txt-fixer
@@ -13,18 +13,18 @@ repos:
1313
- id: debug-statements
1414

1515
- repo: https://github.com/psf/black
16-
rev: 23.1.0
16+
rev: 23.12.1
1717
hooks:
1818
- id: black
1919
language_version: python3
2020

2121
- repo: https://github.com/charliermarsh/ruff-pre-commit
22-
rev: "v0.0.269"
22+
rev: "v0.1.11"
2323
hooks:
2424
- id: ruff
2525

2626
- repo: https://github.com/nbQA-dev/nbQA
27-
rev: 1.6.3
27+
rev: 1.7.1
2828
hooks:
2929
- id: nbqa-black
3030
- id: nbqa-ruff

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ classifiers = [
3535
]
3636
dependencies = [
3737
"lightgbm>=2.0.11",
38-
"numpy>=1.13.3",
38+
"numpy>=1.13.3,<2",
3939
"opencv-python-headless",
4040
"sentinelhub>=3.9.0",
4141
"typing_extensions",

s2cloudless/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
from .pixel_classifier import PixelClassifier
55
from .utils import download_bands_and_valid_data_mask
66

7-
__version__ = "1.7.1"
7+
__version__ = "1.7.2"

s2cloudless/cloud_detector.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module for pixel-based classification on Sentinel-2 L1C imagery."""
2+
23
from __future__ import annotations
34

45
import os

s2cloudless/pixel_classifier.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module for pixel-based classifiers."""
2+
23
from __future__ import annotations
34

45
from typing import Any, Protocol
@@ -75,8 +76,8 @@ def image_predict_proba(self, data: np.ndarray, **kwargs: Any) -> np.ndarray:
7576
pixels = data.reshape((-1, data.shape[-1]))
7677

7778
if isinstance(self.classifier, Booster):
78-
probabilities = self.classifier.predict(pixels, **kwargs)
79-
probabilities = np.vstack((1.0 - probabilities, probabilities)).transpose()
79+
proba = self.classifier.predict(pixels, **kwargs)
80+
probabilities = np.vstack([1.0 - proba, proba]).transpose() # type: ignore[operator, list-item]
8081
else:
8182
probabilities = self.classifier.predict_proba(pixels, **kwargs)
8283

s2cloudless/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,6 @@ def download_bands_and_valid_data_mask(
7676

7777
def cv2_disk(radius: int) -> np.ndarray:
7878
"""Recreates the disk structural element from skimage.morphology using OpenCV."""
79-
return cv2.circle(
79+
return cv2.circle( # type: ignore[call-overload]
8080
np.zeros((radius * 2 + 1, radius * 2 + 1), dtype=np.uint8), (radius, radius), radius, color=1, thickness=-1
8181
)

tests/test_utils.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
from __future__ import annotations
2+
13
import datetime as dt
2-
from typing import Tuple
34

45
import numpy as np
56
import pytest
@@ -46,7 +47,7 @@
4647
],
4748
)
4849
@pytest.mark.sh_integration()
49-
def test_download_bands_and_valid_data_mask(test_input: dict, expected_shape: Tuple[int, int, int]) -> None:
50+
def test_download_bands_and_valid_data_mask(test_input: dict, expected_shape: tuple[int, int, int]) -> None:
5051
bands, mask = download_bands_and_valid_data_mask(**test_input)
5152
assert bands.shape == expected_shape
5253
assert bands.dtype == np.float32

0 commit comments

Comments
 (0)