-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
CI/TYP: enable reportGeneralTypeIssues for subset of files #47252
Conversation
pandas/util/_doctools.py
Outdated
@@ -41,7 +43,7 @@ def _get_cells(self, left, right, vertical) -> tuple[int, int]: | |||
hcells = sum([self._shape(df)[1] for df in left] + [self._shape(right)[1]]) | |||
return hcells, vcells | |||
|
|||
def plot(self, left, right, labels=None, vertical: bool = True): | |||
def plot(self, left, right, labels: Sequence[str] = (), vertical: bool = True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😱
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, it could even be Iterable[str] (only used within zip). And yes a string is okay for this function :)
Changed the default value as there is no check whether labels is None. Would raise if labels is not provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to Iterable[str]
(still contains str and even scarier types)
@@ -26,7 +27,7 @@ from enum import Enum | |||
class _NoDefault(Enum): | |||
no_default = ... | |||
|
|||
no_default = _NoDefault.no_default | |||
no_default: Final = _NoDefault.no_default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed for pyright see microsoft/pyright#3546 (comment)
If we encounter pyright errors in the future that are difficult to fix but not reported by mypy, we have a few options:
As long as the exclude list is long, I would simply add the entire file to the exclude list. Once the exclude list becomes reasonably small, we could transition to using line-based comments (currently we would need to add ~650 line-based comments) and merge the two pyright configurations (pyproject.toml and pyright_reportGeneralTypeIssues.json). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @twoertwein LGTM
this is fine (also how we did check_untyped_defs for mypy, start with a file based exclude list, then inline the excludes to turn on globally once had reduced considerably)
* TYP: remove mypy ignore from localization.py * fixup! TYP: remove mypy ignore from localization.py
Thanks @twoertwein. Would be great to create an issue to tackle the typing issues in the config file |
…v#47252) * CI/TYP: enable reportGeneralTypeIssues for subset of files * labels can be Iterable[str] * fix no_default * specify pyright version only once * TYP: remove mypy ignore from localization.py (pandas-dev#47240) * TYP: remove mypy ignore from localization.py * fixup! TYP: remove mypy ignore from localization.py * specify pyright version only once * bump pyright * Update pyright_reportGeneralTypeIssues.json Co-authored-by: Thierry Moisan <[email protected]> Co-authored-by: Matthew Roeschke <[email protected]>
Second attempt at enabling pyright's most important type checking rule (reportGeneralTypeIssues). Instead of having many file-based ignores as in #44855, this PR adds a second pyright configuration file just for reportGeneralTypeIssues and lists all excluded file in this one config file.