From 6c770627c338f9ee3de737f2a4099800cff7179a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20W=C3=B6rtwein?= Date: Wed, 19 Jul 2023 12:06:44 -0400 Subject: [PATCH] Fix nightly test (#751) * fix nightly test * remove comment in template, nightly tests are not run for PRs --- .github/pull_request_template.md | 4 ---- .pre-commit-config.yaml | 10 +++++----- pandas-stubs/_typing.pyi | 4 ++-- pandas-stubs/core/indexes/accessors.pyi | 2 +- tests/test_series.py | 8 +------- 5 files changed, 9 insertions(+), 19 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 4c888d77..f6b709e3 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,6 +1,2 @@ - - - [ ] Closes #xxxx (Replace xxxx with the Github issue number) - [ ] Tests added: Please use `assert_type()` to assert the type of any return value diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8f3e6899..505da955 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ ci: autofix_prs: false repos: - repo: https://github.com/python/black - rev: 23.3.0 + rev: 23.7.0 hooks: - id: black - repo: https://github.com/PyCQA/isort @@ -11,7 +11,7 @@ repos: hooks: - id: isort - repo: https://github.com/asottile/pyupgrade - rev: v3.4.0 + rev: v3.9.0 hooks: - id: pyupgrade types_or: [python, pyi] @@ -27,15 +27,15 @@ repos: - id: flake8 name: flake8 (pyi) additional_dependencies: - - flake8-pyi==23.3.1 + - flake8-pyi==23.6.0 types: [pyi] args: [ - --ignore=E301 E302 E305 E402 E501 E701 E704 F401 F811 W503 Y042, + --ignore=E301 E302 E305 E402 E501 E701 E704 F401 F811 F821 W503 Y042, # TypeVars in private files are already private --per-file-ignores=_*.pyi:Y001 ] - repo: https://github.com/codespell-project/codespell - rev: v2.2.4 + rev: v2.2.5 hooks: - id: codespell additional_dependencies: [ tomli ] diff --git a/pandas-stubs/_typing.pyi b/pandas-stubs/_typing.pyi index 106ada7b..2ac17830 100644 --- a/pandas-stubs/_typing.pyi +++ b/pandas-stubs/_typing.pyi @@ -265,9 +265,9 @@ AxisColumn: TypeAlias = Literal["columns", 1] Axis: TypeAlias = AxisIndex | AxisColumn DtypeNp = TypeVar("DtypeNp", bound=np.dtype[np.generic]) KeysArgType: TypeAlias = Any -ListLike = TypeVar("ListLike", Sequence, np.ndarray, "Series", "Index") +ListLike = TypeVar("ListLike", Sequence, np.ndarray, Series, Index) ListLikeExceptSeriesAndStr = TypeVar( - "ListLikeExceptSeriesAndStr", MutableSequence, np.ndarray, tuple, "Index" + "ListLikeExceptSeriesAndStr", MutableSequence, np.ndarray, tuple, Index ) ListLikeU: TypeAlias = Sequence | np.ndarray | Series | Index ListLikeHashable: TypeAlias = ( diff --git a/pandas-stubs/core/indexes/accessors.pyi b/pandas-stubs/core/indexes/accessors.pyi index f79b437a..fc249ca5 100644 --- a/pandas-stubs/core/indexes/accessors.pyi +++ b/pandas-stubs/core/indexes/accessors.pyi @@ -89,7 +89,7 @@ class _MiniSeconds(Generic[_DTFieldOpsReturnType]): @property def nanosecond(self) -> _DTFieldOpsReturnType: ... -_DTBoolOpsReturnType = TypeVar("_DTBoolOpsReturnType", "Series[bool]", np_ndarray_bool) +_DTBoolOpsReturnType = TypeVar("_DTBoolOpsReturnType", Series[bool], np_ndarray_bool) class _IsLeapYearProperty(Generic[_DTBoolOpsReturnType]): @property diff --git a/tests/test_series.py b/tests/test_series.py index d1eb5c7c..8d01db9d 100644 --- a/tests/test_series.py +++ b/tests/test_series.py @@ -462,13 +462,7 @@ def square(x: float) -> float: def makeseries(x: float) -> pd.Series: return pd.Series([x, 2 * x]) - with pytest_warns_bounded( - FutureWarning, - "Returning a DataFrame from Series.apply when the supplied function" - "returns a Series is deprecated", - lower="2.0.99", - ): - check(assert_type(s.apply(makeseries), pd.DataFrame), pd.DataFrame) + check(assert_type(s.apply(makeseries), pd.DataFrame), pd.DataFrame) # GH 293