-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TYP: Enable mypy stricter typing for defs/calls #54271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4b8a90a
d8f8b7b
b239018
c615a8b
05b3a3b
8586b56
1df3c4c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,11 @@ | |
from pandas.core.interchange.dataframe_protocol import DataFrame as DataFrameXchg | ||
|
||
if TYPE_CHECKING: | ||
from collections.abc import ( | ||
Iterable, | ||
Sequence, | ||
) | ||
|
||
from pandas import ( | ||
DataFrame, | ||
Index, | ||
|
@@ -72,7 +77,7 @@ def get_columns(self) -> list[PandasColumn]: | |
for name in self._df.columns | ||
] | ||
|
||
def select_columns(self, indices) -> PandasDataFrameXchg: | ||
def select_columns(self, indices: Sequence[int]) -> PandasDataFrameXchg: | ||
if not isinstance(indices, abc.Sequence): | ||
raise ValueError("`indices` is not a sequence") | ||
if not isinstance(indices, list): | ||
|
@@ -82,7 +87,7 @@ def select_columns(self, indices) -> PandasDataFrameXchg: | |
self._df.iloc[:, indices], self._nan_as_null, self._allow_copy | ||
) | ||
|
||
def select_columns_by_name(self, names) -> PandasDataFrameXchg: | ||
def select_columns_by_name(self, names: list[str]) -> PandasDataFrameXchg: # type: ignore[override] # noqa: E501 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is pretty interesting that you have to do the override. In some sense, the method There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah this might be an oversight on the original spec. I opened an issue regarding this data-apis/dataframe-api#212 |
||
if not isinstance(names, abc.Sequence): | ||
raise ValueError("`names` is not a sequence") | ||
if not isinstance(names, list): | ||
|
@@ -92,7 +97,7 @@ def select_columns_by_name(self, names) -> PandasDataFrameXchg: | |
self._df.loc[:, names], self._nan_as_null, self._allow_copy | ||
) | ||
|
||
def get_chunks(self, n_chunks: int | None = None): | ||
def get_chunks(self, n_chunks: int | None = None) -> Iterable[PandasDataFrameXchg]: | ||
""" | ||
Return an iterator yielding the chunks. | ||
""" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,7 @@ tokenize-rt | |
pre-commit>=2.15.0 | ||
gitpython | ||
gitdb | ||
google-auth | ||
natsort | ||
numpydoc | ||
pydata-sphinx-theme | ||
|
Uh oh!
There was an error while loading. Please reload this page.