Skip to content

Commit 35fd82b

Browse files
committed
read_clipboard, read_xml
1 parent f74cf98 commit 35fd82b

File tree

13 files changed

+62
-48
lines changed

13 files changed

+62
-48
lines changed

pandas-stubs/__init__.pyi

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ from pandas.io.api import (
112112
ExcelFile as ExcelFile,
113113
ExcelWriter as ExcelWriter,
114114
HDFStore as HDFStore,
115+
read_clipboard as read_clipboard,
115116
read_csv as read_csv,
116117
read_feather as read_feather,
117118
read_fwf as read_fwf,
@@ -123,9 +124,7 @@ from pandas.io.api import (
123124
read_sql_table as read_sql_table,
124125
read_stata as read_stata,
125126
read_table as read_table,
126-
)
127-
from pandas.io.api import (
128-
read_clipboard as read_clipboard, # pyright: ignore[reportUnknownVariableType]
127+
read_xml as read_xml,
129128
)
130129
from pandas.io.api import (
131130
read_excel as read_excel, # pyright: ignore[reportUnknownVariableType]
@@ -145,9 +144,6 @@ from pandas.io.api import (
145144
from pandas.io.api import (
146145
read_sql_query as read_sql_query, # pyright: ignore[reportUnknownVariableType]
147146
)
148-
from pandas.io.api import (
149-
read_xml as read_xml, # pyright: ignore[reportUnknownVariableType]
150-
)
151147
from pandas.io.json._normalize import (
152148
json_normalize as json_normalize, # pyright: ignore[reportUnknownVariableType]
153149
)

pandas-stubs/core/frame.pyi

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,7 +1280,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
12801280
other: DataFrame | Series,
12811281
join: UpdateJoin = "left",
12821282
overwrite: _bool = True,
1283-
filter_func: Callable | None = ...,
1283+
filter_func: Callable[..., Any] | None = ...,
12841284
errors: IgnoreRaise = "ignore",
12851285
) -> None: ...
12861286
@overload
@@ -2334,7 +2334,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
23342334
| Callable[[DataFrame], DataFrame]
23352335
| Callable[[Any], _bool]
23362336
),
2337-
other: Scalar | Series | DataFrame | Callable | NAType | None = ...,
2337+
other: Scalar | Series | DataFrame | Callable[..., Any] | NAType | None = ...,
23382338
*,
23392339
inplace: Literal[True],
23402340
axis: Axis | None = ...,
@@ -2351,7 +2351,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
23512351
| Callable[[DataFrame], DataFrame]
23522352
| Callable[[Any], _bool]
23532353
),
2354-
other: Scalar | Series | DataFrame | Callable | NAType | None = ...,
2354+
other: Scalar | Series | DataFrame | Callable[..., Any] | NAType | None = ...,
23552355
*,
23562356
inplace: Literal[False] = False,
23572357
axis: Axis | None = ...,
@@ -2512,8 +2512,12 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
25122512
def rename_axis(
25132513
self,
25142514
*,
2515-
index: _str | Sequence[_str] | dict[_str | int, _str] | Callable | None = ...,
2516-
columns: _str | Sequence[_str] | dict[_str | int, _str] | Callable | None = ...,
2515+
index: (
2516+
_str | Sequence[_str] | dict[_str | int, _str] | Callable[..., Any] | None
2517+
) = ...,
2518+
columns: (
2519+
_str | Sequence[_str] | dict[_str | int, _str] | Callable[..., Any] | None
2520+
) = ...,
25172521
copy: _bool = ...,
25182522
inplace: Literal[True],
25192523
) -> None: ...
@@ -2522,8 +2526,12 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
25222526
def rename_axis(
25232527
self,
25242528
*,
2525-
index: _str | Sequence[_str] | dict[_str | int, _str] | Callable | None = ...,
2526-
columns: _str | Sequence[_str] | dict[_str | int, _str] | Callable | None = ...,
2529+
index: (
2530+
_str | Sequence[_str] | dict[_str | int, _str] | Callable[..., Any] | None
2531+
) = ...,
2532+
columns: (
2533+
_str | Sequence[_str] | dict[_str | int, _str] | Callable[..., Any] | None
2534+
) = ...,
25272535
copy: _bool = ...,
25282536
inplace: Literal[False] = False,
25292537
) -> Self: ...

pandas-stubs/core/groupby/generic.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ class SeriesGroupBy(GroupBy[Series[S2]], Generic[S2, ByT]):
118118
self, func: TransformReductionListType, *args: Any, **kwargs: Any
119119
) -> Series: ...
120120
def filter(
121-
self, func: Callable | str, dropna: bool = ..., *args: Any, **kwargs: Any
121+
self,
122+
func: Callable[..., Any] | str,
123+
dropna: bool = ...,
124+
*args: Any,
125+
**kwargs: Any,
122126
) -> Series: ...
123127
def nunique(self, dropna: bool = ...) -> Series[int]: ...
124128
# describe delegates to super() method but here it has keyword-only parameters

pandas-stubs/core/groupby/groupby.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ _ResamplerGroupBy: TypeAlias = (
7878

7979
class GroupBy(BaseGroupBy[NDFrameT]):
8080
def __getattr__(self, attr: str) -> Any: ...
81-
def apply(self, func: Callable | str, *args: Any, **kwargs: Any) -> NDFrameT: ...
81+
def apply(
82+
self, func: Callable[..., Any] | str, *args: Any, **kwargs: Any
83+
) -> NDFrameT: ...
8284
@final
8385
@overload
8486
def any(self: GroupBy[Series], skipna: bool = ...) -> Series[bool]: ...

pandas-stubs/core/indexes/base.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,10 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
408408
) -> Self: ...
409409
def copy(self, name: Hashable = ..., deep: bool = False) -> Self: ...
410410
def format(
411-
self, name: bool = ..., formatter: Callable | None = ..., na_rep: _str = ...
411+
self,
412+
name: bool = ...,
413+
formatter: Callable[..., Any] | None = ...,
414+
na_rep: _str = ...,
412415
) -> list[_str]: ...
413416
def to_series(
414417
self, index: Index | None = None, name: Hashable | None = None

pandas-stubs/core/indexes/multi.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class MultiIndex(Index):
9494
def format(
9595
self,
9696
name: bool | None = ...,
97-
formatter: Callable | None = ...,
97+
formatter: Callable[..., Any] | None = ...,
9898
na_rep: str | None = ...,
9999
names: bool = ...,
100100
space: int = ...,

pandas-stubs/core/series.pyi

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,7 +1670,9 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
16701670
| Callable[[Series[S1]], Series[bool]]
16711671
| Callable[[S1], bool]
16721672
),
1673-
other: Scalar | Series[S1] | DataFrame | Callable | NAType | None = ...,
1673+
other: (
1674+
Scalar | Series[S1] | DataFrame | Callable[..., Any] | NAType | None
1675+
) = ...,
16741676
*,
16751677
inplace: Literal[True],
16761678
axis: AxisIndex | None = 0,
@@ -1686,7 +1688,9 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
16861688
| Callable[[Series[S1]], Series[bool]]
16871689
| Callable[[S1], bool]
16881690
),
1689-
other: Scalar | Series[S1] | DataFrame | Callable | NAType | None = ...,
1691+
other: (
1692+
Scalar | Series[S1] | DataFrame | Callable[..., Any] | NAType | None
1693+
) = ...,
16901694
*,
16911695
inplace: Literal[False] = False,
16921696
axis: AxisIndex | None = 0,
@@ -4631,7 +4635,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
46314635
def rename_axis(
46324636
self,
46334637
*,
4634-
index: Scalar | ListLike | Callable | dict | None = ...,
4638+
index: Scalar | ListLike | Callable[..., Any] | dict | None = ...,
46354639
copy: _bool = ...,
46364640
inplace: Literal[True],
46374641
) -> None: ...
@@ -4640,7 +4644,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
46404644
def rename_axis(
46414645
self,
46424646
*,
4643-
index: Scalar | ListLike | Callable | dict | None = ...,
4647+
index: Scalar | ListLike | Callable[..., Any] | dict | None = ...,
46444648
copy: _bool = ...,
46454649
inplace: Literal[False] = False,
46464650
) -> Self: ...

pandas-stubs/io/api.pyi

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
from pandas.io.clipboards import (
2-
read_clipboard as read_clipboard, # pyright: ignore[reportUnknownVariableType]
3-
)
1+
from pandas.io.clipboards import read_clipboard as read_clipboard
42
from pandas.io.excel import (
53
ExcelFile as ExcelFile,
64
ExcelWriter as ExcelWriter,
@@ -43,6 +41,4 @@ from pandas.io.sql import (
4341
read_sql_table as read_sql_table,
4442
)
4543
from pandas.io.stata import read_stata as read_stata
46-
from pandas.io.xml import (
47-
read_xml as read_xml, # pyright: ignore[reportUnknownVariableType]
48-
)
44+
from pandas.io.xml import read_xml as read_xml

pandas-stubs/io/clipboards.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def read_clipboard(
3636
header: int | Sequence[int] | Literal["infer"] | None = ...,
3737
names: ListLikeHashable[Hashable] | None = ...,
3838
index_col: int | str | Sequence[str | int] | Literal[False] | None = ...,
39-
usecols: UsecolsArgType = ...,
39+
usecols: UsecolsArgType[Any] = ...,
4040
dtype: DtypeArg | defaultdict[Hashable, Any] | None = ...,
4141
engine: CSVEngine | None = ...,
4242
converters: dict[int | str, Callable[[str], Any]] = ...,
@@ -60,7 +60,7 @@ def read_clipboard(
6060
) = ...,
6161
infer_datetime_format: bool = ...,
6262
keep_date_col: bool = ...,
63-
date_parser: Callable = ...,
63+
date_parser: Callable[..., Any] = ...,
6464
dayfirst: bool = ...,
6565
cache_dates: bool = ...,
6666
iterator: Literal[True],
@@ -95,7 +95,7 @@ def read_clipboard(
9595
header: int | Sequence[int] | Literal["infer"] | None = ...,
9696
names: ListLikeHashable[Hashable] | None = ...,
9797
index_col: int | str | Sequence[str | int] | Literal[False] | None = ...,
98-
usecols: UsecolsArgType = ...,
98+
usecols: UsecolsArgType[Any] = ...,
9999
dtype: DtypeArg | defaultdict[Hashable, Any] | None = ...,
100100
engine: CSVEngine | None = ...,
101101
converters: dict[int | str, Callable[[str], Any]] = ...,
@@ -119,7 +119,7 @@ def read_clipboard(
119119
) = ...,
120120
infer_datetime_format: bool = ...,
121121
keep_date_col: bool = ...,
122-
date_parser: Callable = ...,
122+
date_parser: Callable[..., Any] = ...,
123123
dayfirst: bool = ...,
124124
cache_dates: bool = ...,
125125
iterator: bool = ...,
@@ -154,7 +154,7 @@ def read_clipboard(
154154
header: int | Sequence[int] | Literal["infer"] | None = ...,
155155
names: ListLikeHashable[Hashable] | None = ...,
156156
index_col: int | str | Sequence[str | int] | Literal[False] | None = ...,
157-
usecols: UsecolsArgType = ...,
157+
usecols: UsecolsArgType[Any] = ...,
158158
dtype: DtypeArg | defaultdict[Hashable, Any] | None = ...,
159159
engine: CSVEngine | None = ...,
160160
converters: dict[int | str, Callable[[str], Any]] = ...,
@@ -178,7 +178,7 @@ def read_clipboard(
178178
) = ...,
179179
infer_datetime_format: bool = ...,
180180
keep_date_col: bool = ...,
181-
date_parser: Callable = ...,
181+
date_parser: Callable[..., Any] = ...,
182182
dayfirst: bool = ...,
183183
cache_dates: bool = ...,
184184
iterator: Literal[False] = False,

pandas-stubs/io/excel/_base.pyi

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def read_excel(
5454
header: int | Sequence[int] | None = ...,
5555
names: ListLikeHashable[Hashable] | None = ...,
5656
index_col: int | Sequence[int] | str | None = ...,
57-
usecols: str | UsecolsArgType = ...,
57+
usecols: str | UsecolsArgType[Any] = ...,
5858
dtype: str | Dtype | Mapping[str, str | Dtype] | None = ...,
5959
engine: ExcelReadEngine | None = ...,
6060
converters: Mapping[int | str, Callable[[Any], Any]] | None = ...,
@@ -97,7 +97,7 @@ def read_excel(
9797
header: int | Sequence[int] | None = ...,
9898
names: ListLikeHashable[Hashable] | None = ...,
9999
index_col: int | Sequence[int] | str | None = ...,
100-
usecols: str | UsecolsArgType = ...,
100+
usecols: str | UsecolsArgType[Any] = ...,
101101
dtype: str | Dtype | Mapping[str, str | Dtype] | None = ...,
102102
engine: ExcelReadEngine | None = ...,
103103
converters: Mapping[int | str, Callable[[Any], Any]] | None = ...,
@@ -141,7 +141,7 @@ def read_excel( # type: ignore[overload-cannot-match]
141141
header: int | Sequence[int] | None = ...,
142142
names: ListLikeHashable[Hashable] | None = ...,
143143
index_col: int | Sequence[int] | str | None = ...,
144-
usecols: str | UsecolsArgType = ...,
144+
usecols: str | UsecolsArgType[Any] = ...,
145145
dtype: str | Dtype | Mapping[str, str | Dtype] | None = ...,
146146
engine: ExcelReadEngine | None = ...,
147147
converters: Mapping[int | str, Callable[[Any], Any]] | None = ...,
@@ -184,7 +184,7 @@ def read_excel(
184184
header: int | Sequence[int] | None = ...,
185185
names: ListLikeHashable[Hashable] | None = ...,
186186
index_col: int | Sequence[int] | str | None = ...,
187-
usecols: str | UsecolsArgType = ...,
187+
usecols: str | UsecolsArgType[Any] = ...,
188188
dtype: str | Dtype | Mapping[str, str | Dtype] | None = ...,
189189
engine: ExcelReadEngine | None = ...,
190190
converters: Mapping[int | str, Callable[[Any], Any]] | None = ...,
@@ -266,7 +266,7 @@ class ExcelFile:
266266
header: int | Sequence[int] | None = ...,
267267
names: ListLikeHashable[Hashable] | None = ...,
268268
index_col: int | Sequence[int] | None = ...,
269-
usecols: str | UsecolsArgType = ...,
269+
usecols: str | UsecolsArgType[Any] = ...,
270270
converters: dict[int | str, Callable[[Any], Any]] | None = ...,
271271
true_values: Iterable[Hashable] | None = ...,
272272
false_values: Iterable[Hashable] | None = ...,
@@ -279,7 +279,7 @@ class ExcelFile:
279279
| Sequence[Sequence[str] | Sequence[int]]
280280
| dict[str, Sequence[int] | list[str]]
281281
) = ...,
282-
date_parser: Callable | None = ...,
282+
date_parser: Callable[..., Any] | None = ...,
283283
thousands: str | None = ...,
284284
comment: str | None = ...,
285285
skipfooter: int = ...,
@@ -294,7 +294,7 @@ class ExcelFile:
294294
header: int | Sequence[int] | None = ...,
295295
names: ListLikeHashable[Hashable] | None = ...,
296296
index_col: int | Sequence[int] | None = ...,
297-
usecols: str | UsecolsArgType = ...,
297+
usecols: str | UsecolsArgType[Any] = ...,
298298
converters: dict[int | str, Callable[[Any], Any]] | None = ...,
299299
true_values: Iterable[Hashable] | None = ...,
300300
false_values: Iterable[Hashable] | None = ...,
@@ -307,7 +307,7 @@ class ExcelFile:
307307
| Sequence[Sequence[str] | Sequence[int]]
308308
| dict[str, Sequence[int] | list[str]]
309309
) = ...,
310-
date_parser: Callable | None = ...,
310+
date_parser: Callable[..., Any] | None = ...,
311311
thousands: str | None = ...,
312312
comment: str | None = ...,
313313
skipfooter: int = ...,

0 commit comments

Comments
 (0)