Skip to content

Commit

Permalink
[cleanup] Remove unused code in pylint.checker.base following refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Mar 24, 2022
1 parent 1e7d3fa commit 1c509ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 34 deletions.
33 changes: 0 additions & 33 deletions pylint/checkers/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -17,8 +16,6 @@

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
Expand All @@ -39,36 +36,6 @@
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))
Expand Down
4 changes: 3 additions & 1 deletion pylint/checkers/base/basic_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -30,6 +30,8 @@


class _BasicChecker(BaseChecker):
"""Permits separating multiple checks with the same checker name into classes/file."""

__implements__ = IAstroidChecker
name = "basic"

Expand Down

0 comments on commit 1c509ed

Please sign in to comment.