Skip to content

Commit 92baf78

Browse files
pre-commit-ci[bot]jacobtylerwalls
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 4122248 commit 92baf78

File tree

10 files changed

+45
-49
lines changed

10 files changed

+45
-49
lines changed

astroid/decorators.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,9 @@ def wrapped(
6060

6161

6262
def yes_if_nothing_inferred(
63-
func: Callable[_P, Generator[InferenceResult, None, None]]
64-
) -> Callable[_P, Generator[InferenceResult, None, None]]:
65-
def inner(
66-
*args: _P.args, **kwargs: _P.kwargs
67-
) -> Generator[InferenceResult, None, None]:
63+
func: Callable[_P, Generator[InferenceResult]]
64+
) -> Callable[_P, Generator[InferenceResult]]:
65+
def inner(*args: _P.args, **kwargs: _P.kwargs) -> Generator[InferenceResult]:
6866
generator = func(*args, **kwargs)
6967

7068
try:
@@ -80,11 +78,9 @@ def inner(
8078

8179

8280
def raise_if_nothing_inferred(
83-
func: Callable[_P, Generator[InferenceResult, None, None]],
84-
) -> Callable[_P, Generator[InferenceResult, None, None]]:
85-
def inner(
86-
*args: _P.args, **kwargs: _P.kwargs
87-
) -> Generator[InferenceResult, None, None]:
81+
func: Callable[_P, Generator[InferenceResult]],
82+
) -> Callable[_P, Generator[InferenceResult]]:
83+
def inner(*args: _P.args, **kwargs: _P.kwargs) -> Generator[InferenceResult]:
8884
generator = func(*args, **kwargs)
8985
try:
9086
yield next(generator)

astroid/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _function_type(
6060

6161
def _object_type(
6262
node: InferenceResult, context: InferenceContext | None = None
63-
) -> Generator[InferenceResult | None, None, None]:
63+
) -> Generator[InferenceResult | None]:
6464
astroid_manager = manager.AstroidManager()
6565
builtins = astroid_manager.builtins_module
6666
context = context or InferenceContext()

astroid/inference_tip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def inner(
4040
node: _NodesT,
4141
context: InferenceContext | None = None,
4242
**kwargs: Any,
43-
) -> Generator[InferenceResult, None, None]:
43+
) -> Generator[InferenceResult]:
4444
partial_cache_key = (func, node)
4545
if partial_cache_key in _CURRENTLY_INFERRING:
4646
# If through recursion we end up trying to infer the same

astroid/nodes/_base_nodes.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,11 @@ class OperatorNode(NodeNG):
328328
def _filter_operation_errors(
329329
infer_callable: Callable[
330330
[InferenceContext | None],
331-
Generator[InferenceResult | util.BadOperationMessage, None, None],
331+
Generator[InferenceResult | util.BadOperationMessage],
332332
],
333333
context: InferenceContext | None,
334334
error: type[util.BadOperationMessage],
335-
) -> Generator[InferenceResult, None, None]:
335+
) -> Generator[InferenceResult]:
336336
for result in infer_callable(context):
337337
if isinstance(result, error):
338338
# For the sake of .infer(), we don't care about operation
@@ -392,7 +392,7 @@ def _invoke_binop_inference(
392392
other: InferenceResult,
393393
context: InferenceContext,
394394
method_name: str,
395-
) -> Generator[InferenceResult, None, None]:
395+
) -> Generator[InferenceResult]:
396396
"""Invoke binary operation inference on the given instance."""
397397
methods = dunder_lookup.lookup(instance, method_name)
398398
context = bind_context_to_node(context, instance)
@@ -431,7 +431,7 @@ def _aug_op(
431431
other: InferenceResult,
432432
context: InferenceContext,
433433
reverse: bool = False,
434-
) -> partial[Generator[InferenceResult, None, None]]:
434+
) -> partial[Generator[InferenceResult]]:
435435
"""Get an inference callable for an augmented binary operation."""
436436
method_name = AUGMENTED_OP_METHOD[op]
437437
return partial(
@@ -452,7 +452,7 @@ def _bin_op(
452452
other: InferenceResult,
453453
context: InferenceContext,
454454
reverse: bool = False,
455-
) -> partial[Generator[InferenceResult, None, None]]:
455+
) -> partial[Generator[InferenceResult]]:
456456
"""Get an inference callable for a normal binary operation.
457457
458458
If *reverse* is True, then the reflected method will be used instead.
@@ -475,7 +475,7 @@ def _bin_op(
475475
def _bin_op_or_union_type(
476476
left: bases.UnionType | nodes.ClassDef | nodes.Const,
477477
right: bases.UnionType | nodes.ClassDef | nodes.Const,
478-
) -> Generator[InferenceResult, None, None]:
478+
) -> Generator[InferenceResult]:
479479
"""Create a new UnionType instance for binary or, e.g. int | str."""
480480
yield bases.UnionType(left, right)
481481

@@ -509,7 +509,7 @@ def _get_aug_flow(
509509
right_type: InferenceResult | None,
510510
context: InferenceContext,
511511
reverse_context: InferenceContext,
512-
) -> list[partial[Generator[InferenceResult, None, None]]]:
512+
) -> list[partial[Generator[InferenceResult]]]:
513513
"""Get the flow for augmented binary operations.
514514
515515
The rules are a bit messy:
@@ -566,7 +566,7 @@ def _get_binop_flow(
566566
right_type: InferenceResult | None,
567567
context: InferenceContext,
568568
reverse_context: InferenceContext,
569-
) -> list[partial[Generator[InferenceResult, None, None]]]:
569+
) -> list[partial[Generator[InferenceResult]]]:
570570
"""Get the flow for binary operations.
571571
572572
The rules are a bit messy:
@@ -627,7 +627,7 @@ def _infer_binary_operation(
627627
binary_opnode: nodes.AugAssign | nodes.BinOp,
628628
context: InferenceContext,
629629
flow_factory: GetFlowFactory,
630-
) -> Generator[InferenceResult | util.BadBinaryOperationMessage, None, None]:
630+
) -> Generator[InferenceResult | util.BadBinaryOperationMessage]:
631631
"""Infer a binary operation between a left operand and a right operand.
632632
633633
This is used by both normal binary operations and augmented binary

astroid/nodes/node_classes.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ def get_children(self):
10281028
@decorators.raise_if_nothing_inferred
10291029
def _infer(
10301030
self: nodes.Arguments, context: InferenceContext | None = None, **kwargs: Any
1031-
) -> Generator[InferenceResult, None, None]:
1031+
) -> Generator[InferenceResult]:
10321032
# pylint: disable-next=import-outside-toplevel
10331033
from astroid.protocols import _arguments_infer_argname
10341034

@@ -1417,7 +1417,7 @@ def _get_yield_nodes_skip_lambdas(self):
14171417

14181418
def _infer_augassign(
14191419
self, context: InferenceContext | None = None
1420-
) -> Generator[InferenceResult | util.BadBinaryOperationMessage, None, None]:
1420+
) -> Generator[InferenceResult | util.BadBinaryOperationMessage]:
14211421
"""Inference logic for augmented binary operations."""
14221422
context = context or InferenceContext()
14231423

@@ -1447,7 +1447,7 @@ def _infer_augassign(
14471447
@decorators.path_wrapper
14481448
def _infer(
14491449
self: nodes.AugAssign, context: InferenceContext | None = None, **kwargs: Any
1450-
) -> Generator[InferenceResult, None, None]:
1450+
) -> Generator[InferenceResult]:
14511451
return self._filter_operation_errors(
14521452
self._infer_augassign, context, util.BadBinaryOperationMessage
14531453
)
@@ -1532,7 +1532,7 @@ def op_left_associative(self) -> bool:
15321532

15331533
def _infer_binop(
15341534
self, context: InferenceContext | None = None, **kwargs: Any
1535-
) -> Generator[InferenceResult, None, None]:
1535+
) -> Generator[InferenceResult]:
15361536
"""Binary operation inference logic."""
15371537
left = self.left
15381538
right = self.right
@@ -1562,7 +1562,7 @@ def _infer_binop(
15621562
@decorators.path_wrapper
15631563
def _infer(
15641564
self: nodes.BinOp, context: InferenceContext | None = None, **kwargs: Any
1565-
) -> Generator[InferenceResult, None, None]:
1565+
) -> Generator[InferenceResult]:
15661566
return self._filter_operation_errors(
15671567
self._infer_binop, context, util.BadBinaryOperationMessage
15681568
)
@@ -1911,7 +1911,7 @@ def _do_compare(
19111911

19121912
def _infer(
19131913
self, context: InferenceContext | None = None, **kwargs: Any
1914-
) -> Generator[nodes.Const | util.UninferableBase, None, None]:
1914+
) -> Generator[nodes.Const | util.UninferableBase]:
19151915
"""Chained comparison inference logic."""
19161916
retval: bool | util.UninferableBase = True
19171917

@@ -2561,7 +2561,7 @@ def has_underlying_object(self) -> bool:
25612561
@decorators.path_wrapper
25622562
def _infer(
25632563
self, context: InferenceContext | None = None, **kwargs: Any
2564-
) -> Generator[InferenceResult, None, None]:
2564+
) -> Generator[InferenceResult]:
25652565
if not self.has_underlying_object():
25662566
yield util.Uninferable
25672567
else:
@@ -2851,7 +2851,7 @@ def _infer(
28512851
context: InferenceContext | None = None,
28522852
asname: bool = True,
28532853
**kwargs: Any,
2854-
) -> Generator[InferenceResult, None, None]:
2854+
) -> Generator[InferenceResult]:
28552855
"""Infer a ImportFrom node: return the imported module/object."""
28562856
context = context or InferenceContext()
28572857
name = context.lookupname
@@ -2976,7 +2976,7 @@ def _infer_name(self, frame, name):
29762976
@decorators.path_wrapper
29772977
def _infer(
29782978
self, context: InferenceContext | None = None, **kwargs: Any
2979-
) -> Generator[InferenceResult, None, None]:
2979+
) -> Generator[InferenceResult]:
29802980
if context is None or context.lookupname is None:
29812981
raise InferenceError(node=self, context=context)
29822982
try:
@@ -3093,7 +3093,7 @@ def op_left_associative(self) -> Literal[False]:
30933093
@decorators.raise_if_nothing_inferred
30943094
def _infer(
30953095
self, context: InferenceContext | None = None, **kwargs: Any
3096-
) -> Generator[InferenceResult, None, None]:
3096+
) -> Generator[InferenceResult]:
30973097
"""Support IfExp inference.
30983098
30993099
If we can't infer the truthiness of the condition, we default
@@ -3182,7 +3182,7 @@ def _infer(
31823182
context: InferenceContext | None = None,
31833183
asname: bool = True,
31843184
**kwargs: Any,
3185-
) -> Generator[nodes.Module, None, None]:
3185+
) -> Generator[nodes.Module]:
31863186
"""Infer an Import node: return the imported module/object."""
31873187
context = context or InferenceContext()
31883188
name = context.lookupname
@@ -4123,7 +4123,7 @@ def _infer(
41234123
InferenceContext | None,
41244124
None,
41254125
],
4126-
Generator[NodeNG, None, None],
4126+
Generator[NodeNG],
41274127
]
41284128
] = protocols.assign_assigned_stmts
41294129

@@ -4984,7 +4984,7 @@ def __init__(
49844984

49854985
def _infer(
49864986
self, context: InferenceContext | None = None, **kwargs: Any
4987-
) -> Generator[NodeNG | util.UninferableBase, None, None]:
4987+
) -> Generator[NodeNG | util.UninferableBase]:
49884988
yield self.value
49894989

49904990

astroid/nodes/node_ng.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def __init__(
124124

125125
def infer(
126126
self, context: InferenceContext | None = None, **kwargs: Any
127-
) -> Generator[InferenceResult, None, None]:
127+
) -> Generator[InferenceResult]:
128128
"""Get a generator of the inferred values.
129129
130130
This is the main entry point to the inference system.

astroid/nodes/scoped_nodes/scoped_nodes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ def frame(self: _T, *, future: Literal[None, True] = None) -> _T:
602602

603603
def _infer(
604604
self, context: InferenceContext | None = None, **kwargs: Any
605-
) -> Generator[Module, None, None]:
605+
) -> Generator[Module]:
606606
yield self
607607

608608

@@ -1052,7 +1052,7 @@ def getattr(
10521052

10531053
def _infer(
10541054
self, context: InferenceContext | None = None, **kwargs: Any
1055-
) -> Generator[Lambda, None, None]:
1055+
) -> Generator[Lambda]:
10561056
yield self
10571057

10581058
def _get_yield_nodes_skip_functions(self):
@@ -2222,7 +2222,7 @@ def basenames(self):
22222222

22232223
def ancestors(
22242224
self, recurs: bool = True, context: InferenceContext | None = None
2225-
) -> Generator[ClassDef, None, None]:
2225+
) -> Generator[ClassDef]:
22262226
"""Iterate over the base classes in prefixed depth first order.
22272227
22282228
:param recurs: Whether to recurse or return direct ancestors only.
@@ -2975,5 +2975,5 @@ def frame(self: _T, *, future: Literal[None, True] = None) -> _T:
29752975

29762976
def _infer(
29772977
self, context: InferenceContext | None = None, **kwargs: Any
2978-
) -> Generator[ClassDef, None, None]:
2978+
) -> Generator[ClassDef]:
29792979
yield self

astroid/objects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,5 +362,5 @@ def infer_call_result(
362362

363363
def _infer(
364364
self: _T, context: InferenceContext | None = None, **kwargs: Any
365-
) -> Generator[_T, None, None]:
365+
) -> Generator[_T]:
366366
yield self

astroid/protocols.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def const_infer_binary_op(
106106
other: InferenceResult,
107107
context: InferenceContext,
108108
_: SuccessfulInferenceResult,
109-
) -> Generator[ConstFactoryResult | util.UninferableBase, None, None]:
109+
) -> Generator[ConstFactoryResult | util.UninferableBase]:
110110
not_implemented = nodes.Const(NotImplemented)
111111
if isinstance(other, nodes.Const):
112112
if (
@@ -176,7 +176,7 @@ def tl_infer_binary_op(
176176
other: InferenceResult,
177177
context: InferenceContext,
178178
method: SuccessfulInferenceResult,
179-
) -> Generator[_TupleListNodeT | nodes.Const | util.UninferableBase, None, None]:
179+
) -> Generator[_TupleListNodeT | nodes.Const | util.UninferableBase]:
180180
"""Infer a binary operation on a tuple or list.
181181
182182
The instance on which the binary operation is performed is a tuple
@@ -224,7 +224,7 @@ def instance_class_infer_binary_op(
224224
other: InferenceResult,
225225
context: InferenceContext,
226226
method: SuccessfulInferenceResult,
227-
) -> Generator[InferenceResult, None, None]:
227+
) -> Generator[InferenceResult]:
228228
return method.infer_call_result(self, context)
229229

230230

@@ -347,7 +347,7 @@ def assend_assigned_stmts(
347347

348348
def _arguments_infer_argname(
349349
self, name: str | None, context: InferenceContext
350-
) -> Generator[InferenceResult, None, None]:
350+
) -> Generator[InferenceResult]:
351351
# arguments information may be missing, in which case we can't do anything
352352
# more
353353
from astroid import arguments # pylint: disable=import-outside-toplevel
@@ -877,7 +877,7 @@ def match_mapping_assigned_stmts(
877877
node: nodes.AssignName,
878878
context: InferenceContext | None = None,
879879
assign_path: None = None,
880-
) -> Generator[nodes.NodeNG, None, None]:
880+
) -> Generator[nodes.NodeNG]:
881881
"""Return empty generator (return -> raises StopIteration) so inferred value
882882
is Uninferable.
883883
"""
@@ -891,7 +891,7 @@ def match_star_assigned_stmts(
891891
node: nodes.AssignName,
892892
context: InferenceContext | None = None,
893893
assign_path: None = None,
894-
) -> Generator[nodes.NodeNG, None, None]:
894+
) -> Generator[nodes.NodeNG]:
895895
"""Return empty generator (return -> raises StopIteration) so inferred value
896896
is Uninferable.
897897
"""
@@ -905,7 +905,7 @@ def match_as_assigned_stmts(
905905
node: nodes.AssignName,
906906
context: InferenceContext | None = None,
907907
assign_path: None = None,
908-
) -> Generator[nodes.NodeNG, None, None]:
908+
) -> Generator[nodes.NodeNG]:
909909
"""Infer MatchAs as the Match subject if it's the only MatchCase pattern
910910
else raise StopIteration to yield Uninferable.
911911
"""
@@ -923,7 +923,7 @@ def generic_type_assigned_stmts(
923923
node: nodes.AssignName,
924924
context: InferenceContext | None = None,
925925
assign_path: None = None,
926-
) -> Generator[nodes.NodeNG, None, None]:
926+
) -> Generator[nodes.NodeNG]:
927927
"""Hack. Return any Node so inference doesn't fail
928928
when evaluating __class_getitem__. Revert if it's causing issues.
929929
"""

astroid/rebuilder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ def visit_delete(self, node: ast.Delete, parent: NodeNG) -> nodes.Delete:
912912

913913
def _visit_dict_items(
914914
self, node: ast.Dict, parent: NodeNG, newnode: nodes.Dict
915-
) -> Generator[tuple[NodeNG, NodeNG], None, None]:
915+
) -> Generator[tuple[NodeNG, NodeNG]]:
916916
for key, value in zip(node.keys, node.values):
917917
rebuilt_key: NodeNG
918918
rebuilt_value = self.visit(value, newnode)

0 commit comments

Comments
 (0)