-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Check for unused pyright: ignore
and differentiate from mypy ignores
#9397
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 1 commit
af804b6
a2e8a20
70ee787
2d374cb
7e02f34
035fd4e
9112e14
f1264a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Prevent type: ignore[*] comments from supressing all pyright errors Added more comments to pyright config
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -328,15 +328,15 @@ class _OrderedDictValuesView(ValuesView[_VT_co], Reversible[_VT_co]): | |||||||
# (At runtime, these are called `odict_keys`, `odict_items` and `odict_values`, | ||||||||
# but they are not exposed anywhere) | ||||||||
@final | ||||||||
class _odict_keys(dict_keys[_KT_co, _VT_co], Reversible[_KT_co]): # type: ignore[misc] | ||||||||
class _odict_keys(dict_keys[_KT_co, _VT_co], Reversible[_KT_co]): # type: ignore[misc] # pyright: ignore | ||||||||
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. Are we able to add the pyright error codes for these 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.
There was a problem hiding this comment. Choose a reason for hiding this comment F438The reason will be displayed to describe this comment to others. Learn more. Oh, strange! In that case, can we leave a comment to that effect? (Same below for the other one)
Suggested change
|
||||||||
def __reversed__(self) -> Iterator[_KT_co]: ... | ||||||||
|
||||||||
@final | ||||||||
class _odict_items(dict_items[_KT_co, _VT_co], Reversible[tuple[_KT_co, _VT_co]]): # type: ignore[misc] | ||||||||
class _odict_items(dict_items[_KT_co, _VT_co], Reversible[tuple[_KT_co, _VT_co]]): # type: ignore[misc] # pyright: ignore | ||||||||
def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ... | ||||||||
|
||||||||
@final | ||||||||
class _odict_values(dict_values[_KT_co, _VT_co], Reversible[_VT_co], Generic[_KT_co, _VT_co]): # type: ignore[misc] | ||||||||
class _odict_values(dict_values[_KT_co, _VT_co], Reversible[_VT_co], Generic[_KT_co, _VT_co]): # type: ignore[misc] # pyright: ignore | ||||||||
def __reversed__(self) -> Iterator[_VT_co]: ... | ||||||||
|
||||||||
class OrderedDict(dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]): | ||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ class DebugDocumentProvider(gateways.DebugDocumentProvider): | |
def GetDocument(self): ... | ||
|
||
# error: Cannot determine consistent method resolution order (MRO) for "DebugDocumentText" | ||
class DebugDocumentText(gateways.DebugDocumentInfo, gateways.DebugDocumentText, gateways.DebugDocument): # type: ignore[misc] | ||
class DebugDocumentText(gateways.DebugDocumentInfo, gateways.DebugDocumentText, gateways.DebugDocument): # type: ignore[misc] # pyright: ignore | ||
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. Which pyright error are we ignoring here? Can we add the error code? 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. Same as above, no code, and if iirc, this does fail at runtime. I had already added a comment to explain the ignore.
I could create a feature request with pyright to add a code for "will fail at runtime". But this should rather be fixed upstream (and pywin32 already has accepted a couple fixes I found through type-checking). And for the other case above, it's kindof a niche type-stub use-case, and is totally fixable by splitting off into another private/internal protocol (which I didn't do to keep changes minimal) |
||
codeContainer: Incomplete | ||
def __init__(self, codeContainer) -> None: ... | ||
def GetName(self, dnt): ... | ||
|
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.
Unrelated to your PR but we should probably revisit this and see if it actually makes things better for all type checkers.