From 6c5fc30399a507e44e0b85a5e5565edc301b2fc0 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Tue, 21 Mar 2023 09:06:23 +0100 Subject: [PATCH 1/2] [deprecation] Remove 'do_exit' from the 'Run' constructor --- doc/whatsnew/fragments/8472.internal | 4 ++++ pylint/lint/run.py | 13 +------------ pylint/testutils/_run.py | 5 +---- 3 files changed, 6 insertions(+), 16 deletions(-) create mode 100644 doc/whatsnew/fragments/8472.internal diff --git a/doc/whatsnew/fragments/8472.internal b/doc/whatsnew/fragments/8472.internal new file mode 100644 index 0000000000..6e9c3956a9 --- /dev/null +++ b/doc/whatsnew/fragments/8472.internal @@ -0,0 +1,4 @@ +Following a deprecation period, the ``do_exit`` argument of the ``Run`` class (and of the ``_Run`` +class in testutils) were removed. + +Refs #8472 diff --git a/pylint/lint/run.py b/pylint/lint/run.py index 7c2e8c0e6b..a92f42046c 100644 --- a/pylint/lint/run.py +++ b/pylint/lint/run.py @@ -9,7 +9,7 @@ import warnings from collections.abc import Sequence from pathlib import Path -from typing import Any, ClassVar +from typing import ClassVar from pylint import config from pylint.checkers.utils import clear_lru_caches @@ -123,7 +123,6 @@ def __init__( args: Sequence[str], reporter: BaseReporter | None = None, exit: bool = True, # pylint: disable=redefined-builtin - do_exit: Any = UNUSED_PARAM_SENTINEL, ) -> None: # Immediately exit if user asks for version if "--version" in args: @@ -215,16 +214,6 @@ def __init__( else: linter.check(args) score_value = linter.generate_reports() - - if do_exit is not UNUSED_PARAM_SENTINEL: - # TODO: 3.0 - warnings.warn( - "do_exit is deprecated and it is going to be removed in a future version.", - DeprecationWarning, - stacklevel=2, - ) - exit = do_exit - if linter.config.clear_cache_post_run: clear_lru_caches() MANAGER.clear_cache() diff --git a/pylint/testutils/_run.py b/pylint/testutils/_run.py index 0ad68868f5..f1e7fbb9ac 100644 --- a/pylint/testutils/_run.py +++ b/pylint/testutils/_run.py @@ -10,10 +10,8 @@ from __future__ import annotations from collections.abc import Sequence -from typing import Any from pylint.lint import Run as LintRun -from pylint.lint.run import UNUSED_PARAM_SENTINEL from pylint.reporters.base_reporter import BaseReporter from pylint.testutils.lint_module_test import PYLINTRC @@ -39,7 +37,6 @@ def __init__( args: Sequence[str], reporter: BaseReporter | None = None, exit: bool = True, # pylint: disable=redefined-builtin - do_exit: Any = UNUSED_PARAM_SENTINEL, ) -> None: args = _add_rcfile_default_pylintrc(list(args)) - super().__init__(args, reporter, exit, do_exit) + super().__init__(args, reporter, exit) From c4b0afb575f429d85f2901399e6abce3c5d7374a Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Tue, 21 Mar 2023 11:59:46 +0100 Subject: [PATCH 2/2] Remove sentinel --- pylint/lint/run.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/pylint/lint/run.py b/pylint/lint/run.py index a92f42046c..961d78a537 100644 --- a/pylint/lint/run.py +++ b/pylint/lint/run.py @@ -97,9 +97,6 @@ def _cpu_count() -> int: return cpu_count -UNUSED_PARAM_SENTINEL = object() - - class Run: """Helper class to use as main for pylint with 'run(*sys.argv[1:])'."""