fname
stringlengths
63
176
rel_fname
stringclasses
706 values
line
int64
-1
4.5k
name
stringlengths
1
81
kind
stringclasses
2 values
category
stringclasses
2 values
info
stringlengths
0
77.9k
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
383
visit_unaryop
def
function
def visit_unaryop(self, node: nodes.UnaryOp) -> None: """Check use of the non-existent ++ and -- operators.""" if ( (node.op in "+-") and isinstance(node.operand, nodes.UnaryOp) and (node.operand.op == node.op) and (node.col_offset + 1 == node.operand....
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
391
add_message
ref
function
self.add_message("nonexistent-operator", node=node, args=node.op * 2)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
393
_check_nonlocal_without_binding
def
function
def _check_nonlocal_without_binding(self, node, name): current_scope = node.scope() while _True: if current_scope.parent is None: break if not isinstance(current_scope, (nodes.ClassDef, nodes.FunctionDef)): self.add_message("nonlocal-without-b...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
394
scope
ref
function
current_scope = node.scope()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
400
add_message
ref
function
self.add_message("nonlocal-without-binding", args=(name,), node=node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
404
scope
ref
function
current_scope = current_scope.parent.scope()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
411
add_message
ref
function
self.add_message("nonlocal-without-binding", args=(name,), node=node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
413
only_required_for_messages
ref
function
@utils.only_required_for_messages("nonlocal-without-binding")
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
414
visit_nonlocal
def
function
def visit_nonlocal(self, node: nodes.Nonlocal) -> None: for name in node.names: self._check_nonlocal_without_binding(node, name) @utils.only_required_for_messages("abstract-class-instantiated") def visit_call(self, node: nodes.Call) -> None: """Check instantiating abstract class...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
416
_check_nonlocal_without_binding
ref
function
self._check_nonlocal_without_binding(node, name)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
418
only_required_for_messages
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
419
visit_call
def
function
def visit_call(self, node: nodes.Call) -> None: """Check instantiating abstract class with abc.ABCMeta as metaclass. """ for inferred in infer_all(node.func): self._check_inferred_class_is_abstract(inferred, node) def _check_inferred_class_is_abstract(self, inferred,...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
423
infer_all
ref
function
for inferred in infer_all(node.func):
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
424
_check_inferred_class_is_abstract
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
426
_check_inferred_class_is_abstract
def
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
430
node_frame_class
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
439
_has_abstract_methods
ref
function
abstract_methods = _has_abstract_methods(inferred)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
444
metaclass
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
449
ancestors
ref
function
for ancestor in inferred.ancestors():
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
450
qname
ref
function
if ancestor.qname() == "abc.ABC":
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
451
add_message
ref
function
self.add_message(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
458
qname
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
459
add_message
ref
function
self.add_message(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
463
_check_yield_outside_func
def
function
def _check_yield_outside_func(self, node): if not isinstance(node.frame(future=_True), (nodes.FunctionDef, nodes.Lambda)): self.add_message("yield-outside-function", node=node) def _check_else_on_loop(self, node): """Check that any loop with an else clause has a break statement.""" ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
464
frame
ref
function
if not isinstance(node.frame(future=True), (nodes.FunctionDef, nodes.Lambda)):
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
465
add_message
ref
function
self.add_message("yield-outside-function", node=node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
467
_check_else_on_loop
def
function
def _check_else_on_loop(self, node): """Check that any loop with an else clause has a break statement.""" if node.orelse and not _loop_exits_early(node): self.add_message( "useless-else-on-loop", node=node, # This is not optimal, but the li...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
469
_loop_exits_early
ref
function
if node.orelse and not _loop_exits_early(node):
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
470
add_message
ref
function
self.add_message(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
479
_check_in_loop
def
function
def _check_in_loop(self, node, node_name): """Check that a node is inside a for or while loop.""" for parent in node.node_ancestors(): if isinstance(parent, (nodes.For, nodes.While)): if node not in parent.orelse: return if isinstance(pare...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
481
node_ancestors
ref
function
for parent in node.node_ancestors():
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
493
add_message
ref
function
self.add_message("continue-in-finally", node=node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
495
add_message
ref
function
self.add_message("not-in-loop", node=node, args=node_name)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
497
_check_redefinition
def
function
def _check_redefinition(self, redeftype, node): """Check for redefinition of a function / method / class name.""" parent_frame = node.parent.frame(future=_True) # Ignore function stubs created for type information redefinitions = [ i for i in parent_frame.loc...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
499
frame
ref
function
parent_frame = node.parent.frame(future=True)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
508
is_overload_stub
ref
function
(local for local in redefinitions if not utils.is_overload_stub(local)),
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
511
are_exclusive
ref
function
if defined_self is not node and not astroid.are_exclusive(node, defined_self):
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
521
is_overload_stub
ref
function
if utils.is_overload_stub(node):
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
554
safe_infer
ref
function
inferred = utils.safe_infer(redefinition)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
558
qname
ref
function
and inferred.qname() == TYPING_FORWARD_REF_QNAME
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
563
match
ref
function
if dummy_variables_rgx and dummy_variables_rgx.match(node.name):
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/basic_error_checker.py
pylint/checkers/base/basic_error_checker.py
565
add_message
ref
function
self.add_message(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
19
_is_one_arg_pos_call
def
function
def _is_one_arg_pos_call(call): """Is this a call with exactly 1 positional argument ?""" return isinstance(call, nodes.Call) and len(call.args) == 1 and not call.keywords
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
24
ComparisonChecker
def
class
_check_singleton_comparison _check_nan_comparison _check_literal_comparison _check_logical_tautology _check_two_literals_being_compared _check_callable_comparison visit_compare _check_unidiomatic_typecheck _check_type_x_is_y
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
83
_check_singleton_comparison
def
function
def _check_singleton_comparison( self, left_value, right_value, root_node, checking_for_absence: bool = _False ): """Check if == or != is being used to compare a singleton value.""" singleton_values = (_True, _False, None) def _is_singleton_const(node) -> bool: retur...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
89
_is_singleton_const
def
function
def _is_singleton_const(node) -> bool: return isinstance(node, nodes.Const) and any( node.value is value for value in singleton_values ) if _is_singleton_const(left_value): singleton, other_value = left_value.value, right_value elif _is_single...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
94
_is_singleton_const
ref
function
if _is_singleton_const(left_value):
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
96
_is_singleton_const
ref
function
elif _is_singleton_const(right_value):
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
117
as_string
ref
function
left_value.as_string(), right_value.as_string()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
117
as_string
ref
function
left_value.as_string(), right_value.as_string()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
122
is_test_condition
ref
function
if not utils.is_test_condition(root_node) and checking_truthiness
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
126
as_string
ref
function
other_value.as_string()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
133
as_string
ref
function
left_value.as_string(), right_value.as_string()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
133
as_string
ref
function
left_value.as_string(), right_value.as_string()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
135
add_message
ref
function
self.add_message(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
138
as_string
ref
function
args=(f"'{root_node.as_string()}'", suggestion),
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
141
_check_nan_comparison
def
function
def _check_nan_comparison( self, left_value, right_value, root_node, checking_for_absence: bool = _False ): def _is_float_nan(node): try: if isinstance(node, nodes.Call) and len(node.args) == 1: if ( node.args[0].value.lower...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
144
_is_float_nan
def
function
def _is_float_nan(node): try: if isinstance(node, nodes.Call) and len(node.args) == 1: if ( node.args[0].value.lower() == "nan" and node.inferred()[0].pytype() == "builtins.float" ): ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
149
inferred
ref
function
and node.inferred()[0].pytype() == "builtins.float"
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
149
pytype
ref
function
and node.inferred()[0].pytype() == "builtins.float"
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
156
_is_numpy_nan
def
function
def _is_numpy_nan(node): if isinstance(node, nodes.Attribute) and node.attrname == "NaN": if isinstance(node.expr, nodes.Name): return node.expr.name in {"numpy", "nmp", "np"} return _False def _is_nan(node) -> bool: return _is_flo...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
162
_is_nan
def
function
def _is_nan(node) -> bool: return _is_float_nan(node) or _is_numpy_nan(node) nan_left = _is_nan(left_value) if not nan_left and not _is_nan(right_value): return absence_text = "" if checking_for_absence: absence_text = "not " if nan_l...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
163
_is_float_nan
ref
function
return _is_float_nan(node) or _is_numpy_nan(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
163
_is_numpy_nan
ref
function
return _is_float_nan(node) or _is_numpy_nan(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
165
_is_nan
ref
function
nan_left = _is_nan(left_value)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
166
_is_nan
ref
function
if not nan_left and not _is_nan(right_value):
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
173
as_string
ref
function
suggestion = f"'{absence_text}math.isnan({right_value.as_string()})'"
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
175
as_string
ref
function
suggestion = f"'{absence_text}math.isnan({left_value.as_string()})'"
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
176
add_message
ref
function
self.add_message(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
179
as_string
ref
function
args=(f"'{root_node.as_string()}'", suggestion),
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
182
_check_literal_comparison
def
function
def _check_literal_comparison(self, literal, node: nodes.Compare): """Check if we compare to a literal, which is usually what we do not want to do.""" is_other_literal = isinstance(literal, (nodes.List, nodes.Dict, nodes.Set)) is_const = _False if isinstance(literal, nodes.Const): ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
193
add_message
ref
function
self.add_message("literal-comparison", node=node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
195
_check_logical_tautology
def
function
def _check_logical_tautology(self, node: nodes.Compare): """Check if identifier is compared against itself. :param node: Compare node :Example: val = 786 if val == val: # [comparison-with-itself] pass """ left_operand = node.left right_op...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
220
add_message
ref
function
self.add_message("comparison-with-itself", node=node, args=(suggestion,))
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
222
_check_two_literals_being_compared
def
function
def _check_two_literals_being_compared(self, node: nodes.Compare) -> None: """Check if two literals are being compared; this is always a logical tautology.""" left_operand = node.left if not isinstance(left_operand, nodes.Const): return right_operand = node.ops[0][1] ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
233
add_message
ref
function
self.add_message(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
240
_check_callable_comparison
def
function
def _check_callable_comparison(self, node): operator = node.ops[0][0] if operator not in COMPARISON_OPERATORS: return bare_callables = (nodes.FunctionDef, astroid.BoundMethod) left_operand, right_operand = node.left, node.ops[0][1] # this message should be emitte...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
251
safe_infer
ref
function
inferred = utils.safe_infer(operand)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
256
decoratornames
ref
function
and "typing._SpecialForm" not in inferred.decoratornames()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
261
add_message
ref
function
self.add_message("comparison-with-callable", node=node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
263
only_required_for_messages
ref
function
@utils.only_required_for_messages(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
272
visit_compare
def
function
def visit_compare(self, node: nodes.Compare) -> None: self._check_callable_comparison(node) self._check_logical_tautology(node) self._check_unidiomatic_typecheck(node) self._check_two_literals_being_compared(node) # NOTE: this checker only works with binary comparisons like '...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
273
_check_callable_comparison
ref
function
self._check_callable_comparison(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
274
_check_logical_tautology
ref
function
self._check_logical_tautology(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
275
_check_unidiomatic_typecheck
ref
function
self._check_unidiomatic_typecheck(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
276
_check_two_literals_being_compared
ref
function
self._check_two_literals_being_compared(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
286
_check_singleton_comparison
ref
function
self._check_singleton_comparison(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
291
_check_nan_comparison
ref
function
self._check_nan_comparison(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
295
_check_literal_comparison
ref
function
self._check_literal_comparison(right, node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
297
_check_unidiomatic_typecheck
def
function
def _check_unidiomatic_typecheck(self, node): operator, right = node.ops[0] if operator in TYPECHECK_COMPARISON_OPERATORS: left = node.left if _is_one_arg_pos_call(left): self._check_type_x_is_y(node, left, operator, right) def _check_type_x_is_y(self, no...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
301
_is_one_arg_pos_call
ref
function
if _is_one_arg_pos_call(left):
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
302
_check_type_x_is_y
ref
function
self._check_type_x_is_y(node, left, operator, right)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
304
_check_type_x_is_y
def
function
def _check_type_x_is_y(self, node, left, operator, right): """Check for expressions like type(x) == Y.""" left_func = utils.safe_infer(left.func) if not ( isinstance(left_func, nodes.ClassDef) and left_func.qname() == TYPE_QNAME ): return if operator ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
306
safe_infer
ref
function
left_func = utils.safe_infer(left.func)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
308
qname
ref
function
isinstance(left_func, nodes.ClassDef) and left_func.qname() == TYPE_QNAME
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
312
_is_one_arg_pos_call
ref
function
if operator in {"is", "is not"} and _is_one_arg_pos_call(right):
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
313
safe_infer
ref
function
right_func = utils.safe_infer(right.func)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
316
qname
ref
function
and right_func.qname() == TYPE_QNAME
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
319
safe_infer
ref
function
right_arg = utils.safe_infer(right.args[0])
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/base/comparison_checker.py
pylint/checkers/base/comparison_checker.py
323
add_message
ref
function
self.add_message("unidiomatic-typecheck", node=node)