diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 14a22dc..14aefe7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,21 +1,21 @@ fail_fast: true repos: -- repo: https://github.com/pre-commit/mirrors-isort - rev: 'v4.3.21' - hooks: - - id: isort - additional_dependencies: ['isort[pyproject]'] -- repo: https://github.com/psf/black - rev: stable - hooks: - - id: black -- repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v0.730' + - repo: https://github.com/pre-commit/mirrors-isort + rev: "v4.3.21" hooks: - - id: mypy -- repo: https://gitlab.com/pycqa/flake8 + - id: isort + additional_dependencies: ["isort[pyproject]"] + - repo: https://github.com/psf/black + rev: stable + hooks: + - id: black + - repo: https://github.com/pre-commit/mirrors-mypy + rev: "v0.910" + hooks: + - id: mypy + - repo: https://gitlab.com/pycqa/flake8 rev: 3.7.8 hooks: - - id: flake8 + - id: flake8 exclude: ^(tests|examples|docs)/* - additional_dependencies: [pep8-naming, flake8-docstrings] \ No newline at end of file + additional_dependencies: [pep8-naming, flake8-docstrings] diff --git a/epysurv/models/timepoint/_base.py b/epysurv/models/timepoint/_base.py index 381e850..cd7efce 100644 --- a/epysurv/models/timepoint/_base.py +++ b/epysurv/models/timepoint/_base.py @@ -138,7 +138,7 @@ def _prepare_r_instance(self, data: pd.DataFrame): """Transform dataframe into R data structure on which the R algorithm can work.""" raise NotImplementedError - def _extract_alarms(self, surveillance_result) -> np.array: + def _extract_alarms(self, surveillance_result) -> np.ndarray: """Extract the binary alarm array from the surveillance result R data structure.""" raise NotImplementedError diff --git a/epysurv/simulation/seasonal_noise.py b/epysurv/simulation/seasonal_noise.py index ed8597f..2b14d76 100644 --- a/epysurv/simulation/seasonal_noise.py +++ b/epysurv/simulation/seasonal_noise.py @@ -4,11 +4,12 @@ import numpy as np import pandas as pd import rpy2.robjects.packages as rpackages -from epysurv.simulation.base import BaseSimulation -from epysurv.simulation.utils import add_date_time_index_to_frame, r_list_to_frame from rpy2 import robjects from scipy.stats import nbinom, poisson +from epysurv.simulation.base import BaseSimulation +from epysurv.simulation.utils import add_date_time_index_to_frame, r_list_to_frame + surveillance = rpackages.importr("surveillance") @@ -187,7 +188,7 @@ def simulate(self, length: int) -> pd.DataFrame: else: cases = [] for mu in mu_s: - r = np.float(mu / (self.dispersion - 1)) + r = mu / (self.dispersion - 1) p = r / (r + mu) cases.append(nbinom.rvs(r, p, size=1)[0]) return ( diff --git a/requirements-dev.txt b/requirements-dev.txt index d17877f..ce7b7b1 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -5,7 +5,7 @@ pytest-datadir pytest-cov codecov black==19.10b0 -mypy +mypy==0.910 flake8 pep8-naming flake8-docstrings