/opt/imh-python/lib/python3.9/site-packages/pylint/checkers
NameSizeModeActions
base/-0755rm
classes/-0755rm
refactoring/-0755rm
__pycache__/-0755rm
async.py39330644editdlrm
bad_chained_comparison.py22380644editdlrm
base_checker.py92210644editdlrm
dataclass_checker.py45030644editdlrm
deprecated.py111960644editdlrm
design_analysis.py245880644editdlrm
dunder_methods.py39080644editdlrm
ellipsis_checker.py20240644editdlrm
exceptions.py265040644editdlrm
format.py279120644editdlrm
imports.py489750644editdlrm
lambda_expressions.py34720644editdlrm
logging.py164200644editdlrm
method_args.py47640644editdlrm
misc.py50350644editdlrm
modified_iterating_checker.py77500644editdlrm
nested_min_max.py55830644editdlrm
newstyle.py42000644editdlrm
non_ascii_names.py71550644editdlrm
raw_metrics.py37970644editdlrm
spelling.py164540644editdlrm
stdlib.py366090644editdlrm
strings.py447850644editdlrm
symilar.py339480644editdlrm
threading_checker.py19510644editdlrm
typecheck.py908200644editdlrm
unicode.py184740644editdlrm
unsupported_version.py77450644editdlrm
utils.py798180644editdlrm
variables.py1380020644editdlrm
__init__.py42350644editdlrm
Edit: /opt/imh-python/lib/python3.9/site-packages/pylint/checkers/ellipsis_checker.py (2024B)
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html # For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE # Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Ellipsis checker for Python code.""" from __future__ import annotations from typing import TYPE_CHECKING from astroid import nodes from pylint.checkers import BaseChecker from pylint.checkers.utils import only_required_for_messages if TYPE_CHECKING: from pylint.lint import PyLinter class EllipsisChecker(BaseChecker): name = "unnecessary_ellipsis" msgs = { "W2301": ( "Unnecessary ellipsis constant", "unnecessary-ellipsis", "Used when the ellipsis constant is encountered and can be avoided. " "A line of code consisting of an ellipsis is unnecessary if " "there is a docstring on the preceding line or if there is a " "statement in the same scope.", ) } @only_required_for_messages("unnecessary-ellipsis") def visit_const(self, node: nodes.Const) -> None: """Check if the ellipsis constant is used unnecessarily. Emits a warning when: - A line consisting of an ellipsis is preceded by a docstring. - A statement exists in the same scope as the ellipsis. For example: A function consisting of an ellipsis followed by a return statement on the next line. """ if ( node.pytype() == "builtins.Ellipsis" and isinstance(node.parent, nodes.Expr) and ( ( isinstance(node.parent.parent, (nodes.ClassDef, nodes.FunctionDef)) and node.parent.parent.doc_node ) or len(node.parent.parent.body) > 1 ) ): self.add_message("unnecessary-ellipsis", node=node) def register(linter: PyLinter) -> None: linter.register_checker(EllipsisChecker(linter))