diff --git a/pandas/_libs/hashtable.pyi b/pandas/_libs/hashtable.pyi index 5c7be5e660fd9..a6d593076777d 100644 --- a/pandas/_libs/hashtable.pyi +++ b/pandas/_libs/hashtable.pyi @@ -144,26 +144,13 @@ class HashTable: np.ndarray, # np.ndarray[subclass-specific] npt.NDArray[np.intp], ] | np.ndarray: ... # np.ndarray[subclass-specific] - def _unique( - self, - values: np.ndarray, # np.ndarray[subclass-specific] - uniques, # FooVector - count_prior: int = ..., - na_sentinel: int = ..., - na_value: object = ..., - ignore_na: bool = ..., - return_inverse: bool = ..., - ) -> tuple[ - np.ndarray, # np.ndarray[subclass-specific] - npt.NDArray[np.intp], - ] | np.ndarray: ... # np.ndarray[subclass-specific] def factorize( self, values: np.ndarray, # np.ndarray[subclass-specific] na_sentinel: int = ..., na_value: object = ..., mask=..., - ) -> tuple[np.ndarray, npt.NDArray[np.intp],]: ... # np.ndarray[subclass-specific] + ) -> tuple[np.ndarray, npt.NDArray[np.intp]]: ... # np.ndarray[subclass-specific] class Complex128HashTable(HashTable): ... class Complex64HashTable(HashTable): ... @@ -175,7 +162,7 @@ class Int64HashTable(HashTable): def get_labels_groupby( self, values: npt.NDArray[np.int64], # const int64_t[:] - ) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.int64],]: ... + ) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.int64]]: ... def map_keys_to_values( self, keys: npt.NDArray[np.int64], @@ -198,13 +185,13 @@ def duplicated( keep: Literal["last", "first", False] = ..., ) -> npt.NDArray[np.bool_]: ... def mode( - values: np.ndarray, dropna: bool, mask: npt.NDArray[np.bool_] | None = None + values: np.ndarray, dropna: bool, mask: npt.NDArray[np.bool_] | None = ... ) -> np.ndarray: ... def value_count( values: np.ndarray, dropna: bool, - mask: npt.NDArray[np.bool_] | None = None, -) -> tuple[np.ndarray, npt.NDArray[np.int64],]: ... # np.ndarray[same-as-values] + mask: npt.NDArray[np.bool_] | None = ..., +) -> tuple[np.ndarray, npt.NDArray[np.int64]]: ... # np.ndarray[same-as-values] # arr and values should have same dtype def ismember( diff --git a/pandas/_libs/tslibs/conversion.pyi b/pandas/_libs/tslibs/conversion.pyi index 3d0288160e386..ca6f301673f33 100644 --- a/pandas/_libs/tslibs/conversion.pyi +++ b/pandas/_libs/tslibs/conversion.pyi @@ -14,7 +14,7 @@ class OutOfBoundsTimedelta(ValueError): ... def precision_from_unit( unit: str, -) -> tuple[int, int,]: ... # (int64_t, _) +) -> tuple[int, int]: ... # (int64_t, _) def ensure_datetime64ns( arr: np.ndarray, # np.ndarray[datetime64[ANY]] copy: bool = ..., @@ -25,5 +25,5 @@ def ensure_timedelta64ns( ) -> np.ndarray: ... # np.ndarray[timedelta64ns] def datetime_to_datetime64( values: npt.NDArray[np.object_], -) -> tuple[np.ndarray, tzinfo | None,]: ... # (np.ndarray[dt64ns], _) +) -> tuple[np.ndarray, tzinfo | None]: ... # (np.ndarray[dt64ns], _) def localize_pydatetime(dt: datetime, tz: tzinfo | None) -> datetime: ... diff --git a/pandas/_libs/tslibs/dtypes.pyi b/pandas/_libs/tslibs/dtypes.pyi index ab66677a8be3a..31ed25791389f 100644 --- a/pandas/_libs/tslibs/dtypes.pyi +++ b/pandas/_libs/tslibs/dtypes.pyi @@ -1,7 +1,5 @@ from enum import Enum -from pandas._libs.tslibs.offsets import BaseOffset - # These are not public API, but are exposed in the .pyi file because they # are imported in tests. _attrname_to_abbrevs: dict[str, str] diff --git a/pandas/_libs/tslibs/timestamps.pyi b/pandas/_libs/tslibs/timestamps.pyi index c5ffaba37f51f..13daba5cfcbdf 100644 --- a/pandas/_libs/tslibs/timestamps.pyi +++ b/pandas/_libs/tslibs/timestamps.pyi @@ -16,7 +16,6 @@ import numpy as np from pandas._libs.tslibs import ( BaseOffset, - NaTType, Period, Tick, Timedelta, diff --git a/pandas/conftest.py b/pandas/conftest.py index ecdc0f10b1f56..9d98478010c97 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -17,7 +17,6 @@ - Dtypes - Misc """ -# pyright: reportUntypedFunctionDecorator = false from collections import abc from datetime import ( diff --git a/pyproject.toml b/pyproject.toml index c5f89076a29fa..7b32c5f8eab49 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -153,34 +153,21 @@ pythonVersion = "3.8" typeCheckingMode = "basic" include = ["pandas", "typings"] exclude = ["pandas/tests", "pandas/io/clipboard", "pandas/util/version"] +# enable subset of "strict" +reportDuplicateImport = true +reportInvalidStubStatement = true +reportPropertyTypeMismatch = true +reportUntypedClassDecorator = true +reportUntypedFunctionDecorator = true +reportUntypedNamedTuple = true +# disable subset of "basic" reportGeneralTypeIssues = false -reportConstantRedefinition = false -reportFunctionMemberAccess = false -reportImportCycles = false -reportIncompatibleMethodOverride = false -reportIncompatibleVariableOverride = false reportMissingModuleSource = false -reportMissingParameterType = false -reportMissingTypeArgument = false -reportMissingTypeStubs = false reportOptionalCall = false reportOptionalIterable = false reportOptionalMemberAccess = false reportOptionalOperand = false reportOptionalSubscript = false reportPrivateImportUsage = false -reportPrivateUsage = false reportUnboundVariable = false -reportUnknownArgumentType = false -reportUnknownLambdaType = false -reportUnknownMemberType = false -reportUnknownParameterType = false -reportUnknownVariableType = false -reportUnnecessaryComparison = false -reportUnnecessaryIsInstance = false reportUnsupportedDunderAll = false -reportUntypedBaseClass = false -reportUnusedClass = false -reportUnusedFunction = false -reportUnusedImport = false -reportUnusedVariable = false