diff options
author | Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> | 2022-04-14 10:58:45 +0200 |
---|---|---|
committer | Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> | 2022-04-14 11:21:58 +0200 |
commit | 5bff0d8a54a803bd24d9bce49e271af46fee5935 (patch) | |
tree | 671bce4705bab05bb545e75e763ef50da102cc55 /pylint/message | |
parent | 47e168cf607e2069b103fc466edfe1c6522e2fb2 (diff) | |
download | pylint-git-5bff0d8a54a803bd24d9bce49e271af46fee5935.tar.gz |
Use ``python-typing-update`` on ``pylint/pyreverse`` directory
Diffstat (limited to 'pylint/message')
-rw-r--r-- | pylint/message/message.py | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/pylint/message/message.py b/pylint/message/message.py index 297442e45..afe10f7f3 100644 --- a/pylint/message/message.py +++ b/pylint/message/message.py @@ -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,8 +43,8 @@ class Message(_MsgBase): symbol: str, location: MessageLocationTuple, msg: str, - confidence: Optional[Confidence], - ) -> "Message": + confidence: Confidence | None, + ) -> Message: ... @overload @@ -50,10 +52,10 @@ class Message(_MsgBase): 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 ... @@ -61,13 +63,10 @@ class Message(_MsgBase): 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), 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 @@ class Message(_MsgBase): msg_id[0], MSG_TYPES[msg_id[0]], confidence, - *location + *location, ) def format(self, template: str) -> str: |