-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TYP: Enable pyright's reportInconsistentConstructor #54398
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
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 |
---|---|---|
|
@@ -573,7 +573,7 @@ class PeriodProperties(Properties): | |
class CombinedDatetimelikeProperties( | ||
DatetimeProperties, TimedeltaProperties, PeriodProperties | ||
): | ||
def __new__(cls, data: Series): | ||
def __new__(cls, data: Series): # pyright: ignore[reportInconsistentConstructor] | ||
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 parent |
||
# CombinedDatetimelikeProperties isn't really instantiated. Instead | ||
# we need to choose which parent (datetime or timedelta) is | ||
# appropriate. Since we're checking the dtypes anyway, we'll just | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -732,6 +732,7 @@ include = ["pandas", "typings"] | |
exclude = ["pandas/tests", "pandas/io/clipboard", "pandas/util/version"] | ||
# enable subset of "strict" | ||
reportDuplicateImport = true | ||
reportInconsistentConstructor = true | ||
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. In a follow up, could we enable strict mode and then turn off the checks that don't pass (with todos) or are not relevant like we did with mypy? 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. We could enable strict and disable many of its rules (and I think we had that in the past). I think the pyright maintainer recommended that we prioritize enabling reportGeneralTypeIssues (we have a large blacklist in pyright_reportGeneralTypeIssues.json) before enabling strict as it also changes some of its behavior. 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. Okay sounds good |
||
reportInvalidStubStatement = true | ||
reportOverlappingOverload = true | ||
reportPropertyTypeMismatch = true | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# this becomes obsolete when reportGeneralTypeIssues can be enabled in pyproject.toml | ||
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. Pyright uses a stricter JSON parser - comments are not part of the JSON syntax. (There are much newer versions of pyright but there are too many things we would need to change at the moment.) |
||
{ | ||
"typeCheckingMode": "off", | ||
"reportGeneralTypeIssues": true, | ||
|
@@ -9,12 +8,11 @@ | |
], | ||
"exclude": | ||
[ | ||
# exclude tests | ||
"pandas/tests", | ||
# exclude vendored files | ||
|
||
"pandas/io/clipboard", | ||
"pandas/util/version", | ||
# and all files that currently don't pass | ||
|
||
"pandas/_testing/__init__.py", | ||
"pandas/_testing/_hypothesis.py", | ||
"pandas/_testing/_io.py", | ||
|
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.
Should not be needed, just calls the parent constructor (and uses
value
instead ofname
)