From f23570b4afa23efd60c34bf3420f7f9e5043db36 Mon Sep 17 00:00:00 2001 From: VNMabus Date: Mon, 22 Jan 2024 12:02:55 +0100 Subject: [PATCH] Fix Mypy config. --- .github/workflows/mypy.yml | 2 +- pyproject.toml | 7 ++++--- rdata/conversion/_conversion.py | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 07ac916..56fc99a 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -15,5 +15,5 @@ jobs: reporter: github-pr-review # The action will output fail if there are mypy errors level: error - setup_command: pip install . pytest mypy + setup_command: pip install ".[test,typing]" mypy mypy_flags: '' diff --git a/pyproject.toml b/pyproject.toml index f600296..7fa8ee2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,6 +54,10 @@ docs = [ "sphinx>=3.1", "sphinx-gallery", ] +typing = [ + "mypy", + "pandas-stubs", +] test = [ "pytest", "pytest-cov", @@ -121,9 +125,6 @@ implicit_reexport = true module = [ "igraph.*", "ipywidgets.*", - "numpy.*", - "pandas.*", - "setuptools.*", ] ignore_missing_imports = true diff --git a/rdata/conversion/_conversion.py b/rdata/conversion/_conversion.py index d4382a1..303d4f3 100644 --- a/rdata/conversion/_conversion.py +++ b/rdata/conversion/_conversion.py @@ -434,7 +434,7 @@ def dataframe_constructor( # Default row names are stored as [R_INT_NA, -len] default_row_names_len = 2 - index = ( + index: pd.RangeIndex | tuple[str, ...] = ( pd.RangeIndex(1, abs(row_names[1]) + 1) if ( len(row_names) == default_row_names_len @@ -477,7 +477,7 @@ def ordered_constructor( def ts_constructor( obj: np.ndarray[Any, Any], attrs: Mapping[str, Any], -) -> pd.Series: +) -> pd.Series[Any]: """Construct a time series object.""" start, end, frequency = attrs["tsp"]