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/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
949
_check_exception_inherit_from_stopiteration
def
function
def _check_exception_inherit_from_stopiteration(exc): """Return _True if the exception node in argument inherit from StopIteration.""" stopiteration_qname = f"{utils.EXCEPTIONS_MODULE}.StopIteration" return any(_class.qname() == stopiteration_qname for _class in exc.mro()) def _check_co...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
952
qname
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
952
mro
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
954
_check_consider_using_comprehension_constructor
def
function
def _check_consider_using_comprehension_constructor(self, node): if ( isinstance(node.func, nodes.Name) and node.args and isinstance(node.args[0], nodes.ListComp) ): if node.func.name == "dict": element = node.args[0].elt ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
977
as_string
ref
function
key1.as_string() != key2.as_string()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
977
as_string
ref
function
key1.as_string() != key2.as_string()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
978
as_string
ref
function
and value1.as_string() != value2.as_string()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
978
as_string
ref
function
and value1.as_string() != value2.as_string()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
983
add_message
ref
function
self.add_message(message_name, node=node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
986
add_message
ref
function
self.add_message(message_name, node=node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
988
_check_consider_using_generator
def
function
def _check_consider_using_generator(self, node): # 'any' and 'all' definitely should use generator, while 'list' and 'tuple' need to be considered first # See https://github.com/PyCQA/pylint/pull/3309#discussion_r576683109 checked_call = ["any", "all", "list", "tuple"] if ( ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,002
as_string
ref
function
inside_comp = node.args[0].as_string()[1:-1]
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,005
add_message
ref
function
self.add_message(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,011
add_message
ref
function
self.add_message(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,017
only_required_for_messages
ref
function
@utils.only_required_for_messages(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,029
visit_call
def
function
def visit_call(self, node: nodes.Call) -> None: self._check_raising_stopiteration_in_generator_next_call(node) self._check_consider_using_comprehension_constructor(node) self._check_quit_exit_call(node) self._check_super_with_arguments(node) self._check_consider_using_generat...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,030
_check_raising_stopiteration_in_generator_next_call
ref
function
self._check_raising_stopiteration_in_generator_next_call(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,031
_check_consider_using_comprehension_constructor
ref
function
self._check_consider_using_comprehension_constructor(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,032
_check_quit_exit_call
ref
function
self._check_quit_exit_call(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,033
_check_super_with_arguments
ref
function
self._check_super_with_arguments(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,034
_check_consider_using_generator
ref
function
self._check_consider_using_generator(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,035
_check_consider_using_with
ref
function
self._check_consider_using_with(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,036
_check_use_list_or_dict_literal
ref
function
self._check_use_list_or_dict_literal(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,039
_has_exit_in_scope
def
function
def _has_exit_in_scope(scope): exit_func = scope.locals.get("exit") return bool( exit_func and isinstance(exit_func[0], (nodes.ImportFrom, nodes.Import)) ) def _check_quit_exit_call(self, node): if isinstance(node.func, nodes.Name) and node.func.name in BUILTIN_EXIT...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,045
_check_quit_exit_call
def
function
def _check_quit_exit_call(self, node): if isinstance(node.func, nodes.Name) and node.func.name in BUILTIN_EXIT_FUNCS: # If we have `exit` imported from `sys` in the current or global scope, exempt this instance. local_scope = node.scope() if self._has_exit_in_scope(local...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,049
scope
ref
function
local_scope = node.scope()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,050
_has_exit_in_scope
ref
function
if self._has_exit_in_scope(local_scope) or self._has_exit_in_scope(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,050
_has_exit_in_scope
ref
function
if self._has_exit_in_scope(local_scope) or self._has_exit_in_scope(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,051
root
ref
function
node.root()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,054
add_message
ref
function
self.add_message("consider-using-sys-exit", node=node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,056
_check_super_with_arguments
def
function
def _check_super_with_arguments(self, node): if not isinstance(node.func, nodes.Name) or node.func.name != "super": return # pylint: disable=too-many-boolean-expressions if ( len(node.args) != 2 or not isinstance(node.args[1], nodes.Name) or n...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,067
node_frame_class
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,068
node_frame_class
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,072
add_message
ref
function
self.add_message("super-with-arguments", node=node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,074
_check_raising_stopiteration_in_generator_next_call
def
function
def _check_raising_stopiteration_in_generator_next_call(self, node): """Check if a StopIteration exception is raised by the call to next function. If the next value has a default value, then do not add message. :param node: Check to see if this Call node is a next function :type no...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,083
_looks_like_infinite_iterator
def
function
def _looks_like_infinite_iterator(param): inferred = utils.safe_infer(param) if inferred: return inferred.qname() in KNOWN_INFINITE_ITERATORS return _False if isinstance(node.func, nodes.Attribute): # A next() method, which is now what we ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,084
safe_infer
ref
function
inferred = utils.safe_infer(param)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,086
qname
ref
function
return inferred.qname() in KNOWN_INFINITE_ITERATORS
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,093
safe_infer
ref
function
inferred = utils.safe_infer(node.func)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,095
frame
ref
function
frame = node.frame(future=True)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,101
is_generator
ref
function
and frame.is_generator()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,103
node_ignores_exception
ref
function
and not utils.node_ignores_exception(node, StopIteration)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,104
_looks_like_infinite_iterator
ref
function
and not _looks_like_infinite_iterator(node.args[0])
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,106
add_message
ref
function
self.add_message("stop-iteration-return", node=node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,108
_check_nested_blocks
def
function
def _check_nested_blocks(self, node): """Update and check the number of nested blocks.""" # only check block levels inside functions or methods if not isinstance(node.scope(), nodes.FunctionDef): return # messages are triggered on leaving the nested block. Here we save th...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,111
scope
ref
function
if not isinstance(node.scope(), nodes.FunctionDef):
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,116
scope
ref
function
if node.parent == node.scope():
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,125
_is_actual_elif
ref
function
if isinstance(node, nodes.If) and self._is_actual_elif(node):
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,132
_emit_nested_blocks_message_if_needed
ref
function
self._emit_nested_blocks_message_if_needed(nested_blocks)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,134
_emit_nested_blocks_message_if_needed
def
function
def _emit_nested_blocks_message_if_needed(self, nested_blocks): if len(nested_blocks) > self.linter.config.max_nested_blocks: self.add_message( "too-many-nested-blocks", node=nested_blocks[0], args=(len(nested_blocks), self.linter.config.max_nested...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,136
add_message
ref
function
self.add_message(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,142
_emit_consider_using_with_if_needed
def
function
def _emit_consider_using_with_if_needed(self, stack: dict[str, nodes.NodeNG]): for node in stack.values(): self.add_message("consider-using-with", node=node) @staticmethod def _duplicated_isinstance_types(node): """Get the duplicated types from the underlying isinstance calls. ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,144
add_message
ref
function
self.add_message("consider-using-with", node=node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,147
_duplicated_isinstance_types
def
function
def _duplicated_isinstance_types(node): """Get the duplicated types from the underlying isinstance calls. :param nodes.BoolOp node: Node which should contain a bunch of isinstance calls. :returns: Dictionary of the comparison objects from the isinstance calls, to duplicate...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,162
safe_infer
ref
function
inferred = utils.safe_infer(call.func)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,163
is_builtin_object
ref
function
if not inferred or not utils.is_builtin_object(inferred):
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,169
as_string
ref
function
isinstance_object = call.args[0].as_string()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,177
as_string
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,177
itered
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,180
as_string
ref
function
elems = [isinstance_types.as_string()]
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,188
_check_consider_merging_isinstance
def
function
def _check_consider_merging_isinstance(self, node): """Check isinstance calls which can be merged together.""" if node.op != "or": return first_args = self._duplicated_isinstance_types(node) for duplicated_name, class_names in first_args.items(): names = sort...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,193
_duplicated_isinstance_types
ref
function
first_args = self._duplicated_isinstance_types(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,196
add_message
ref
function
self.add_message(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,202
_check_consider_using_in
def
function
def _check_consider_using_in(self, node): allowed_ops = {"or": "==", "and": "!="} if node.op not in allowed_ops or len(node.values) < 2: return for value in node.values: if ( not isinstance(value, nodes.Compare) or len(value.ops) != 1...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,225
as_string
ref
function
variable_set.add(comparable.as_string())
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,226
as_string
ref
function
values.append(comparable.as_string())
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,243
add_message
ref
function
self.add_message("consider-using-in", node=node, args=(suggestion,))
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,245
_check_chained_comparison
def
function
def _check_chained_comparison(self, node): """Check if there is any chained comparison in the expression. Add a refactoring message if a boolOp contains comparison like a < b and b < c, which can be chained as a < b < c. Care is taken to avoid simplifying a < b < c and b < d. ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,256
_find_lower_upper_bounds
def
function
def _find_lower_upper_bounds(comparison_node, uses): left_operand = comparison_node.left for operator, right_operand in comparison_node.ops: for operand in (left_operand, right_operand): value = None if isinstance(operand, nodes.Nam...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,286
_find_lower_upper_bounds
ref
function
_find_lower_upper_bounds(comparison_node, uses)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,293
add_message
ref
function
self.add_message("chained-comparison", node=node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,297
_apply_boolean_simplification_rules
def
function
def _apply_boolean_simplification_rules(operator, values): """Removes irrelevant values or returns short-circuiting values. This function applies the following two rules: 1) an OR expression with _True in it will always be true, and the reverse for AND 2) _False values i...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,311
nodes_of_class
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,312
safe_infer
ref
function
inferred = utils.safe_infer(subnode)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,314
bool_value
ref
function
inferred_bool = inferred.bool_value()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,321
Const
ref
function
return simplified_values or [nodes.Const(operator == "and")]
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,323
_simplify_boolean_operation
def
function
def _simplify_boolean_operation(self, bool_op): """Attempts to simplify a boolean operation. Recursively applies simplification on the operator terms, and keeps track of whether reductions have been made. """ children = list(bool_op.get_children()) intermediate = [ ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,329
get_children
ref
function
children = list(bool_op.get_children())
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,331
_simplify_boolean_operation
ref
function
self._simplify_boolean_operation(child)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,336
_apply_boolean_simplification_rules
ref
function
result = self._apply_boolean_simplification_rules(bool_op.op, intermediate)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,342
postinit
ref
function
simplified_bool_op.postinit(result)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,345
_check_simplifiable_condition
def
function
def _check_simplifiable_condition(self, node): """Check if a boolean condition can be simplified. Variables will not be simplified, even if the value can be inferred, and expressions like '3 + 4' will remain expanded. """ if not utils.is_test_condition(node): ret...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,351
is_test_condition
ref
function
if not utils.is_test_condition(node):
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,355
_simplify_boolean_operation
ref
function
simplified_expr = self._simplify_boolean_operation(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,360
nodes_of_class
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,361
add_message
ref
function
self.add_message(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,364
as_string
ref
function
args=(node.as_string(), simplified_expr.as_string()),
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,364
as_string
ref
function
args=(node.as_string(), simplified_expr.as_string()),
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,367
add_message
ref
function
self.add_message(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,370
as_string
ref
function
args=(node.as_string(), simplified_expr.as_string()),
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,370
as_string
ref
function
args=(node.as_string(), simplified_expr.as_string()),
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,373
only_required_for_messages
ref
function
@utils.only_required_for_messages(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,380
visit_boolop
def
function
def visit_boolop(self, node: nodes.BoolOp) -> None: self._check_consider_merging_isinstance(node) self._check_consider_using_in(node) self._check_chained_comparison(node) self._check_simplifiable_condition(node) @staticmethod def _is_simple_assignment(node): return (...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,381
_check_consider_merging_isinstance
ref
function
self._check_consider_merging_isinstance(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,382
_check_consider_using_in
ref
function
self._check_consider_using_in(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,383
_check_chained_comparison
ref
function
self._check_chained_comparison(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,384
_check_simplifiable_condition
ref
function
self._check_simplifiable_condition(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,387
_is_simple_assignment
def
function
def _is_simple_assignment(node): return ( isinstance(node, nodes.Assign) and len(node.targets) == 1 and isinstance(node.targets[0], nodes.AssignName) and isinstance(node.value, nodes.Name) ) def _check_swap_variables(self, node): if not no...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,395
_check_swap_variables
def
function
def _check_swap_variables(self, node): if not node.next_sibling() or not node.next_sibling().next_sibling(): return assignments = [node, node.next_sibling(), node.next_sibling().next_sibling()] if not all(self._is_simple_assignment(node) for node in assignments): retu...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/refactoring/refactoring_checker.py
pylint/checkers/refactoring/refactoring_checker.py
1,396
next_sibling
ref
function
if not node.next_sibling() or not node.next_sibling().next_sibling():