diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index f872ad2f..87b4a55e 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -1,3 +1,7 @@ +from builtins import ( + bool as _bool, + str as _str, +) from collections.abc import ( Callable, Hashable, @@ -161,9 +165,6 @@ from pandas._typing import ( from pandas.io.formats.style import Styler from pandas.plotting import PlotAccessor -_str = str -_bool = bool - class _iLocIndexerFrame(_iLocIndexer, Generic[_T]): @overload def __getitem__(self, idx: tuple[int, int]) -> Scalar: ... @@ -2148,7 +2149,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def reindex_like( self, other: DataFrame, - method: _str | FillnaOptions | Literal["nearest"] | None = ..., + method: FillnaOptions | Literal["nearest"] | None = ..., copy: _bool = ..., limit: int | None = ..., tolerance: Scalar | AnyArrayLike | Sequence[Scalar] = ..., diff --git a/pandas-stubs/core/generic.pyi b/pandas-stubs/core/generic.pyi index cac7dfa8..ad1d5499 100644 --- a/pandas-stubs/core/generic.pyi +++ b/pandas-stubs/core/generic.pyi @@ -1,3 +1,7 @@ +from builtins import ( + bool as _bool, + str as _str, +) from collections.abc import ( Callable, Hashable, @@ -60,9 +64,6 @@ from pandas._typing import ( from pandas.io.pytables import HDFStore from pandas.io.sql import SQLTable -_bool = bool -_str = str - class NDFrame(indexing.IndexingMixin): __hash__: ClassVar[None] # type: ignore[assignment] # pyright: ignore[reportIncompatibleMethodOverride] diff --git a/pandas-stubs/core/indexes/base.pyi b/pandas-stubs/core/indexes/base.pyi index ba5ab846..bcb61c7d 100644 --- a/pandas-stubs/core/indexes/base.pyi +++ b/pandas-stubs/core/indexes/base.pyi @@ -1,3 +1,4 @@ +from builtins import str as _str from collections.abc import ( Callable, Hashable, @@ -66,8 +67,6 @@ from pandas._typing import ( class InvalidIndexError(Exception): ... -_str = str - class Index(IndexOpsMixin[S1]): __hash__: ClassVar[None] # type: ignore[assignment] # overloads with additional dtypes diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 327b0a2b..c87d84de 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -1,3 +1,7 @@ +from builtins import ( + bool as _bool, + str as _str, +) from collections import dict_keys # type: ignore[attr-defined] from collections.abc import ( Callable, @@ -179,9 +183,6 @@ from pandas.core.dtypes.dtypes import CategoricalDtype from pandas.plotting import PlotAccessor -_bool: TypeAlias = bool -_str: TypeAlias = str - class _iLocIndexerSeries(_iLocIndexer, Generic[S1]): # get item @overload @@ -1078,7 +1079,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def reindex_like( self, other: Series[S1], - method: _str | FillnaOptions | Literal["nearest"] | None = ..., + method: FillnaOptions | Literal["nearest"] | None = ..., copy: _bool = ..., limit: int | None = ..., tolerance: Scalar | AnyArrayLike | Sequence[Scalar] = ..., diff --git a/pandas-stubs/core/strings.pyi b/pandas-stubs/core/strings.pyi index 74588eae..f78adf1a 100644 --- a/pandas-stubs/core/strings.pyi +++ b/pandas-stubs/core/strings.pyi @@ -1,4 +1,5 @@ # pyright: strict +from builtins import slice as _slice from collections.abc import ( Callable, Sequence, @@ -8,7 +9,6 @@ from typing import ( Any, Generic, Literal, - TypeAlias, TypeVar, overload, ) @@ -47,8 +47,6 @@ _T_STR = TypeVar("_T_STR", bound=Series[str] | Index[str]) # Used for the result of str.partition _T_OBJECT = TypeVar("_T_OBJECT", bound=Series[type[object]] | Index[type[object]]) -_slice: TypeAlias = slice - class StringMethods( NoNewAttributesMixin, Generic[T, _T_EXPANDING, _T_BOOL, _T_LIST_STR, _T_INT, _T_BYTES, _T_STR, _T_OBJECT],