summaryrefslogtreecommitdiff
path: root/pylint/checkers/base/basic_checker.py
diff options
context:
space:
mode:
Diffstat (limited to 'pylint/checkers/base/basic_checker.py')
-rw-r--r--pylint/checkers/base/basic_checker.py20
1 files changed, 7 insertions, 13 deletions
diff --git a/pylint/checkers/base/basic_checker.py b/pylint/checkers/base/basic_checker.py
index 062e67a97..18de86142 100644
--- a/pylint/checkers/base/basic_checker.py
+++ b/pylint/checkers/base/basic_checker.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/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
"""Basic checker for Python code."""
@@ -8,9 +8,8 @@ from __future__ import annotations
import collections
import itertools
-import sys
from collections.abc import Iterator
-from typing import TYPE_CHECKING, cast
+from typing import TYPE_CHECKING, Literal, cast
import astroid
from astroid import nodes, objects, util
@@ -24,11 +23,6 @@ from pylint.utils import LinterStats
if TYPE_CHECKING:
from pylint.lint.pylinter import PyLinter
-if sys.version_info >= (3, 8):
- from typing import Literal
-else:
- from typing_extensions import Literal
-
class _BasicChecker(BaseChecker):
"""Permits separating multiple checks with the same checker name into
@@ -329,7 +323,7 @@ class BasicChecker(_BasicChecker):
nodes.Subscript,
)
inferred = None
- emit = isinstance(test, (nodes.Const,) + structs + const_nodes)
+ emit = isinstance(test, (nodes.Const, *structs, *const_nodes))
maybe_generator_call = None
if not isinstance(test, except_nodes):
inferred = utils.safe_infer(test)
@@ -367,9 +361,9 @@ class BasicChecker(_BasicChecker):
try:
# Just forcing the generator to infer all elements.
# astroid.exceptions.InferenceError are false positives
- # see https://github.com/PyCQA/pylint/pull/8185
+ # see https://github.com/pylint-dev/pylint/pull/8185
if isinstance(inferred, nodes.FunctionDef):
- call_inferred = list(inferred.infer_call_result())
+ call_inferred = list(inferred.infer_call_result(node))
elif isinstance(inferred, nodes.Lambda):
call_inferred = list(inferred.infer_call_result(node))
except astroid.InferenceError:
@@ -462,7 +456,7 @@ class BasicChecker(_BasicChecker):
# Heuristic: only run inference for names that begin with an uppercase char
# This reduces W0133's coverage, but retains acceptable runtime performance
- # For more details, see: https://github.com/PyCQA/pylint/issues/8073
+ # For more details, see: https://github.com/pylint-dev/pylint/issues/8073
inferred = utils.safe_infer(expr) if name[:1].isupper() else None
if isinstance(inferred, objects.ExceptionInstance):
self.add_message(