From 583b476bc38284a323d84511cb2f00c3c7810193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Diridollou?= Date: Sat, 12 Apr 2025 13:20:21 -0400 Subject: [PATCH 1/3] GH1186 Update versions of pre-commit for ruff, black, isort and codespell --- .gitignore | 2 +- .pre-commit-config.yaml | 9 +++++---- pandas-stubs/_libs/tslibs/timestamps.pyi | 8 ++++---- pandas-stubs/_typing.pyi | 12 ++++++------ pyproject.toml | 3 ++- tests/test_frame.py | 2 +- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index f47c62c6e..932deb9a1 100644 --- a/.gitignore +++ b/.gitignore @@ -134,4 +134,4 @@ dmypy.json # Pyre type checker .pyre/ /poetry.lock -.idea/**/* \ No newline at end of file +.idea/**/* diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7b6ae84dc..608141451 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,15 +3,15 @@ ci: autofix_prs: false repos: - repo: https://github.com/python/black - rev: 24.3.0 + rev: 25.1.0 hooks: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.13.2 + rev: 6.0.1 hooks: - id: isort - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.5 + rev: v0.11.5 hooks: - id: ruff args: [ @@ -23,7 +23,8 @@ repos: --fix ] - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.4.1 hooks: - id: codespell additional_dependencies: [ tomli ] + args: [-L, "THIRDPARTY"] diff --git a/pandas-stubs/_libs/tslibs/timestamps.pyi b/pandas-stubs/_libs/tslibs/timestamps.pyi index 8cae60fec..76416b7de 100644 --- a/pandas-stubs/_libs/tslibs/timestamps.pyi +++ b/pandas-stubs/_libs/tslibs/timestamps.pyi @@ -104,14 +104,14 @@ class Timestamp(datetime, SupportsIndex): @property def fold(self) -> int: ... - if sys.version_info < (3, 12): - @classmethod - def fromtimestamp(cls, t: float, tz: _tzinfo | str | None = ...) -> Self: ... - else: + if sys.version_info >= (3, 12): @classmethod def fromtimestamp( # pyright: ignore[reportIncompatibleMethodOverride] cls, t: float, tz: _tzinfo | str | None = ... ) -> Self: ... + else: + @classmethod + def fromtimestamp(cls, t: float, tz: _tzinfo | str | None = ...) -> Self: ... @classmethod def utcfromtimestamp(cls, ts: float) -> Self: ... diff --git a/pandas-stubs/_typing.pyi b/pandas-stubs/_typing.pyi index 2655f09f7..b567bea3c 100644 --- a/pandas-stubs/_typing.pyi +++ b/pandas-stubs/_typing.pyi @@ -414,15 +414,15 @@ AnyStr_con = TypeVar("AnyStr_con", str, bytes, contravariant=True) class BaseBuffer(Protocol): @property def mode(self) -> str: ... - def seek(self, __offset: int, __whence: int = ...) -> int: ... + def seek(self, offset: int, whence: int = ..., /) -> int: ... def seekable(self) -> bool: ... def tell(self) -> int: ... class ReadBuffer(BaseBuffer, Protocol[AnyStr_cov]): - def read(self, __n: int = ...) -> AnyStr_cov: ... + def read(self, n: int = ..., /) -> AnyStr_cov: ... class WriteBuffer(BaseBuffer, Protocol[AnyStr_con]): - def write(self, __b: AnyStr_con) -> Any: ... + def write(self, b: AnyStr_con, /) -> Any: ... def flush(self) -> Any: ... class ReadPickleBuffer(ReadBuffer[bytes], Protocol): @@ -766,10 +766,10 @@ CSVEngine: TypeAlias = Literal["c", "python", "pyarrow", "python-fwf"] # QUOTE_STRINGS = 4 # QUOTE_NOTNULL = 5 CSVQuotingCompat: TypeAlias = Literal[0, 1, 2, 3] -if sys.version_info < (3, 12): - CSVQuoting: TypeAlias = CSVQuotingCompat -else: +if sys.version_info >= (3, 12): CSVQuoting: TypeAlias = CSVQuotingCompat | Literal[4, 5] +else: + CSVQuoting: TypeAlias = CSVQuotingCompat HDFCompLib: TypeAlias = Literal["zlib", "lzo", "bzip2", "blosc"] ParquetEngine: TypeAlias = Literal["auto", "pyarrow", "fastparquet"] diff --git a/pyproject.toml b/pyproject.toml index c22fd5b6d..25311ab80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ mypy = "1.15.0" pandas = "2.2.3" pyarrow = ">=10.0.1" pytest = ">=7.1.2" -pyright = ">=1.1.396,!=1.1.398" +pyright = ">=1.1.399" poethepoet = ">=0.16.5" loguru = ">=0.6.0" typing-extensions = ">=4.4.0" @@ -219,6 +219,7 @@ reportUnknownParameterType = false reportUnknownVariableType = false reportUnusedVariable = false reportPrivateUsage = false +reportPrivateImportUsage = false # enable optional checks reportMissingModuleSource = true useLibraryCodeForTypes = false diff --git a/tests/test_frame.py b/tests/test_frame.py index 99f11b3c1..32532a298 100644 --- a/tests/test_frame.py +++ b/tests/test_frame.py @@ -899,7 +899,7 @@ def gethead(s: pd.Series, y: int) -> pd.Series: pd.DataFrame, ) check( - # Note that technicaly it does not make sense + # Note that technically it does not make sense # to pass a result_type of "broadcast" to a scalar return assert_type( df.apply(returns_scalar, axis=1, result_type="broadcast"), pd.DataFrame From 6cb53e0b6fb05c188707163006a818c99115ce39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Diridollou?= Date: Sat, 12 Apr 2025 13:22:46 -0400 Subject: [PATCH 2/3] GH1186 Lock in pyright version waiting for further review --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 25311ab80..fc25c5f42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ mypy = "1.15.0" pandas = "2.2.3" pyarrow = ">=10.0.1" pytest = ">=7.1.2" -pyright = ">=1.1.399" +pyright = "1.1.396" poethepoet = ">=0.16.5" loguru = ">=0.6.0" typing-extensions = ">=4.4.0" From 8060f58c61e8b600824ee5ec1abde568d7f93313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Diridollou?= Date: Mon, 14 Apr 2025 10:49:33 -0400 Subject: [PATCH 3/3] GH1186 PR feedback --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fc25c5f42..c1477adf6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ mypy = "1.15.0" pandas = "2.2.3" pyarrow = ">=10.0.1" pytest = ">=7.1.2" -pyright = "1.1.396" +pyright = "1.1.397" poethepoet = ">=0.16.5" loguru = ">=0.6.0" typing-extensions = ">=4.4.0" @@ -219,7 +219,6 @@ reportUnknownParameterType = false reportUnknownVariableType = false reportUnusedVariable = false reportPrivateUsage = false -reportPrivateImportUsage = false # enable optional checks reportMissingModuleSource = true useLibraryCodeForTypes = false