diff options
author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2022-04-11 14:49:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-11 14:49:03 +0200 |
commit | 7d079d20a525548d48812eb4b452b66c5d76dcca (patch) | |
tree | a2fe8fb8ff22fe45362bb3c1525b221227a1b4c0 /pylint | |
parent | e4c7f4a6a24e187cca3474f8fd98a89c6f8a5560 (diff) | |
download | pylint-git-7d079d20a525548d48812eb4b452b66c5d76dcca.tar.gz |
Remove the ``future_option_parsing`` keyword (#6253)
Diffstat (limited to 'pylint')
24 files changed, 11 insertions, 75 deletions
diff --git a/pylint/checkers/async.py b/pylint/checkers/async.py index d9a9232f7..1615dc82e 100644 --- a/pylint/checkers/async.py +++ b/pylint/checkers/async.py @@ -38,9 +38,6 @@ class AsyncChecker(checkers.BaseChecker): ), } - def __init__(self, linter: "PyLinter") -> None: - super().__init__(linter, future_option_parsing=True) - def open(self): self._mixin_class_rgx = utils.get_global_option(self, "mixin-class-rgx") self._async_generators = ["contextlib.asynccontextmanager"] diff --git a/pylint/checkers/base/docstring_checker.py b/pylint/checkers/base/docstring_checker.py index fd2d8a0ae..1f82cf5ff 100644 --- a/pylint/checkers/base/docstring_checker.py +++ b/pylint/checkers/base/docstring_checker.py @@ -101,11 +101,6 @@ class DocStringChecker(_BasicChecker): ), ) - def __init__( - self, linter=None, *, future_option_parsing: Literal[None, True] = None - ): - _BasicChecker.__init__(self, linter, future_option_parsing=True) - def open(self): self.linter.stats.reset_undocumented() diff --git a/pylint/checkers/base_checker.py b/pylint/checkers/base_checker.py index cc8b7331e..1d056b7d0 100644 --- a/pylint/checkers/base_checker.py +++ b/pylint/checkers/base_checker.py @@ -3,7 +3,6 @@ # Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt import functools -import sys from inspect import cleandoc from typing import TYPE_CHECKING, Any, Optional @@ -11,7 +10,6 @@ from astroid import nodes from pylint.config import OptionsProviderMixIn from pylint.config.arguments_provider import _ArgumentsProvider -from pylint.config.exceptions import MissingArgumentManager from pylint.constants import _MSG_ORDER, WarningScope from pylint.exceptions import InvalidMessageError from pylint.interfaces import Confidence, IRawChecker, ITokenChecker, implements @@ -19,11 +17,6 @@ from pylint.message.message_definition import MessageDefinition from pylint.typing import Options from pylint.utils import get_rst_section, get_rst_title -if sys.version_info >= (3, 8): - from typing import Literal -else: - from typing_extensions import Literal - if TYPE_CHECKING: from pylint.lint import PyLinter @@ -44,22 +37,14 @@ class BaseChecker(_ArgumentsProvider, OptionsProviderMixIn): # mark this checker as enabled or not. enabled: bool = True - def __init__( - self, linter: "PyLinter", *, future_option_parsing: Literal[None, True] = None - ): + def __init__(self, linter: "PyLinter") -> None: """Checker instances should have the linter as argument.""" if self.name is not None: self.name = self.name.lower() + _ArgumentsProvider.__init__(self, linter) self.linter = linter OptionsProviderMixIn.__init__(self) - if future_option_parsing: - # We need a PyLinter object that subclasses _ArgumentsManager to register options - if not linter: - raise MissingArgumentManager - - _ArgumentsProvider.__init__(self, linter) - def __gt__(self, other): """Permit to sort a list of Checker by name.""" return f"{self.name}{self.msgs}" > f"{other.name}{other.msgs}" diff --git a/pylint/checkers/classes/class_checker.py b/pylint/checkers/classes/class_checker.py index cc6a10958..40d806d75 100644 --- a/pylint/checkers/classes/class_checker.py +++ b/pylint/checkers/classes/class_checker.py @@ -766,7 +766,7 @@ a metaclass class method.", ) def __init__(self, linter=None): - super().__init__(linter, future_option_parsing=True) + super().__init__(linter) self._accessed = ScopeAccessMap() self._first_attrs = [] self._meth_could_be_func = None diff --git a/pylint/checkers/design_analysis.py b/pylint/checkers/design_analysis.py index 3a1de4016..eb1477ccb 100644 --- a/pylint/checkers/design_analysis.py +++ b/pylint/checkers/design_analysis.py @@ -403,7 +403,7 @@ class MisdesignChecker(BaseChecker): ) def __init__(self, linter=None): - super().__init__(linter, future_option_parsing=True) + super().__init__(linter) self._returns = None self._branches = None self._stmts = None diff --git a/pylint/checkers/exceptions.py b/pylint/checkers/exceptions.py index 6016320b3..e9ed41830 100644 --- a/pylint/checkers/exceptions.py +++ b/pylint/checkers/exceptions.py @@ -245,9 +245,6 @@ class ExceptionsChecker(checkers.BaseChecker): ), ) - def __init__(self, linter: "PyLinter") -> None: - super().__init__(linter, future_option_parsing=True) - def open(self): self._builtin_exceptions = _builtin_exceptions() super().open() diff --git a/pylint/checkers/format.py b/pylint/checkers/format.py index 150d95f1f..da203d35c 100644 --- a/pylint/checkers/format.py +++ b/pylint/checkers/format.py @@ -301,7 +301,7 @@ class FormatChecker(BaseTokenChecker): ) def __init__(self, linter=None): - super().__init__(linter, future_option_parsing=True) + super().__init__(linter) self._lines = None self._visited_lines = None self._bracket_stack = [None] diff --git a/pylint/checkers/imports.py b/pylint/checkers/imports.py index 1a23b7947..567f675b4 100644 --- a/pylint/checkers/imports.py +++ b/pylint/checkers/imports.py @@ -384,7 +384,7 @@ class ImportsChecker(DeprecatedMixin, BaseChecker): ) def __init__(self, linter: "PyLinter") -> None: - BaseChecker.__init__(self, linter, future_option_parsing=True) + BaseChecker.__init__(self, linter) self.import_graph: collections.defaultdict = collections.defaultdict(set) self._imports_stack: List[Tuple[Any, Any]] = [] self._first_non_import_node = None diff --git a/pylint/checkers/logging.py b/pylint/checkers/logging.py index d9d73d3c1..83b838ad4 100644 --- a/pylint/checkers/logging.py +++ b/pylint/checkers/logging.py @@ -144,9 +144,6 @@ class LoggingChecker(checkers.BaseChecker): ), ) - def __init__(self, linter: "PyLinter") -> None: - super().__init__(linter=linter, future_option_parsing=True) - def visit_module(self, _: nodes.Module) -> None: """Clears any state left in this checker from last module checked.""" # The code being checked can just as easily "import logging as foo", diff --git a/pylint/checkers/misc.py b/pylint/checkers/misc.py index 75ed50600..755ee2742 100644 --- a/pylint/checkers/misc.py +++ b/pylint/checkers/misc.py @@ -96,9 +96,6 @@ class EncodingChecker(BaseChecker): ), ) - def __init__(self, linter: "PyLinter") -> None: - super().__init__(linter, future_option_parsing=True) - def open(self): super().open() diff --git a/pylint/checkers/raw_metrics.py b/pylint/checkers/raw_metrics.py index 524ecbf85..64d6cfb80 100644 --- a/pylint/checkers/raw_metrics.py +++ b/pylint/checkers/raw_metrics.py @@ -67,9 +67,6 @@ class RawMetricsChecker(BaseTokenChecker): # reports reports = (("RP0701", "Raw metrics", report_raw_stats),) - def __init__(self, linter): - super().__init__(linter) - def open(self): """Init statistics.""" self.linter.stats.reset_code_count() diff --git a/pylint/checkers/refactoring/refactoring_checker.py b/pylint/checkers/refactoring/refactoring_checker.py index 828fb7cdb..ce35af30d 100644 --- a/pylint/checkers/refactoring/refactoring_checker.py +++ b/pylint/checkers/refactoring/refactoring_checker.py @@ -471,7 +471,7 @@ class RefactoringChecker(checkers.BaseTokenChecker): ) def __init__(self, linter): - super().__init__(linter, future_option_parsing=True) + super().__init__(linter) self._return_nodes = {} self._consider_using_with_stack = ConsiderUsingWithStack() self._init() diff --git a/pylint/checkers/similar.py b/pylint/checkers/similar.py index 1747e21c2..b5075e8ee 100644 --- a/pylint/checkers/similar.py +++ b/pylint/checkers/similar.py @@ -782,7 +782,7 @@ class SimilarChecker(BaseChecker, Similar, MapReduceMixin): reports = (("RP0801", "Duplication", report_similarities),) def __init__(self, linter=None) -> None: - BaseChecker.__init__(self, linter, future_option_parsing=True) + BaseChecker.__init__(self, linter) Similar.__init__( self, min_lines=self.linter.namespace.min_similarity_lines, diff --git a/pylint/checkers/spelling.py b/pylint/checkers/spelling.py index 272fa06d6..4cd2e3f1a 100644 --- a/pylint/checkers/spelling.py +++ b/pylint/checkers/spelling.py @@ -263,9 +263,6 @@ class SpellingChecker(BaseTokenChecker): ), ) - def __init__(self, linter: "PyLinter") -> None: - super().__init__(linter, future_option_parsing=True) - def open(self): self.initialized = False self.private_dict_file = None diff --git a/pylint/checkers/strings.py b/pylint/checkers/strings.py index fba86d797..1d447032c 100644 --- a/pylint/checkers/strings.py +++ b/pylint/checkers/strings.py @@ -689,7 +689,7 @@ class StringConstantChecker(BaseTokenChecker): UNICODE_ESCAPE_CHARACTERS = "uUN" def __init__(self, linter): - super().__init__(linter, future_option_parsing=True) + super().__init__(linter) self.string_tokens = {} # token position -> (token value, next token) def process_module(self, node: nodes.Module) -> None: diff --git a/pylint/checkers/typecheck.py b/pylint/checkers/typecheck.py index 5b3c6a372..0eccb7b11 100644 --- a/pylint/checkers/typecheck.py +++ b/pylint/checkers/typecheck.py @@ -897,9 +897,6 @@ accessed. Python regular expressions are accepted.", ), ) - def __init__(self, linter: "PyLinter") -> None: - super().__init__(linter, future_option_parsing=True) - def open(self) -> None: py_version = get_global_option(self, "py-version") self._py310_plus = py_version >= (3, 10) @@ -2030,9 +2027,6 @@ class IterableChecker(BaseChecker): ), } - def __init__(self, linter: "PyLinter") -> None: - super().__init__(linter, future_option_parsing=True) - @staticmethod def _is_asyncio_coroutine(node): if not isinstance(node, nodes.Call): diff --git a/pylint/config/exceptions.py b/pylint/config/exceptions.py index d66318fed..25de13910 100644 --- a/pylint/config/exceptions.py +++ b/pylint/config/exceptions.py @@ -9,9 +9,5 @@ class UnrecognizedArgumentAction(Exception): """ -class MissingArgumentManager(Exception): - """Raised if an ArgumentManager instance to register options to is missing.""" - - class ArgumentPreprocessingError(Exception): """Raised if an error occurs during argument preprocessing.""" diff --git a/pylint/extensions/bad_builtin.py b/pylint/extensions/bad_builtin.py index b3b3c7bdc..816460756 100644 --- a/pylint/extensions/bad_builtin.py +++ b/pylint/extensions/bad_builtin.py @@ -48,9 +48,6 @@ class BadBuiltinChecker(BaseChecker): ), ) - def __init__(self, linter: "PyLinter") -> None: - super().__init__(linter, future_option_parsing=True) - @check_messages("bad-builtin") def visit_call(self, node: nodes.Call) -> None: if isinstance(node.func, nodes.Name): diff --git a/pylint/extensions/broad_try_clause.py b/pylint/extensions/broad_try_clause.py index 1a8702c78..7bd5b4f82 100644 --- a/pylint/extensions/broad_try_clause.py +++ b/pylint/extensions/broad_try_clause.py @@ -46,9 +46,6 @@ class BroadTryClauseChecker(checkers.BaseChecker): ), ) - def __init__(self, linter: "PyLinter") -> None: - super().__init__(linter, future_option_parsing=True) - def _count_statements(self, try_node): statement_count = len(try_node.body) diff --git a/pylint/extensions/code_style.py b/pylint/extensions/code_style.py index 618297dd3..7c254ecd3 100644 --- a/pylint/extensions/code_style.py +++ b/pylint/extensions/code_style.py @@ -78,10 +78,6 @@ class CodeStyleChecker(BaseChecker): ), ) - def __init__(self, linter: "PyLinter") -> None: - """Initialize checker instance.""" - super().__init__(linter=linter, future_option_parsing=True) - def open(self) -> None: py_version = get_global_option(self, "py-version") self._py38_plus = py_version >= (3, 8) diff --git a/pylint/extensions/docparams.py b/pylint/extensions/docparams.py index 0a28dd004..2a9fa13f4 100644 --- a/pylint/extensions/docparams.py +++ b/pylint/extensions/docparams.py @@ -190,9 +190,6 @@ class DocstringParameterChecker(BaseChecker): constructor_names = {"__init__", "__new__"} not_needed_param_in_docstring = {"self", "cls"} - def __init__(self, linter: "PyLinter") -> None: - super().__init__(linter, future_option_parsing=True) - def visit_functiondef(self, node: nodes.FunctionDef) -> None: """Called for function and method definitions (def). diff --git a/pylint/extensions/mccabe.py b/pylint/extensions/mccabe.py index 8c2b96d1b..568de796d 100644 --- a/pylint/extensions/mccabe.py +++ b/pylint/extensions/mccabe.py @@ -169,9 +169,6 @@ class McCabeMethodChecker(checkers.BaseChecker): ), ) - def __init__(self, linter: "PyLinter") -> None: - super().__init__(linter, future_option_parsing=True) - @check_messages("too-complex") def visit_module(self, node: nodes.Module) -> None: """Visit an astroid.Module node to check too complex rating and diff --git a/pylint/extensions/typing.py b/pylint/extensions/typing.py index d3c581fc4..12ccfdffc 100644 --- a/pylint/extensions/typing.py +++ b/pylint/extensions/typing.py @@ -163,7 +163,7 @@ class TypingChecker(BaseChecker): def __init__(self, linter: "PyLinter") -> None: """Initialize checker instance.""" - super().__init__(linter=linter, future_option_parsing=True) + super().__init__(linter=linter) self._found_broken_callable_location: bool = False self._alias_name_collisions: Set[str] = set() self._deprecated_typing_alias_msgs: List[DeprecatedTypingAliasMsg] = [] diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py index 1f005b9ed..9a15b1736 100644 --- a/pylint/lint/pylinter.py +++ b/pylint/lint/pylinter.py @@ -620,7 +620,7 @@ class PyLinter( self._by_id_managed_msgs: List[ManagedMessage] = [] reporters.ReportsHandlerMixIn.__init__(self) - checkers.BaseTokenChecker.__init__(self, self, future_option_parsing=True) + checkers.BaseTokenChecker.__init__(self, self) # provided reports self.reports = ( ("RP0001", "Messages by category", report_total_messages_stats), |