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/utils.py
pylint/checkers/utils.py
1,448
is_subtype
ref
function
if astroid.helpers.is_subtype(ancestor, parent):
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,456
is_overload_stub
def
function
def is_overload_stub(node: nodes.NodeNG) -> bool: """Check if a node is a function stub decorated with typing.overload. :param node: Node to check. :returns: _True if node is an overload function stub. _False otherwise. """ decorators = getattr(node, "decorators", None) return bool(decorators a...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,463
decorated_with
ref
function
return bool(decorators and decorated_with(node, ["typing.overload", "overload"]))
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,466
is_protocol_class
def
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,477
qname
ref
function
return any(parent.qname() in TYPING_PROTOCOLS for parent in cls.ancestors())
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,477
ancestors
ref
function
return any(parent.qname() in TYPING_PROTOCOLS for parent in cls.ancestors())
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,480
is_call_of_name
def
function
def is_call_of_name(node: nodes.NodeNG, name: str) -> bool: """Checks if node is a function call with the given name.""" return ( isinstance(node, nodes.Call) and isinstance(node.func, nodes.Name) and node.func.name == name )
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,489
is_test_condition
def
function
def is_test_condition( node: nodes.NodeNG, parent: nodes.NodeNG | None = None,
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,496
parent_of
ref
function
return node is parent.test or parent.test.parent_of(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,499
is_call_of_name
ref
function
return is_call_of_name(parent, "bool") and parent.parent_of(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,499
parent_of
ref
function
return is_call_of_name(parent, "bool") and parent.parent_of(node)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,502
is_classdef_type
def
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,509
is_attribute_typed_annotation
def
function
def is_attribute_typed_annotation( node: nodes.ClassDef | astroid.Instance, attr_name: str
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,523
safe_infer
ref
function
inferred = safe_infer(base)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,527
is_attribute_typed_annotation
ref
function
and is_attribute_typed_annotation(inferred, attr_name)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,533
is_assign_name_annotated_with
def
function
def is_assign_name_annotated_with(node: nodes.AssignName, typing_name: str) -> bool: """Test if AssignName node has `typing_name` annotation. Especially useful to check for `typing._SpecialForm` instances like: `Union`, `Optional`, `Literal`, `ClassVar`, `Final`. """ if not isinstance(node.parent, ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,554
get_iterating_dictionary_name
def
function
def get_iterating_dictionary_name(node: nodes.For | nodes.Comprehension) -> str | None: """Get the name of the dictionary which keys are being iterated over on a ``nodes.For`` or ``nodes.Comprehension`` node. If the iterating object is not either the keys method of a dictionary or a dictionary itself, ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,567
safe_infer
ref
function
inferred = safe_infer(node.iter.func)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,570
as_string
ref
function
return node.iter.as_string().rpartition(".keys")[0]
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,574
safe_infer
ref
function
inferred = safe_infer(node.iter)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,577
as_string
ref
function
return node.iter.as_string()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,582
get_subscript_const_value
def
function
def get_subscript_const_value(node: nodes.Subscript) -> nodes.Const: """Returns the value 'subscript.slice' of a Subscript node. :param node: Subscript Node to extract value from :returns: Const Node containing subscript value :raises InferredTypeError: if the subscript node cannot be inferred as a Con...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,589
safe_infer
ref
function
inferred = safe_infer(node.slice)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,591
InferredTypeError
ref
function
raise InferredTypeError("Subscript.slice cannot be inferred as a nodes.Const")
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,596
get_import_name
def
function
def get_import_name(importnode: nodes.Import | nodes.ImportFrom, modname: str) -> str: """Get a prepared module name from the given import node. In the case of relative imports, this will return the absolute qualified module name, which might be useful for debugging. Otherwise, the initial module name ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,610
root
ref
function
root = importnode.root()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,613
relative_to_absolute_name
ref
function
return root.relative_to_absolute_name(modname, level=importnode.level)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,619
is_sys_guard
def
function
def is_sys_guard(node: nodes.If) -> bool: """Return _True if IF stmt is a sys.version_info guard. >>> import sys >>> if sys.version_info > (3, 8): >>> from typing import Literal >>> else: >>> from typing_extensions import Literal """ if isinstance(node.test, nodes.Compare): ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,634
as_string
ref
function
and value.as_string() == "sys.version_info"
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,641
is_typing_guard
def
function
def is_typing_guard(node: nodes.If) -> bool: """Return _True if IF stmt is a typing guard. >>> from typing import TYPE_CHECKING >>> if TYPE_CHECKING: >>> from xyz import a """ return isinstance( node.test, (nodes.Name, nodes.Attribute) ) and node.test.as_string().endswith("TYPE_...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,650
as_string
ref
function
) and node.test.as_string().endswith("TYPE_CHECKING")
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,653
is_node_in_typing_guarded_import_block
def
function
def is_node_in_typing_guarded_import_block(node: nodes.NodeNG) -> bool: """Return _True if node is part for guarded `typing.TYPE_CHECKING` if block.""" return isinstance(node.parent, nodes.If) and is_typing_guard(node.parent)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,655
is_typing_guard
ref
function
return isinstance(node.parent, nodes.If) and is_typing_guard(node.parent)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,658
is_node_in_guarded_import_block
def
function
def is_node_in_guarded_import_block(node: nodes.NodeNG) -> bool: """Return _True if node is part for guarded if block. I.e. `sys.version_info` or `typing.TYPE_CHECKING` """ return isinstance(node.parent, nodes.If) and ( is_sys_guard(node.parent) or is_typing_guard(node.parent) )
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,664
is_sys_guard
ref
function
is_sys_guard(node.parent) or is_typing_guard(node.parent)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,664
is_typing_guard
ref
function
is_sys_guard(node.parent) or is_typing_guard(node.parent)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,668
is_reassigned_after_current
def
function
def is_reassigned_after_current(node: nodes.NodeNG, varname: str) -> bool: """Check if the given variable name is reassigned in the same scope after the current node.""" return any( a.name == varname and a.lineno > node.lineno for a in node.scope().nodes_of_class( (nodes.AssignName, ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,672
scope
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,672
nodes_of_class
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,678
is_deleted_after_current
def
function
def is_deleted_after_current(node: nodes.NodeNG, varname: str) -> bool: """Check if the given variable name is deleted in the same scope after the current node.""" return any( getattr(target, "name", None) == varname and target.lineno > node.lineno for del_node in node.scope().nodes_of_class(nod...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,682
scope
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,682
nodes_of_class
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,687
is_function_body_ellipsis
def
function
def is_function_body_ellipsis(node: nodes.FunctionDef) -> bool: """Checks whether a function body only consists of a single Ellipsis.""" return ( len(node.body) == 1 and isinstance(node.body[0], nodes.Expr) and isinstance(node.body[0].value, nodes.Const) and node.body[0].value.va...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,697
is_base_container
def
function
def is_base_container(node: nodes.NodeNG | None) -> bool: return isinstance(node, nodes.BaseContainer) and not node.elts
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,701
is_empty_dict_literal
def
function
def is_empty_dict_literal(node: nodes.NodeNG | None) -> bool: return isinstance(node, nodes.Dict) and not node.items
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,705
is_empty_str_literal
def
function
def is_empty_str_literal(node: nodes.NodeNG | None) -> bool: return ( isinstance(node, nodes.Const) and isinstance(node.value, str) and not node.value )
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,711
returns_bool
def
function
def returns_bool(node: nodes.NodeNG) -> bool: """Returns true if a node is a return that returns a constant boolean.""" return ( isinstance(node, nodes.Return) and isinstance(node.value, nodes.Const) and node.value.value in {_True, _False} )
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,720
get_node_first_ancestor_of_type
def
function
def get_node_first_ancestor_of_type( node: nodes.NodeNG, ancestor_type: type[_NodeT] | tuple[type[_NodeT], ...]
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,724
node_ancestors
ref
function
for ancestor in node.node_ancestors():
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,730
get_node_first_ancestor_of_type_and_its_child
def
function
def get_node_first_ancestor_of_type_and_its_child( node: nodes.NodeNG, ancestor_type: type[_NodeT] | tuple[type[_NodeT], ...]
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,740
node_ancestors
ref
function
for ancestor in node.node_ancestors():
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,747
in_type_checking_block
def
function
def in_type_checking_block(node: nodes.NodeNG) -> bool: """Check if a node is guarded by a TYPE_CHECKS guard.""" return any( isinstance(ancestor, nodes.If) and ancestor.test.as_string() in TYPING_TYPE_CHECKS_GUARDS for ancestor in node.node_ancestors() )
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,751
as_string
ref
function
and ancestor.test.as_string() in TYPING_TYPE_CHECKS_GUARDS
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,752
node_ancestors
ref
function
for ancestor in node.node_ancestors()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,757
in_for_else_branch
def
function
def in_for_else_branch(parent: nodes.NodeNG, stmt: nodes.Statement) -> bool: """Returns _True if stmt is inside the else branch for a parent For stmt.""" return isinstance(parent, nodes.For) and any( else_stmt.parent_of(stmt) or else_stmt == stmt for else_stmt in parent.orelse )
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/utils.py
pylint/checkers/utils.py
1,760
parent_of
ref
function
else_stmt.parent_of(stmt) or else_stmt == stmt for else_stmt in parent.orelse
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
109
VariableVisitConsumerAction
def
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
121
_is_from_future_import
def
function
def _is_from_future_import(stmt, name): """Check if the name is a future import from another module.""" try: module = stmt.do_import_module(stmt.modname) except astroid.AstroidBuildingException: return None for local_node in module.locals.get(name, []): if isinstance(local_node,...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
124
do_import_module
ref
function
module = stmt.do_import_module(stmt.modname)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
135
overridden_method
def
function
def overridden_method(klass, name): """Get overridden method if any.""" try: parent = next(klass.local_attr_ancestors(name)) except (StopIteration, KeyError): return None try: meth_node = parent[name] except KeyError: # We have found an ancestor defining <name> but it...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
138
local_attr_ancestors
ref
function
parent = next(klass.local_attr_ancestors(name))
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
152
_get_unpacking_extra_info
def
function
def _get_unpacking_extra_info(node, inferred): """Return extra information to add to the message for unpacking-non-sequence and unbalanced-tuple-unpacking errors. """ more = "" inferred_module = inferred.root().name if node.root().name == inferred_module: if node.lineno == inferred.linen...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
157
root
ref
function
inferred_module = inferred.root().name
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
158
root
ref
function
if node.root().name == inferred_module:
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
160
as_string
ref
function
more = f" {inferred.as_string()}"
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
168
_detect_global_scope
def
function
def _detect_global_scope(node, frame, defframe): """Detect that the given frames share a global scope. Two frames share a global scope when neither of them are hidden under a function scope, as well as any parent scope of them, until the root scope. In this case, depending from something defined la...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
193
scope
ref
function
scope = frame.parent.scope()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
195
scope
ref
function
def_scope = defframe.parent.scope()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
199
get_node_first_ancestor_of_type
ref
function
and scope is utils.get_node_first_ancestor_of_type(node, nodes.FunctionDef)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
231
scope
ref
function
parent_scope = parent_scope.parent.scope()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
247
_infer_name_module
def
function
def _infer_name_module(node, name): context = astroid.context.InferenceContext() context.lookupname = name return node.infer(context, asname=_False)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
248
InferenceContext
ref
function
context = astroid.context.InferenceContext()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
250
infer
ref
function
return node.infer(context, asname=False)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
253
_fix_dot_imports
def
function
def _fix_dot_imports(not_consumed): """Try to fix imports with multiple dots, by returning a dictionary with the import names expanded. The function unflattens root imports, like 'xml' (when we have both 'xml.etree' and 'xml.sax'), to 'xml.etree' and 'xml.sax' respectively. """ names = {} ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
265
assign_type
ref
function
and isinstance(stmt.assign_type(), nodes.AugAssign)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
297
_find_frame_imports
def
function
def _find_frame_imports(name, frame): """Detect imports in the frame, with the required *name*. Such imports can be considered assignments. Returns _True if an import for the given name was found. """ imports = frame.nodes_of_class((nodes.Import, nodes.ImportFrom)) for import_node in imports: ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
303
nodes_of_class
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
316
_import_name_is_global
def
function
def _import_name_is_global(stmt, global_names): for import_name, import_alias in stmt.names: # If the import uses an alias, check only that. # Otherwise, check only the import name. if import_alias: if import_alias in global_names: return _True elif import...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
328
_flattened_scope_names
def
function
def _flattened_scope_names( iterator: Iterator[nodes.Global | nodes.Nonlocal],
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
332
from_iterable
ref
function
return set(itertools.chain.from_iterable(values))
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
335
_assigned_locally
def
function
def _assigned_locally(name_node): """Checks if name_node has corresponding assign statement in same scope.""" assign_stmts = name_node.scope().nodes_of_class(nodes.AssignName) return any(a.name == name_node.name for a in assign_stmts)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
337
scope
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
337
nodes_of_class
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
341
_has_locals_call_after_node
def
function
def _has_locals_call_after_node(stmt, scope): skip_nodes = ( nodes.FunctionDef, nodes.ClassDef, nodes.Import, nodes.ImportFrom, ) for call in scope.nodes_of_class(nodes.Call, skip_klass=skip_nodes): inferred = utils.safe_infer(call.func) if ( utils...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
348
nodes_of_class
ref
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
349
safe_infer
ref
function
inferred = utils.safe_infer(call.func)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
351
is_builtin_object
ref
function
utils.is_builtin_object(inferred)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
501
ScopeConsumer
def
class
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
510
NamesConsumer
def
class
__init__ __repr__ __iter__ to_consume consumed consumed_uncertain scope_type mark_as_consumed get_next_to_consume _uncertain_nodes_in_except_blocks _defines_name_raises_or_returns _check_loop_finishes_via_except _recursive_search_for_continue_before_break _uncertain_nodes_in_try_blocks_when_evaluating_except_blocks _un...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
514
ScopeConsumer
ref
function
self._atomic = ScopeConsumer(
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
539
to_consume
def
function
def to_consume(self): return self._atomic.to_consume @property def consumed(self): return self._atomic.consumed @property def consumed_uncertain(self) -> defaultdict[str, list[nodes.NodeNG]]: """Retrieves nodes filtered out by get_next_to_consume() that may not have...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
543
consumed
def
function
def consumed(self): return self._atomic.consumed @property def consumed_uncertain(self) -> defaultdict[str, list[nodes.NodeNG]]: """Retrieves nodes filtered out by get_next_to_consume() that may not have executed. These include nodes such as statements in except blocks, or ...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
547
consumed_uncertain
def
function
def consumed_uncertain(self) -> defaultdict[str, list[nodes.NodeNG]]: """Retrieves nodes filtered out by get_next_to_consume() that may not have executed. These include nodes such as statements in except blocks, or statements in try blocks (when evaluating their corresponding except...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
559
scope_type
def
function
def scope_type(self): return self._atomic.scope_type def mark_as_consumed(self, name, consumed_nodes): """Mark the given nodes as consumed for the name. If all of the nodes for the name were consumed, delete the name from the to_consume dictionary """ unconsumed...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
562
mark_as_consumed
def
function
def mark_as_consumed(self, name, consumed_nodes): """Mark the given nodes as consumed for the name. If all of the nodes for the name were consumed, delete the name from the to_consume dictionary """ unconsumed = [n for n in self.to_consume[name] if n not in set(consumed_node...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
576
get_next_to_consume
def
function
def get_next_to_consume(self, node: nodes.Name) -> list[nodes.NodeNG] | None: """Return a list of the nodes that define `node` from this scope. If it is uncertain whether a node will be consumed, such as for statements in except blocks, add it to self.consumed_uncertain instead of returning...
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
586
statement
ref
function
node_statement = node.statement(future=True)
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
607
frame
ref
function
for child in node.frame(future=True).get_children()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
607
get_children
ref
function
for child in node.frame(future=True).get_children()
playground/2af25c45-9624-42e9-b1b3-5ecb19e13cc8/pylint/pylint/checkers/variables.py
pylint/checkers/variables.py
612
_comprehension_between_frame_and_node
ref
function
if VariablesChecker._comprehension_between_frame_and_node(node):