-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Use python-typing-update
on pylint/pyreverse
directory
#6309
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 | ||||
---|---|---|---|---|---|---|
|
@@ -2,8 +2,10 @@ | |||||
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE | ||||||
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt | ||||||
|
||||||
from __future__ import annotations | ||||||
|
||||||
import collections | ||||||
from typing import Optional, Tuple, Union, overload | ||||||
from typing import overload | ||||||
from warnings import warn | ||||||
|
||||||
from pylint.constants import MSG_TYPES | ||||||
|
@@ -41,33 +43,30 @@ def __new__( | |||||
symbol: str, | ||||||
location: MessageLocationTuple, | ||||||
msg: str, | ||||||
confidence: Optional[Confidence], | ||||||
) -> "Message": | ||||||
confidence: Confidence | None, | ||||||
) -> Message: | ||||||
... | ||||||
|
||||||
@overload | ||||||
def __new__( | ||||||
cls, | ||||||
msg_id: str, | ||||||
symbol: str, | ||||||
location: Tuple[str, str, str, str, int, int], | ||||||
location: tuple[str, str, str, str, int, int], | ||||||
msg: str, | ||||||
confidence: Optional[Confidence], | ||||||
) -> "Message": | ||||||
confidence: Confidence | None, | ||||||
) -> Message: | ||||||
# Remove for pylint 3.0 | ||||||
... | ||||||
|
||||||
def __new__( | ||||||
cls, | ||||||
msg_id: str, | ||||||
symbol: str, | ||||||
location: Union[ | ||||||
Tuple[str, str, str, str, int, int], | ||||||
MessageLocationTuple, | ||||||
], | ||||||
location: (tuple[str, str, str, str, int, int] | MessageLocationTuple), | ||||||
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.
Suggested change
Could we do this ? It seems those should be the same thing. 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. No, see the deprecation warning a couple of lines below. 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 brackets could have been removed here though. - location: (tuple[str, str, str, str, int, int] | MessageLocationTuple),
+ location: tuple[str, str, str, str, int, int] | MessageLocationTuple, 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. Added in follow-up! |
||||||
msg: str, | ||||||
confidence: Optional[Confidence], | ||||||
) -> "Message": | ||||||
confidence: Confidence | None, | ||||||
) -> Message: | ||||||
if not isinstance(location, MessageLocationTuple): | ||||||
warn( | ||||||
"In pylint 3.0, Messages will only accept a MessageLocationTuple as location parameter", | ||||||
|
@@ -82,7 +81,7 @@ def __new__( | |||||
msg_id[0], | ||||||
MSG_TYPES[msg_id[0]], | ||||||
confidence, | ||||||
*location | ||||||
*location, | ||||||
) | ||||||
|
||||||
def format(self, template: str) -> str: | ||||||
|
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.
(🤞 ?)