summaryrefslogtreecommitdiff
path: root/pylint/message/message_id_store.py
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-05-31 20:00:53 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-06-02 13:13:01 +0200
commitec78b15c76af6eb41964f624769d115c5796112e (patch)
tree799274f097919b250e157ba7b918b216aba94bbf /pylint/message/message_id_store.py
parent35a030ea6052d83f2d325868af850f3b26bb53f3 (diff)
downloadpylint-git-ec78b15c76af6eb41964f624769d115c5796112e.tar.gz
Refactor register_message_definition to prevent circular import
Diffstat (limited to 'pylint/message/message_id_store.py')
-rw-r--r--pylint/message/message_id_store.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/pylint/message/message_id_store.py b/pylint/message/message_id_store.py
index 0530b1026..98dd0a587 100644
--- a/pylint/message/message_id_store.py
+++ b/pylint/message/message_id_store.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/LICENSE
-from typing import Dict, List, Optional
+from typing import Dict, List, Optional, Tuple
from pylint.exceptions import InvalidMessageError, UnknownMessageError
@@ -38,14 +38,14 @@ class MessageIdStore:
msg = f"'{symbol}' is not stored in the message store."
raise UnknownMessageError(msg) from e
- def register_message_definition(self, message_definition):
- self.check_msgid_and_symbol(message_definition.msgid, message_definition.symbol)
- self.add_msgid_and_symbol(message_definition.msgid, message_definition.symbol)
- for old_msgid, old_symbol in message_definition.old_names:
+ def register_message_definition(
+ self, msgid: str, symbol: str, old_names: List[Tuple[str, str]]
+ ):
+ self.check_msgid_and_symbol(msgid, symbol)
+ self.add_msgid_and_symbol(msgid, symbol)
+ for old_msgid, old_symbol in old_names:
self.check_msgid_and_symbol(old_msgid, old_symbol)
- self.add_legacy_msgid_and_symbol(
- old_msgid, old_symbol, message_definition.msgid
- )
+ self.add_legacy_msgid_and_symbol(old_msgid, old_symbol, msgid)
def add_msgid_and_symbol(self, msgid: str, symbol: str) -> None:
"""Add valid message id.