Skip to content

Commit d83fb24

Browse files
Remove PY39_PLUS constant
1 parent 79a7b1e commit d83fb24

File tree

6 files changed

+5
-36
lines changed

6 files changed

+5
-36
lines changed

pylint/checkers/nested_min_max.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
from pylint.checkers import BaseChecker
1616
from pylint.checkers.utils import only_required_for_messages, safe_infer
17-
from pylint.constants import PY39_PLUS
1817
from pylint.interfaces import INFERENCE
1918

2019
if TYPE_CHECKING:
@@ -139,8 +138,8 @@ def _is_splattable_expression(self, arg: nodes.NodeNG) -> bool:
139138
return self._is_splattable_expression(
140139
arg.left
141140
) and self._is_splattable_expression(arg.right)
142-
# Support dict merge (operator __or__ in Python 3.9)
143-
if isinstance(arg, nodes.BinOp) and arg.op == "|" and PY39_PLUS:
141+
# Support dict merge (operator __or__)
142+
if isinstance(arg, nodes.BinOp) and arg.op == "|":
144143
return self._is_splattable_expression(
145144
arg.left
146145
) and self._is_splattable_expression(arg.right)

pylint/checkers/variables.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
is_sys_guard,
3333
overridden_method,
3434
)
35-
from pylint.constants import PY39_PLUS, PY311_PLUS, TYPING_NEVER, TYPING_NORETURN
35+
from pylint.constants import PY311_PLUS, TYPING_NEVER, TYPING_NORETURN
3636
from pylint.interfaces import CONTROL_FLOW, HIGH, INFERENCE, INFERENCE_FAILURE
3737
from pylint.typing import MessageDefinitionTuple
3838

@@ -2350,23 +2350,6 @@ def _is_variable_violation(
23502350
and defnode.col_offset < node.col_offset
23512351
)
23522352
or (defnode.lineno < node.lineno)
2353-
or (
2354-
# Issue in the `ast` module until py39
2355-
# Nodes in a multiline string have the same lineno
2356-
# Could be false-positive without check
2357-
not PY39_PLUS
2358-
and defnode.lineno == node.lineno
2359-
and isinstance(
2360-
defstmt,
2361-
(
2362-
nodes.Assign,
2363-
nodes.AnnAssign,
2364-
nodes.AugAssign,
2365-
nodes.Return,
2366-
),
2367-
)
2368-
and isinstance(defstmt.value, nodes.JoinedStr)
2369-
)
23702353
)
23712354
):
23722355
# Relation of a name to the same name in a named expression

pylint/constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from pylint.__pkginfo__ import __version__
1515
from pylint.typing import MessageTypesFullName
1616

17-
PY39_PLUS = sys.version_info[:2] >= (3, 9)
1817
PY310_PLUS = sys.version_info[:2] >= (3, 10)
1918
PY311_PLUS = sys.version_info[:2] >= (3, 11)
2019
PY312_PLUS = sys.version_info[:2] >= (3, 12)

pylint/testutils/checker_test_case.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
from astroid import nodes
1212

13-
from pylint.constants import IS_PYPY, PY39_PLUS
1413
from pylint.testutils.global_test_linter import linter
1514
from pylint.testutils.output_line import MessageTest
1615
from pylint.testutils.unittest_linter import UnittestLinter
@@ -76,9 +75,8 @@ def assertAddsMessages(
7675

7776
assert expected_msg.line == gotten_msg.line, msg
7877
assert expected_msg.col_offset == gotten_msg.col_offset, msg
79-
if not IS_PYPY or PY39_PLUS:
80-
assert expected_msg.end_line == gotten_msg.end_line, msg
81-
assert expected_msg.end_col_offset == gotten_msg.end_col_offset, msg
78+
assert expected_msg.end_line == gotten_msg.end_line, msg
79+
assert expected_msg.end_col_offset == gotten_msg.end_col_offset, msg
8280

8381
def walk(self, node: nodes.NodeNG) -> None:
8482
"""Recursive walk on the given node."""

tests/checkers/unittest_symilar.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import pytest
1010

1111
from pylint.checkers import symilar
12-
from pylint.constants import IS_PYPY, PY39_PLUS
1312
from pylint.lint import PyLinter
1413
from pylint.testutils import GenericTestReporter as Reporter
1514

@@ -131,10 +130,6 @@ def test_multiline_imports() -> None:
131130
)
132131

133132

134-
@pytest.mark.skipif(
135-
IS_PYPY and not PY39_PLUS,
136-
reason="Requires accurate 'end_lineno' value",
137-
)
138133
def test_ignore_multiline_imports() -> None:
139134
output = StringIO()
140135
with redirect_stdout(output), pytest.raises(SystemExit) as ex:

tests/testutils/test_lint_module_output_update.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
import pytest
1414

15-
from pylint.constants import IS_PYPY, PY39_PLUS
1615
from pylint.testutils import FunctionalTestFile, LintModuleTest
1716
from pylint.testutils.functional import LintModuleOutputUpdate
1817

@@ -72,10 +71,6 @@ def test_lint_module_output_update_remove_useless_txt(
7271
assert not expected_output_file.exists()
7372

7473

75-
@pytest.mark.skipif(
76-
IS_PYPY and not PY39_PLUS,
77-
reason="Requires accurate 'end_col' value to update output",
78-
)
7974
@pytest.mark.parametrize(
8075
"directory_path", DIRECTORIES, ids=[str(p) for p in DIRECTORIES]
8176
)

0 commit comments

Comments
 (0)