Skip to content

Commit

Permalink
Fix most of the mypy errors in astroid/nodes/as_string.py
Browse files Browse the repository at this point in the history
  • Loading branch information
correctmost committed Sep 7, 2024
1 parent 887668b commit 9c99e92
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 95 deletions.
6 changes: 3 additions & 3 deletions astroid/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(
}

@classmethod
def from_call(cls, call_node, context: InferenceContext | None = None):
def from_call(cls, call_node: nodes.Call, context: InferenceContext | None = None):
"""Get a CallSite object from the given Call node.
context will be used to force a single inference path.
Expand All @@ -65,7 +65,7 @@ def from_call(cls, call_node, context: InferenceContext | None = None):
callcontext = CallContext(call_node.args, call_node.keywords)
return cls(callcontext, context=context)

def has_invalid_arguments(self):
def has_invalid_arguments(self) -> bool:
"""Check if in the current CallSite were passed *invalid* arguments.
This can mean multiple things. For instance, if an unpacking
Expand All @@ -89,7 +89,7 @@ def _unpack_keywords(
self,
keywords: list[tuple[str | None, nodes.NodeNG]],
context: InferenceContext | None = None,
):
) -> dict[str | None, InferenceResult]:
values: dict[str | None, InferenceResult] = {}
context = context or InferenceContext()
context.extra_context = self.argument_context_map
Expand Down
2 changes: 1 addition & 1 deletion astroid/brain/brain_builtin_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def _infer_builtin_container(


def _get_elts(arg, context):
def is_iterable(n):
def is_iterable(n) -> bool:
return isinstance(n, (nodes.List, nodes.Tuple, nodes.Set))

try:
Expand Down
2 changes: 1 addition & 1 deletion astroid/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def sort_locals(my_list: list[nodes.NodeNG]) -> None:
sort_locals(node.parent.scope().locals[asname or name]) # type: ignore[arg-type]

def delayed_assattr(self, node: nodes.AssignAttr) -> None:
"""Visit a AssAttr node.
"""Visit an AssignAttr node.
This adds name to locals and handle members definition.
"""
Expand Down
Loading

0 comments on commit 9c99e92

Please sign in to comment.