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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/recommendation_checker.py | pylint/checkers/refactoring/recommendation_checker.py | 329 | visit_const | def | function | def visit_const(self, node: nodes.Const) -> None:
if self._py36_plus:
# f-strings require Python 3.6
if node.pytype() == "builtins.str" and not isinstance(
node.parent, nodes.JoinedStr
):
self._detect_replacable_format_call(node)
def _... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/recommendation_checker.py | pylint/checkers/refactoring/recommendation_checker.py | 332 | pytype | ref | function | if node.pytype() == "builtins.str" and not isinstance(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/recommendation_checker.py | pylint/checkers/refactoring/recommendation_checker.py | 335 | _detect_replacable_format_call | ref | function | self._detect_replacable_format_call(node)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/recommendation_checker.py | pylint/checkers/refactoring/recommendation_checker.py | 337 | _detect_replacable_format_call | def | function | def _detect_replacable_format_call(self, node: nodes.Const) -> None:
"""Check whether a string is used in a call to format() or '%' and whether it
can be replaced by an f-string
"""
if (
isinstance(node.parent, nodes.Attribute)
and node.parent.attrname == "for... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/recommendation_checker.py | pylint/checkers/refactoring/recommendation_checker.py | 353 | safe_infer | ref | function | inferred = utils.safe_infer(arg.value)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/recommendation_checker.py | pylint/checkers/refactoring/recommendation_checker.py | 360 | as_string | ref | function | if "\\" in arg.as_string():
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/recommendation_checker.py | pylint/checkers/refactoring/recommendation_checker.py | 365 | parse_format_method_string | ref | function | i[0] for i in utils.parse_format_method_string(node.value)[0]
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/recommendation_checker.py | pylint/checkers/refactoring/recommendation_checker.py | 372 | safe_infer | ref | function | keyword = utils.safe_infer(keyword.value)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/recommendation_checker.py | pylint/checkers/refactoring/recommendation_checker.py | 380 | add_message | ref | function | self.add_message(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/recommendation_checker.py | pylint/checkers/refactoring/recommendation_checker.py | 389 | as_string | ref | function | if "\\" in node.parent.right.as_string():
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/recommendation_checker.py | pylint/checkers/refactoring/recommendation_checker.py | 392 | safe_infer | ref | function | inferred_right = utils.safe_infer(node.parent.right)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/recommendation_checker.py | pylint/checkers/refactoring/recommendation_checker.py | 403 | add_message | ref | function | self.add_message(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 51 | _if_statement_is_always_returning | def | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 55 | _is_trailing_comma | def | function | def _is_trailing_comma(tokens: List[tokenize.TokenInfo], index: int) -> bool:
"""Check if the given token is a trailing comma.
:param tokens: Sequence of modules tokens
:type tokens: list[tokenize.TokenInfo]
:param int index: Index of token under check in tokens
:returns: _True if the token is a co... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 82 | get_curline_index_start | def | function | def get_curline_index_start():
"""Get the index denoting the start of the current line."""
for subindex, token in enumerate(reversed(tokens[:index])):
# See Lib/tokenize.py and Lib/token.py in cpython for more info
if token.type == tokenize.NEWLINE:
return ind... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 90 | get_curline_index_start | ref | function | curline_start = get_curline_index_start()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 98 | _is_inside_context_manager | def | function | def _is_inside_context_manager(node: nodes.Call) -> bool:
frame = node.frame(future=_True)
if not isinstance(
frame, (nodes.FunctionDef, astroid.BoundMethod, astroid.UnboundMethod)
):
return _False
return frame.name == "__enter__" or utils.decorated_with(
frame, "contextlib.conte... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 99 | frame | ref | function | frame = node.frame(future=True)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 104 | decorated_with | ref | function | return frame.name == "__enter__" or utils.decorated_with(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 109 | _is_a_return_statement | def | function | def _is_a_return_statement(node: nodes.Call) -> bool:
frame = node.frame(future=_True)
for parent in node.node_ancestors():
if parent is frame:
break
if isinstance(parent, nodes.Return):
return _True
return _False
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 110 | frame | ref | function | frame = node.frame(future=True)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 111 | node_ancestors | ref | function | for parent in node.node_ancestors():
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 119 | _is_part_of_with_items | def | function | def _is_part_of_with_items(node: nodes.Call) -> bool:
"""Checks if one of the node's parents is a ``nodes.With`` node and that the node itself is located
somewhere under its ``items``.
"""
frame = node.frame(future=_True)
current = node
while current != frame:
if isinstance(current, node... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 123 | frame | ref | function | frame = node.frame(future=True)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 134 | _will_be_released_automatically | def | function | def _will_be_released_automatically(node: nodes.Call) -> bool:
"""Checks if a call that could be used in a ``with`` statement is used in an alternative
construct which would ensure that its __exit__ method is called.
"""
callables_taking_care_of_exit = frozenset(
(
"contextlib._BaseE... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 146 | safe_infer | ref | function | func = utils.safe_infer(node.parent.func)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 149 | qname | ref | function | return func.qname() in callables_taking_care_of_exit
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 152 | ConsiderUsingWithStack | def | class | __iter__ get_stack_for_frame clear_all |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 164 | get_stack_for_frame | def | function | def get_stack_for_frame(
self, frame: Union[nodes.FunctionDef, nodes.ClassDef, nodes.Module]
):
"""Get the stack corresponding to the scope of the given frame."""
if isinstance(frame, nodes.FunctionDef):
return self.function_scope
if isinstance(frame, nodes.ClassDef):... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 174 | clear_all | def | function | def clear_all(self) -> None:
"""Convenience method to clear all stacks."""
for stack in self:
stack.clear()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 180 | RefactoringChecker | def | class | __init__ _init open _dummy_rgx _is_bool_const _is_actual_elif _check_simplifiable_if process_tokens leave_module visit_tryexcept _check_redefined_argument_from_local visit_for visit_excepthandler visit_with _check_superfluous_else _check_superfluous_else_return _check_superfluous_else_raise _check_superfluous_else_brea... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 461 | ConsiderUsingWithStack | ref | function | self._consider_using_with_stack = ConsiderUsingWithStack()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 462 | _init | ref | function | self._init()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 465 | _init | def | function | def _init(self):
self._nested_blocks = []
self._elifs = []
self._nested_blocks_msg = None
self._reported_swap_nodes = set()
self._can_simplify_bool_op = _False
self._consider_using_with_stack.clear_all()
def open(self):
# do this in open since config not ... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 471 | clear_all | ref | function | self._consider_using_with_stack.clear_all()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 478 | _dummy_rgx | def | function | def _dummy_rgx(self):
return lint_utils.get_global_option(self, "dummy-variables-rgx", default=None)
@staticmethod
def _is_bool_const(node):
return isinstance(node.value, nodes.Const) and isinstance(
node.value.value, bool
)
def _is_actual_elif(self, node):
... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 479 | get_global_option | ref | function | return lint_utils.get_global_option(self, "dummy-variables-rgx", default=None)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 482 | _is_bool_const | def | function | def _is_bool_const(node):
return isinstance(node.value, nodes.Const) and isinstance(
node.value.value, bool
)
def _is_actual_elif(self, node):
"""Check if the given node is an actual elif.
This is a problem we're having with the builtin ast module,
which spl... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 487 | _is_actual_elif | def | function | def _is_actual_elif(self, node):
"""Check if the given node is an actual elif.
This is a problem we're having with the builtin ast module,
which splits `elif` branches into a separate if statement.
Unfortunately we need to know the exact type in certain
cases.
"""
... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 503 | _check_simplifiable_if | def | function | def _check_simplifiable_if(self, node):
"""Check if the given if node can be simplified.
The if statement can be reduced to a boolean expression
in some cases. For instance, if there are two branches
and both of them return a boolean value that depends on
the result of the s... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 513 | _is_actual_elif | ref | function | if self._is_actual_elif(node):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 525 | _is_bool_const | ref | function | first_branch_is_bool = self._is_bool_const(first_branch)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 526 | _is_bool_const | ref | function | else_branch_is_bool = self._is_bool_const(else_branch)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 548 | _is_bool_const | ref | function | first_branch_is_bool = self._is_bool_const(first_branch)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 549 | _is_bool_const | ref | function | else_branch_is_bool = self._is_bool_const(else_branch)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 572 | add_message | ref | function | self.add_message("simplifiable-if-statement", node=node, args=(reduced_to,))
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 574 | process_tokens | def | function | def process_tokens(self, tokens):
# Process tokens and look for 'if' or 'elif'
for index, token in enumerate(tokens):
token_string = token[1]
if token_string == "elif":
# AST exists by the time process_tokens is called, so
# it's safe to assume... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 586 | _is_trailing_comma | ref | function | elif _is_trailing_comma(tokens, index):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 587 | is_message_enabled | ref | function | if self.linter.is_message_enabled("trailing-comma-tuple"):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 588 | add_message | ref | function | self.add_message("trailing-comma-tuple", line=token.start[0])
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 590 | check_messages | ref | function | @utils.check_messages("consider-using-with")
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 591 | leave_module | def | function | def leave_module(self, _: nodes.Module) -> None:
# check for context managers that have been created but not used
self._emit_consider_using_with_if_needed(
self._consider_using_with_stack.module_scope
)
self._init()
@utils.check_messages("too-many-nested-blocks")
... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 593 | _emit_consider_using_with_if_needed | ref | function | self._emit_consider_using_with_if_needed(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 596 | _init | ref | function | self._init()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 598 | check_messages | ref | function | @utils.check_messages("too-many-nested-blocks")
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 599 | visit_tryexcept | def | function | def visit_tryexcept(self, node: nodes.TryExcept) -> None:
self._check_nested_blocks(node)
visit_tryfinally = visit_tryexcept
visit_while = visit_tryexcept
def _check_redefined_argument_from_local(self, name_node):
if self._dummy_rgx and self._dummy_rgx.match(name_node.name):
... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 600 | _check_nested_blocks | ref | function | self._check_nested_blocks(node)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 605 | _check_redefined_argument_from_local | def | function | def _check_redefined_argument_from_local(self, name_node):
if self._dummy_rgx and self._dummy_rgx.match(name_node.name):
return
if not name_node.lineno:
# Unknown position, maybe it is a manually built AST?
return
scope = name_node.scope()
if not ... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 606 | match | ref | function | if self._dummy_rgx and self._dummy_rgx.match(name_node.name):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 612 | scope | ref | function | scope = name_node.scope()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 616 | nodes_of_class | ref | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 620 | add_message | ref | function | self.add_message(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 626 | check_messages | ref | function | @utils.check_messages(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 631 | visit_for | def | function | def visit_for(self, node: nodes.For) -> None:
self._check_nested_blocks(node)
self._check_unnecessary_dict_index_lookup(node)
for name in node.target.nodes_of_class(nodes.AssignName):
self._check_redefined_argument_from_local(name)
@utils.check_messages("redefined-argument-... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 632 | _check_nested_blocks | ref | function | self._check_nested_blocks(node)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 633 | _check_unnecessary_dict_index_lookup | ref | function | self._check_unnecessary_dict_index_lookup(node)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 635 | nodes_of_class | ref | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 636 | _check_redefined_argument_from_local | ref | function | self._check_redefined_argument_from_local(name)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 638 | check_messages | ref | function | @utils.check_messages("redefined-argument-from-local")
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 639 | visit_excepthandler | def | function | def visit_excepthandler(self, node: nodes.ExceptHandler) -> None:
if node.name and isinstance(node.name, nodes.AssignName):
self._check_redefined_argument_from_local(node.name)
@utils.check_messages("redefined-argument-from-local")
def visit_with(self, node: nodes.With) -> None:
... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 641 | _check_redefined_argument_from_local | ref | function | self._check_redefined_argument_from_local(node.name)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 643 | check_messages | ref | function | @utils.check_messages("redefined-argument-from-local")
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 644 | visit_with | def | function | def visit_with(self, node: nodes.With) -> None:
for var, names in node.items:
if isinstance(var, nodes.Name):
for stack in self._consider_using_with_stack:
# We don't need to restrict the stacks we search to the current scope and outer scopes,
... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 655 | nodes_of_class | ref | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 656 | _check_redefined_argument_from_local | ref | function | self._check_redefined_argument_from_local(name)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 658 | _check_superfluous_else | def | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 663 | _is_actual_elif | ref | function | if self._is_actual_elif(node):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 667 | _if_statement_is_always_returning | ref | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 673 | add_message | ref | function | self.add_message(msg_id, node=node, args=args)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 675 | _check_superfluous_else_return | def | function | def _check_superfluous_else_return(self, node):
return self._check_superfluous_else(
node, msg_id="no-else-return", returning_node_class=nodes.Return
)
def _check_superfluous_else_raise(self, node):
return self._check_superfluous_else(
node, msg_id="no-else-raise... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 676 | _check_superfluous_else | ref | function | return self._check_superfluous_else(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 680 | _check_superfluous_else_raise | def | function | def _check_superfluous_else_raise(self, node):
return self._check_superfluous_else(
node, msg_id="no-else-raise", returning_node_class=nodes.Raise
)
def _check_superfluous_else_break(self, node):
return self._check_superfluous_else(
node, msg_id="no-else-break", ... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 681 | _check_superfluous_else | ref | function | return self._check_superfluous_else(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 685 | _check_superfluous_else_break | def | function | def _check_superfluous_else_break(self, node):
return self._check_superfluous_else(
node, msg_id="no-else-break", returning_node_class=nodes.Break
)
def _check_superfluous_else_continue(self, node):
return self._check_superfluous_else(
node, msg_id="no-else-conti... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 686 | _check_superfluous_else | ref | function | return self._check_superfluous_else(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 690 | _check_superfluous_else_continue | def | function | def _check_superfluous_else_continue(self, node):
return self._check_superfluous_else(
node, msg_id="no-else-continue", returning_node_class=nodes.Continue
)
@staticmethod
def _type_and_name_are_equal(node_a, node_b):
for _type in (nodes.Name, nodes.AssignName):
... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 691 | _check_superfluous_else | ref | function | return self._check_superfluous_else(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 696 | _type_and_name_are_equal | def | function | def _type_and_name_are_equal(node_a, node_b):
for _type in (nodes.Name, nodes.AssignName):
if all(isinstance(_node, _type) for _node in (node_a, node_b)):
return node_a.name == node_b.name
if all(isinstance(_node, nodes.Const) for _node in (node_a, node_b)):
r... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 704 | _is_dict_get_block | def | function | def _is_dict_get_block(self, node):
# "if <compare node>"
if not isinstance(node.test, nodes.Compare):
return _False
# Does not have a single statement in the guard's body
if len(node.body) != 1:
return _False
# Look for a single variable assignment... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 727 | _type_and_name_are_equal | ref | function | self._type_and_name_are_equal(stmt.value.value, node.test.ops[0][1])
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 728 | _type_and_name_are_equal | ref | function | and self._type_and_name_are_equal(slice_value, node.test.left)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 733 | safe_infer | ref | function | return isinstance(utils.safe_infer(node.test.ops[0][1]), nodes.Dict)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 735 | _check_consider_get | def | function | def _check_consider_get(self, node):
if_block_ok = self._is_dict_get_block(node)
if if_block_ok and not node.orelse:
self.add_message("consider-using-get", node=node)
elif (
if_block_ok
and len(node.orelse) == 1
and isinstance(node.orelse[0], n... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 736 | _is_dict_get_block | ref | function | if_block_ok = self._is_dict_get_block(node)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 738 | add_message | ref | function | self.add_message("consider-using-get", node=node)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 743 | _type_and_name_are_equal | ref | function | and self._type_and_name_are_equal(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 748 | add_message | ref | function | self.add_message("consider-using-get", node=node)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 750 | check_messages | ref | function | @utils.check_messages(
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 759 | visit_if | def | function | def visit_if(self, node: nodes.If) -> None:
self._check_simplifiable_if(node)
self._check_nested_blocks(node)
self._check_superfluous_else_return(node)
self._check_superfluous_else_raise(node)
self._check_superfluous_else_break(node)
self._check_superfluous_else_conti... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/refactoring/refactoring_checker.py | pylint/checkers/refactoring/refactoring_checker.py | 760 | _check_simplifiable_if | ref | function | self._check_simplifiable_if(node)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.