File tree Expand file tree Collapse file tree 2 files changed +3
-34
lines changed
Expand file tree Collapse file tree 2 files changed +3
-34
lines changed Original file line number Diff line number Diff line change 22# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
33# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
44
5- """Basic checker for Python code."""
65
76__all__ = [
87 "NameChecker" ,
1716
1817from typing import TYPE_CHECKING
1918
20- from astroid import nodes
21-
2219from pylint .checkers .base .basic_checker import BasicChecker
2320from pylint .checkers .base .basic_error_checker import BasicErrorChecker
2421from pylint .checkers .base .comparison_checker import ComparisonChecker
3936 from pylint .lint import PyLinter
4037
4138
42- UNITTEST_CASE = "unittest.case"
43-
44-
45- LOOPLIKE_NODES = (
46- nodes .For ,
47- nodes .ListComp ,
48- nodes .SetComp ,
49- nodes .DictComp ,
50- nodes .GeneratorExp ,
51- )
52-
53-
54- def in_loop (node : nodes .NodeNG ) -> bool :
55- """Return whether the node is inside a kind of for loop."""
56- return any (isinstance (parent , LOOPLIKE_NODES ) for parent in node .node_ancestors ())
57-
58-
59- def in_nested_list (nested_list , obj ):
60- """Return true if the object is an element of <nested_list> or of a nested
61- list
62- """
63- for elmt in nested_list :
64- if isinstance (elmt , (list , tuple )):
65- if in_nested_list (elmt , obj ):
66- return True
67- elif elmt == obj :
68- return True
69- return False
70-
71-
7239def register (linter : "PyLinter" ) -> None :
7340 linter .register_checker (BasicErrorChecker (linter ))
7441 linter .register_checker (BasicChecker (linter ))
Original file line number Diff line number Diff line change 22# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
33# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
44
5- """Permits separating multiple checks with the same checker name into classes/file ."""
5+ """Basic checker for Python code ."""
66
77import collections
88import itertools
3030
3131
3232class _BasicChecker (BaseChecker ):
33+ """Permits separating multiple checks with the same checker name into classes/file."""
34+
3335 __implements__ = IAstroidChecker
3436 name = "basic"
3537
You can’t perform that action at this time.
0 commit comments