Skip to content

Commit fd65ab4

Browse files
authored
TYP: Fix wrong type annotations in pytables (#45028)
1 parent 195a068 commit fd65ab4

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

pandas/core/generic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2625,7 +2625,7 @@ def to_hdf(
26252625
min_itemsize: int | dict[str, int] | None = None,
26262626
nan_rep=None,
26272627
dropna: bool_t | None = None,
2628-
data_columns: bool_t | list[str] | None = None,
2628+
data_columns: Literal[True] | list[str] | None = None,
26292629
errors: str = "strict",
26302630
encoding: str = "UTF-8",
26312631
) -> None:

pandas/io/pytables.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
Any,
2020
Callable,
2121
Hashable,
22+
Literal,
2223
Sequence,
2324
cast,
2425
)
@@ -272,7 +273,7 @@ def to_hdf(
272273
min_itemsize: int | dict[str, int] | None = None,
273274
nan_rep=None,
274275
dropna: bool | None = None,
275-
data_columns: bool | list[str] | None = None,
276+
data_columns: Literal[True] | list[str] | None = None,
276277
errors: str = "strict",
277278
encoding: str = "UTF-8",
278279
) -> None:
@@ -1078,7 +1079,7 @@ def put(
10781079
complevel: int | None = None,
10791080
min_itemsize: int | dict[str, int] | None = None,
10801081
nan_rep=None,
1081-
data_columns: list[str] | None = None,
1082+
data_columns: Literal[True] | list[str] | None = None,
10821083
encoding=None,
10831084
errors: str = "strict",
10841085
track_times: bool = True,
@@ -1102,7 +1103,7 @@ def put(
11021103
subsets of the data.
11031104
append : bool, default False
11041105
This will force Table format, append the input data to the existing.
1105-
data_columns : list, default None
1106+
data_columns : list of columns or True, default None
11061107
List of columns to create as data columns, or True to use all columns.
11071108
See `here
11081109
<https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#query-via-data-columns>`__.
@@ -1208,7 +1209,7 @@ def append(
12081209
chunksize=None,
12091210
expectedrows=None,
12101211
dropna: bool | None = None,
1211-
data_columns: list[str] | None = None,
1212+
data_columns: Literal[True] | list[str] | None = None,
12121213
encoding=None,
12131214
errors: str = "strict",
12141215
):
@@ -3263,8 +3264,7 @@ class Table(Fixed):
32633264
values_axes : a list of the columns which comprise the data of this
32643265
table
32653266
data_columns : a list of the columns that we are allowing indexing
3266-
(these become single columns in values_axes), or True to force all
3267-
columns
3267+
(these become single columns in values_axes)
32683268
nan_rep : the string to use for nan representations for string
32693269
objects
32703270
levels : the names of levels

0 commit comments

Comments
 (0)