Skip to content

Commit ceb17c6

Browse files
committed
Remove typevar
1 parent 8fd8b1f commit ceb17c6

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

pandas/_typing.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484
DatetimeLikeScalar = Union["Period", "Timestamp", "Timedelta"]
8585
PandasScalar = Union["Period", "Timestamp", "Timedelta", "Interval"]
8686
Scalar = Union[PythonScalar, PandasScalar]
87-
IntStrT = TypeVar("IntStrT", int, str)
8887

8988

9089
# timestamp and timedelta convertible types

pandas/io/excel/_base.py

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from pandas._typing import (
2929
DtypeArg,
3030
FilePath,
31-
IntStrT,
3231
ReadBuffer,
3332
StorageOptions,
3433
WriteExcelBuffer,
@@ -387,7 +386,7 @@ def read_excel(
387386
@overload
388387
def read_excel(
389388
io,
390-
sheet_name: list[IntStrT] | None,
389+
sheet_name: list[int],
391390
header: int | Sequence[int] | None = ...,
392391
names=...,
393392
index_col: int | Sequence[int] | None = ...,
@@ -413,15 +412,48 @@ def read_excel(
413412
convert_float: bool | None = ...,
414413
mangle_dupe_cols: bool = ...,
415414
storage_options: StorageOptions = ...,
416-
) -> dict[IntStrT, DataFrame]:
415+
) -> dict[int, DataFrame]:
416+
...
417+
418+
419+
@overload
420+
def read_excel(
421+
io,
422+
sheet_name: list[str] | None,
423+
header: int | Sequence[int] | None = ...,
424+
names=...,
425+
index_col: int | Sequence[int] | None = ...,
426+
usecols=...,
427+
squeeze: bool | None = ...,
428+
dtype: DtypeArg | None = ...,
429+
engine: Literal["xlrd", "openpyxl", "odf", "pyxlsb"] | None = ...,
430+
converters=...,
431+
true_values: Iterable[Hashable] | None = ...,
432+
false_values: Iterable[Hashable] | None = ...,
433+
skiprows: Sequence[int] | int | Callable[[int], object] | None = ...,
434+
nrows: int | None = ...,
435+
na_values=...,
436+
keep_default_na: bool = ...,
437+
na_filter: bool = ...,
438+
verbose: bool = ...,
439+
parse_dates=...,
440+
date_parser=...,
441+
thousands: str | None = ...,
442+
decimal: str = ...,
443+
comment: str | None = ...,
444+
skipfooter: int = ...,
445+
convert_float: bool | None = ...,
446+
mangle_dupe_cols: bool = ...,
447+
storage_options: StorageOptions = ...,
448+
) -> dict[str, DataFrame]:
417449
...
418450

419451

420452
@deprecate_nonkeyword_arguments(allowed_args=["io", "sheet_name"], version="2.0")
421453
@Appender(_read_excel_doc)
422454
def read_excel(
423455
io,
424-
sheet_name: str | int | list[IntStrT] | None = 0,
456+
sheet_name: str | int | list[int] | list[str] | None = 0,
425457
header: int | Sequence[int] | None = 0,
426458
names=None,
427459
index_col: int | Sequence[int] | None = None,
@@ -447,7 +479,7 @@ def read_excel(
447479
convert_float: bool | None = None,
448480
mangle_dupe_cols: bool = True,
449481
storage_options: StorageOptions = None,
450-
) -> DataFrame | dict[IntStrT, DataFrame]:
482+
) -> DataFrame | dict[int, DataFrame] | dict[str, DataFrame]:
451483

452484
should_close = False
453485
if not isinstance(io, ExcelFile):

0 commit comments

Comments
 (0)