-
-
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 3 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: Sequence[str]) -> PandasDataFrameXchg: | ||
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 would allow 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. I don't think so. I think it's intended to accept a list-like of strings, but I just matched the base class here. Thoughts? 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. If you only want to accept a list of strings, you have to use |
||
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 |
---|---|---|
|
@@ -215,7 +215,7 @@ def to_gbq( | |
table_schema: list[dict[str, str]] | None = None, | ||
location: str | None = None, | ||
progress_bar: bool = True, | ||
credentials=None, | ||
credentials: Any = None, | ||
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. The documentation says, it needs to be 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. (but if the CI doesn't install the package, there is not much benefit of importing it in a TYPE_CHECKING block.) |
||
) -> None: | ||
pandas_gbq = _try_import() | ||
pandas_gbq.to_gbq( | ||
|
Uh oh!
There was an error while loading. Please reload this page.