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/utils.py | pylint/checkers/utils.py | 1,287 | has_known_bases | def | function | def has_known_bases(klass: nodes.ClassDef, context=None) -> bool:
"""Return true if all base classes of a class could be inferred."""
try:
return klass._all_bases_known
except AttributeError:
pass
for base in klass.bases:
result = safe_infer(base, context=context)
if (
... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,294 | safe_infer | ref | function | result = safe_infer(base, context=context)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,298 | has_known_bases | ref | function | or not has_known_bases(result, context=context)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,306 | is_none | def | function | def is_none(node: nodes.NodeNG) -> bool:
return (
node is None
or (isinstance(node, nodes.Const) and node.value is None)
or (isinstance(node, nodes.Name) and node.name == "None")
)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,314 | node_type | def | function | def node_type(node: nodes.NodeNG) -> Optional[nodes.NodeNG]:
"""Return the inferred type for `node`.
If there is more than one possible type, or if inferred type is Uninferable or None,
return None
"""
# check there is only one possible type for the assign node. Else we
# don't handle it for no... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,324 | infer | ref | function | for var_type in node.infer():
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,325 | is_none | ref | function | if var_type == astroid.Uninferable or is_none(var_type):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,335 | is_registered_in_singledispatch_function | def | function | def is_registered_in_singledispatch_function(node: nodes.FunctionDef) -> bool:
"""Check if the given function node is a singledispatch function."""
singledispatch_qnames = (
"functools.singledispatch",
"singledispatch.singledispatch",
)
if not isinstance(node, nodes.FunctionDef):
... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,357 | infer | ref | function | func_def = next(func.expr.infer())
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,362 | decorated_with | ref | function | return decorated_with(func_def, singledispatch_qnames)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,367 | get_node_last_lineno | def | function | def get_node_last_lineno(node: nodes.NodeNG) -> int:
"""Get the last lineno of the given node. For a simple statement this will just be node.lineno,
but for a node that has child statements (e.g. a method) this will be the lineno of the last
child statement recursively.
"""
# 'finalbody' is always t... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,374 | get_node_last_lineno | ref | function | return get_node_last_lineno(node.finalbody[-1])
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,378 | get_node_last_lineno | ref | function | return get_node_last_lineno(node.orelse[-1])
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,381 | get_node_last_lineno | ref | function | return get_node_last_lineno(node.handlers[-1])
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,384 | get_node_last_lineno | ref | function | return get_node_last_lineno(node.body[-1])
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,389 | is_postponed_evaluation_enabled | def | function | def is_postponed_evaluation_enabled(node: nodes.NodeNG) -> bool:
"""Check if the postponed evaluation of annotations is enabled."""
module = node.root()
return "annotations" in module.future_imports
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,391 | root | ref | function | module = node.root()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,395 | is_class_subscriptable_pep585_with_postponed_evaluation_enabled | def | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,402 | is_postponed_evaluation_enabled | ref | function | is_postponed_evaluation_enabled(node)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,403 | qname | ref | function | and value.qname() in SUBSCRIPTABLE_CLASSES_PEP585
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,404 | is_node_in_type_annotation_context | ref | function | and is_node_in_type_annotation_context(node)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,408 | is_node_in_type_annotation_context | def | function | def is_node_in_type_annotation_context(node: nodes.NodeNG) -> bool:
"""Check if node is in type annotation context.
Check for 'AnnAssign', function 'Arguments',
or part of function return type anntation.
"""
# pylint: disable=too-many-boolean-expressions
current_node, parent_node = node, node.p... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,438 | is_subclass_of | def | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,447 | ancestors | ref | function | for ancestor in child.ancestors():
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,449 | is_subtype | ref | function | if astroid.helpers.is_subtype(ancestor, parent):
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,457 | 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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,464 | decorated_with | ref | function | return bool(decorators and decorated_with(node, ["typing.overload", "overload"]))
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,467 | is_protocol_class | def | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,478 | qname | ref | function | return any(parent.qname() in TYPING_PROTOCOLS for parent in cls.ancestors())
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,478 | ancestors | ref | function | return any(parent.qname() in TYPING_PROTOCOLS for parent in cls.ancestors())
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,481 | 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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,490 | is_test_condition | def | function | def is_test_condition(
node: nodes.NodeNG,
parent: Optional[nodes.NodeNG] = None,
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,497 | parent_of | ref | function | return node is parent.test or parent.test.parent_of(node)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,500 | is_call_of_name | ref | function | return is_call_of_name(parent, "bool") and parent.parent_of(node)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,500 | parent_of | ref | function | return is_call_of_name(parent, "bool") and parent.parent_of(node)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,503 | is_classdef_type | def | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,510 | is_attribute_typed_annotation | def | function | def is_attribute_typed_annotation(
node: Union[nodes.ClassDef, astroid.Instance], attr_name: str
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,524 | safe_infer | ref | function | inferred = safe_infer(base)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,528 | is_attribute_typed_annotation | ref | function | and is_attribute_typed_annotation(inferred, attr_name)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,534 | 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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,555 | get_iterating_dictionary_name | def | function | def get_iterating_dictionary_name(
node: Union[nodes.For, nodes.Comprehension]
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,570 | safe_infer | ref | function | inferred = safe_infer(node.iter.func)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,573 | as_string | ref | function | return node.iter.as_string().rpartition(".keys")[0]
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,577 | safe_infer | ref | function | inferred = safe_infer(node.iter)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,580 | as_string | ref | function | return node.iter.as_string()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,585 | 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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,592 | safe_infer | ref | function | inferred = safe_infer(node.slice)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,594 | InferredTypeError | ref | function | raise InferredTypeError("Subscript.slice cannot be inferred as a nodes.Const")
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,599 | get_import_name | def | function | def get_import_name(
importnode: Union[nodes.Import, nodes.ImportFrom], modname: str
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,615 | root | ref | function | root = importnode.root()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,618 | relative_to_absolute_name | ref | function | return root.relative_to_absolute_name(modname, level=importnode.level)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,624 | 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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,639 | as_string | ref | function | and value.as_string() == "sys.version_info"
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,646 | 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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,655 | as_string | ref | function | ) and node.test.as_string().endswith("TYPE_CHECKING")
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,663 | is_sys_guard | ref | function | is_sys_guard(node.parent) or is_typing_guard(node.parent)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,663 | is_typing_guard | ref | function | is_sys_guard(node.parent) or is_typing_guard(node.parent)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,667 | 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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,671 | scope | ref | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,671 | nodes_of_class | ref | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,677 | 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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,681 | scope | ref | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,681 | nodes_of_class | ref | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,686 | 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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,696 | is_base_container | def | function | def is_base_container(node: Optional[nodes.NodeNG]) -> bool:
return isinstance(node, nodes.BaseContainer) and not node.elts
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,700 | is_empty_dict_literal | def | function | def is_empty_dict_literal(node: Optional[nodes.NodeNG]) -> bool:
return isinstance(node, nodes.Dict) and not node.items
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,704 | is_empty_str_literal | def | function | def is_empty_str_literal(node: Optional[nodes.NodeNG]) -> bool:
return (
isinstance(node, nodes.Const) and isinstance(node.value, str) and not node.value
)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,710 | 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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,719 | get_node_first_ancestor_of_type | def | function | def get_node_first_ancestor_of_type(
node: nodes.NodeNG, ancestor_type: Union[Type[T_Node], Tuple[Type[T_Node], ...]]
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,723 | node_ancestors | ref | function | for ancestor in node.node_ancestors():
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,729 | 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: Union[Type[T_Node], Tuple[Type[T_Node], ...]]
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/utils.py | pylint/checkers/utils.py | 1,738 | node_ancestors | ref | function | for ancestor in node.node_ancestors():
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 165 | VariableVisitConsumerAction | def | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 177 | _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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 180 | do_import_module | ref | function | module = stmt.do_import_module(stmt.modname)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 190 | in_for_else_branch | def | function | def in_for_else_branch(parent, stmt):
"""Returns _True if stmt in 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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 193 | parent_of | ref | function | else_stmt.parent_of(stmt) or else_stmt == stmt for else_stmt in parent.orelse
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 198 | 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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 201 | local_attr_ancestors | ref | function | parent = next(klass.local_attr_ancestors(name))
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 215 | _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.lineno... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 220 | root | ref | function | inferred_module = inferred.root().name
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 221 | root | ref | function | if node.root().name == inferred_module:
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 223 | as_string | ref | function | more = f" {inferred.as_string()}"
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 231 | _detect_global_scope | def | function | def _detect_global_scope(node, frame, defframe):
"""Detect that the given frames shares a global
scope.
Two frames shares a global scope when neither
of them are hidden under a function scope, as well
as any of parent scope of them, until the root scope.
In this case, depending from something d... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 250 | scope | ref | function | scope = frame.parent.scope()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 252 | scope | ref | function | def_scope = defframe.parent.scope()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 280 | scope | ref | function | parent_scope = parent_scope.parent.scope()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 296 | _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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 297 | InferenceContext | ref | function | context = astroid.context.InferenceContext()
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 299 | infer | ref | function | return node.infer(context, asname=False)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 302 | _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 = {}
fo... |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 312 | assign_type | ref | function | and isinstance(stmt.assign_type(), nodes.AugAssign)
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 344 | _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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 349 | nodes_of_class | ref | class | |
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 362 | _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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 374 | _flattened_scope_names | def | function | def _flattened_scope_names(iterator):
values = (set(stmt.names) for stmt in iterator)
return set(itertools.chain.from_iterable(values))
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 376 | from_iterable | ref | function | return set(itertools.chain.from_iterable(values))
|
playground/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 379 | _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/e9b22a58-260b-483f-88d7-7a5fe9f8b1d4/pylint/pylint/checkers/variables.py | pylint/checkers/variables.py | 381 | scope | ref | class |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.