summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2022-03-24 22:18:45 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2022-03-24 22:40:30 +0100
commit1c509edc4ee2dbf1bbe8822e91e0b7df02ce463d (patch)
tree495bcfadf0a0ad2df6667c22360fb59d103075fd
parent1e7d3fa6219934028d2539ad290fe16ce8ea78e2 (diff)
downloadpylint-git-1c509edc4ee2dbf1bbe8822e91e0b7df02ce463d.tar.gz
[cleanup] Remove unused code in pylint.checker.base following refactor
-rw-r--r--pylint/checkers/base/__init__.py33
-rw-r--r--pylint/checkers/base/basic_checker.py4
2 files changed, 3 insertions, 34 deletions
diff --git a/pylint/checkers/base/__init__.py b/pylint/checkers/base/__init__.py
index 30686cb1d..7c162441b 100644
--- a/pylint/checkers/base/__init__.py
+++ b/pylint/checkers/base/__init__.py
@@ -2,7 +2,6 @@
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-"""Basic checker for Python code."""
__all__ = [
"NameChecker",
@@ -17,8 +16,6 @@ __all__ = [
from typing import TYPE_CHECKING
-from astroid import nodes
-
from pylint.checkers.base.basic_checker import BasicChecker
from pylint.checkers.base.basic_error_checker import BasicErrorChecker
from pylint.checkers.base.comparison_checker import ComparisonChecker
@@ -39,36 +36,6 @@ if TYPE_CHECKING:
from pylint.lint import PyLinter
-UNITTEST_CASE = "unittest.case"
-
-
-LOOPLIKE_NODES = (
- nodes.For,
- nodes.ListComp,
- nodes.SetComp,
- nodes.DictComp,
- nodes.GeneratorExp,
-)
-
-
-def in_loop(node: nodes.NodeNG) -> bool:
- """Return whether the node is inside a kind of for loop."""
- return any(isinstance(parent, LOOPLIKE_NODES) for parent in node.node_ancestors())
-
-
-def in_nested_list(nested_list, obj):
- """Return true if the object is an element of <nested_list> or of a nested
- list
- """
- for elmt in nested_list:
- if isinstance(elmt, (list, tuple)):
- if in_nested_list(elmt, obj):
- return True
- elif elmt == obj:
- return True
- return False
-
-
def register(linter: "PyLinter") -> None:
linter.register_checker(BasicErrorChecker(linter))
linter.register_checker(BasicChecker(linter))
diff --git a/pylint/checkers/base/basic_checker.py b/pylint/checkers/base/basic_checker.py
index eeb03b443..1e5a2a15b 100644
--- a/pylint/checkers/base/basic_checker.py
+++ b/pylint/checkers/base/basic_checker.py
@@ -2,7 +2,7 @@
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
-"""Permits separating multiple checks with the same checker name into classes/file."""
+"""Basic checker for Python code."""
import collections
import itertools
@@ -30,6 +30,8 @@ else:
class _BasicChecker(BaseChecker):
+ """Permits separating multiple checks with the same checker name into classes/file."""
+
__implements__ = IAstroidChecker
name = "basic"