Skip to content

Commit 9294757

Browse files
author
Jaime Céspedes Sisniega
authored
Merge pull request #290 from IFCA-Advanced-Computing/feature-update-dependant-versions
Update dependant versions
2 parents 8567b44 + d5bc551 commit 9294757

File tree

12 files changed

+61
-55
lines changed

12 files changed

+61
-55
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
python-version:
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-22.04
1111
strategy:
1212
matrix:
1313
python-version: ['3.9',
@@ -27,14 +27,14 @@ jobs:
2727
- name: Install dependencies
2828
run: |
2929
python -m pip install --upgrade pip
30-
python -m pip install setuptools==68.2.2 tox==3.24.5 tox-gh-actions==2.9.1
30+
python -m pip install setuptools==68.2.2 tox==4.12.0 tox-gh-actions==3.2.0
3131
3232
- name: Optional - Install frouros (only used by linters)
3333
if: matrix.python-version == 3.9
3434
run: |
3535
python -m venv .venv
3636
source .venv/bin/activate
37-
pip install "pytest>=7.1.2,<7.2"
37+
pip install "pytest>=7.4.4,<7.5"
3838
pip install -e .
3939
4040
- name: Run tox

.github/workflows/code_coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
jobs:
99
code-coverage:
1010
if: github.event.pull_request.merged == true
11-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-22.04
1212
steps:
1313
- name: Checkout
1414
uses: actions/checkout@v4

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ permissions:
99

1010
jobs:
1111
publish:
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-22.04
1313

1414
steps:
1515
- name: Checkout

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ version: 2
77

88
# Set the version of Python and other tools you might need
99
build:
10-
os: ubuntu-20.04
10+
os: ubuntu-22.04
1111
tools:
1212
python: "3.9"
1313

frouros/callbacks/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ def set_detector(self, detector) -> None:
5757
# )
5858
# self._detector = value
5959

60-
def on_fit_start(self, X: np.ndarray) -> None: # noqa: N803
60+
def on_fit_start(self, X: np.ndarray) -> None: # noqa: N803, B027
6161
"""On fit start method.
6262
6363
:param X: reference data
6464
:type X: numpy.ndarray
6565
"""
6666

67-
def on_fit_end(self, X: np.ndarray) -> None: # noqa: N803
67+
def on_fit_end(self, X: np.ndarray) -> None: # noqa: N803, B027
6868
"""On fit end method.
6969
7070
:param X: reference data

frouros/datasets/base.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,17 @@ def _remove_temporal_file(self) -> None:
9999

100100
def _request_file(self, url: str) -> requests.models.Response:
101101
logger.info("Trying to download data from %s to %s", url, self._file_path)
102-
request_head = requests.head(url=url)
102+
request_head = requests.head(
103+
url=url,
104+
timeout=10,
105+
)
103106
if not request_head.ok:
104107
raise requests.exceptions.RequestException()
105-
request_response = requests.get(url=url, stream=True)
108+
request_response = requests.get(
109+
url=url,
110+
stream=True,
111+
timeout=10,
112+
)
106113
request_response.raise_for_status()
107114
return request_response
108115

@@ -175,7 +182,7 @@ def __repr__(self) -> str:
175182
)
176183

177184

178-
class BaseDatasetGenerator(abc.ABC):
185+
class BaseDatasetGenerator(abc.ABC): # noqa: B024
179186
"""Abstract class representing a dataset generator."""
180187

181188
def __init__(self, seed: Optional[int] = None) -> None:

frouros/detectors/concept_drift/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from frouros.utils.checks import check_callbacks
1010

1111

12-
class BaseConceptDriftConfig(abc.ABC):
12+
class BaseConceptDriftConfig(abc.ABC): # noqa: B024
1313
"""Abstract class representing a concept drift configuration class."""
1414

1515
def __init__(

frouros/detectors/concept_drift/streaming/statistical_process_control/eddm.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ def _update(self, value: Union[int, float], **kwargs) -> None:
367367
self.num_instances
368368
>= self.config.min_num_misclassified_instances # type: ignore
369369
):
370-
371370
distance_threshold = (
372371
self.mean_distance_error
373372
+ self.config.level * self.std_distance_error # type: ignore

frouros/detectors/data_drift/batch/statistical_test/chisquare.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""ChiSquareTest (Chi-square test) module."""
22

33
import collections
4-
from typing import Optional, Tuple, Union
4+
import typing
5+
from typing import Optional, Set, Tuple, Union
56

67
import numpy as np # type: ignore
78
from scipy.stats import chi2_contingency # type: ignore
@@ -77,19 +78,20 @@ def _statistical_test(
7778
return test
7879

7980
@staticmethod
81+
@typing.no_type_check # FIXME: X_ref_counter and X_counter cause mypy errors # pylint: disable=fixme # noqa: E501
8082
def _calculate_frequencies(
8183
X_ref: np.ndarray, # noqa: N803
8284
X: np.ndarray,
8385
) -> Tuple[list[int], list[int]]:
8486
X_ref_counter, X_counter = [ # noqa: N806
8587
*map(collections.Counter, [X_ref, X]) # noqa: N806
8688
]
87-
possible_values = set([*X_ref_counter.keys()] + [*X_counter.keys()])
89+
possible_values: Set[str] = set(
90+
[*X_ref_counter.keys()] + [*X_counter.keys()]
91+
) # noqa: N806
8892
f_exp, f_obs = {}, {}
8993
for value in possible_values:
90-
f_exp[value] = X_ref_counter.get(value, 0)
91-
f_obs[value] = X_counter.get(value, 0)
92-
f_exp_values, f_obs_values = [
93-
*map(list, [f_exp.values(), f_obs.values()]) # type: ignore
94-
]
95-
return f_exp_values, f_obs_values # type: ignore
94+
f_exp[value] = X_ref_counter.get(value, 0) # noqa: N806
95+
f_obs[value] = X_counter.get(value, 0) # noqa: N806
96+
f_exp_values, f_obs_values = [*map(list, [f_exp.values(), f_obs.values()])]
97+
return f_exp_values, f_obs_values

frouros/tests/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,9 @@ def train_prediction_normal(
389389

390390

391391
@pytest.fixture(scope="module", name="dataset_simple")
392-
def concept_drift_dataset_simple() -> Tuple[
393-
Tuple[np.ndarray, np.ndarray], Tuple[np.ndarray, np.ndarray]
394-
]:
392+
def concept_drift_dataset_simple() -> (
393+
Tuple[Tuple[np.ndarray, np.ndarray], Tuple[np.ndarray, np.ndarray]]
394+
):
395395
"""Dataset with multiple concepts to induce concept drift.
396396
397397
:return: dataset split in reference and test

0 commit comments

Comments
 (0)