diff options
Diffstat (limited to 'pylint/utils/file_state.py')
-rw-r--r-- | pylint/utils/file_state.py | 46 |
1 files changed, 4 insertions, 42 deletions
diff --git a/pylint/utils/file_state.py b/pylint/utils/file_state.py index 19122b373..54b98e4be 100644 --- a/pylint/utils/file_state.py +++ b/pylint/utils/file_state.py @@ -1,12 +1,11 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations import collections import sys -import warnings from collections import defaultdict from collections.abc import Iterator from typing import TYPE_CHECKING, Dict @@ -36,26 +35,12 @@ class FileState: def __init__( self, - modname: str | None = None, - msg_store: MessageDefinitionStore | None = None, + modname: str, + msg_store: MessageDefinitionStore, node: nodes.Module | None = None, *, is_base_filestate: bool = False, ) -> None: - if modname is None: - warnings.warn( - "FileState needs a string as modname argument. " - "This argument will be required in pylint 3.0", - DeprecationWarning, - stacklevel=2, - ) - if msg_store is None: - warnings.warn( - "FileState needs a 'MessageDefinitionStore' as msg_store argument. " - "This argument will be required in pylint 3.0", - DeprecationWarning, - stacklevel=2, - ) self.base_name = modname self._module_msgs_state: MessageStateDict = {} self._raw_module_msgs_state: MessageStateDict = {} @@ -74,25 +59,6 @@ class FileState: PyLinter. """ - def collect_block_lines( - self, msgs_store: MessageDefinitionStore, module_node: nodes.Module - ) -> None: - """Walk the AST to collect block level options line numbers.""" - warnings.warn( - "'collect_block_lines' has been deprecated and will be removed in pylint 3.0.", - DeprecationWarning, - stacklevel=2, - ) - for msg, lines in self._module_msgs_state.items(): - self._raw_module_msgs_state[msg] = lines.copy() - orig_state = self._module_msgs_state.copy() - self._module_msgs_state = {} - self._suppression_mapping = {} - self._effective_max_line_number = module_node.tolineno - for msgid, lines in orig_state.items(): - for msgdef in msgs_store.get_message_definitions(msgid): - self._set_state_on_block_lines(msgs_store, module_node, msgdef, lines) - def _set_state_on_block_lines( self, msgs_store: MessageDefinitionStore, @@ -230,10 +196,6 @@ class FileState: ) -> None: """Set status (enabled/disable) for a given message at a given line.""" assert line > 0 - assert self._module - # TODO: 3.0: Remove unnecessary assertion - assert self._msgs_store - if scope != "line": # Expand the status to cover all relevant block lines self._set_state_on_block_lines( |