/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/threading_checker.py (1951B)
# 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 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, safe_infer if TYPE_CHECKING: from pylint.lint import PyLinter class ThreadingChecker(BaseChecker): """Checks for threading module. - useless with lock - locking used in wrong way that has no effect (with threading.Lock():) """ name = "threading" LOCKS = frozenset( ( "threading.Lock", "threading.RLock", "threading.Condition", "threading.Semaphore", "threading.BoundedSemaphore", ) ) msgs = { "W2101": ( "'%s()' directly created in 'with' has no effect", "useless-with-lock", "Used when a new lock instance is created by using with statement " "which has no effect. Instead, an existing instance should be used to acquire lock.", ), } @only_required_for_messages("useless-with-lock") def visit_with(self, node: nodes.With) -> None: context_managers = (c for c, _ in node.items if isinstance(c, nodes.Call)) for context_manager in context_managers: if isinstance(context_manager, nodes.Call): infered_function = safe_infer(context_manager.func) if infered_function is None: continue qname = infered_function.qname() if qname in self.LOCKS: self.add_message("useless-with-lock", node=node, args=qname) def register(linter: PyLinter) -> None: linter.register_checker(ThreadingChecker(linter))