@@ -278,7 +278,7 @@ def infer_constraints(
278
278
actual : Type ,
279
279
direction : int ,
280
280
skip_neg_op : bool = False ,
281
- can_have_union_overlaping : bool = True ,
281
+ can_have_union_overlapping : bool = True ,
282
282
) -> list [Constraint ]:
283
283
"""Infer type constraints.
284
284
@@ -318,15 +318,15 @@ def infer_constraints(
318
318
res = _infer_constraints (template , actual , direction , skip_neg_op )
319
319
type_state .inferring .pop ()
320
320
return res
321
- return _infer_constraints (template , actual , direction , skip_neg_op , can_have_union_overlaping )
321
+ return _infer_constraints (template , actual , direction , skip_neg_op , can_have_union_overlapping )
322
322
323
323
324
324
def _infer_constraints (
325
325
template : Type ,
326
326
actual : Type ,
327
327
direction : int ,
328
328
skip_neg_op : bool ,
329
- can_have_union_overlaping : bool = True ,
329
+ can_have_union_overlapping : bool = True ,
330
330
) -> list [Constraint ]:
331
331
orig_template = template
332
332
template = get_proper_type (template )
@@ -380,11 +380,11 @@ def _infer_constraints(
380
380
if direction == SUPERTYPE_OF and isinstance (actual , UnionType ):
381
381
res = []
382
382
383
- def _can_have_overlaping (_item : Type , _actual : UnionType ) -> bool :
384
- # There is a special overlaping case, where we have a Union of where two types
383
+ def _can_have_overlapping (_item : Type , _actual : UnionType ) -> bool :
384
+ # There is a special overlapping case, where we have a Union of where two types
385
385
# are the same, but one of them contains the other.
386
386
# For example, we have Union[Sequence[T], Sequence[Sequence[T]]]
387
- # In this case, only the second one can have overlaping because it contains the other.
387
+ # In this case, only the second one can have overlapping because it contains the other.
388
388
# So, in case of list[list[int]], second one would be chosen.
389
389
if isinstance (p_item := get_proper_type (_item ), Instance ) and p_item .args :
390
390
other_items = [o_item for o_item in _actual .items if o_item is not a_item ]
@@ -411,7 +411,7 @@ def _can_have_overlaping(_item: Type, _actual: UnionType) -> bool:
411
411
orig_template ,
412
412
a_item ,
413
413
direction ,
414
- can_have_union_overlaping = _can_have_overlaping (a_item , actual ),
414
+ can_have_union_overlapping = _can_have_overlapping (a_item , actual ),
415
415
)
416
416
)
417
417
return res
@@ -435,8 +435,8 @@ def _can_have_overlaping(_item: Type, _actual: UnionType) -> bool:
435
435
# type variables indeterminate. This helps with some special
436
436
# cases, though this isn't very principled.
437
437
438
- def _is_item_overlaping_actual_type (_item : Type ) -> bool :
439
- # Overlaping occurs when we have a Union where two types are
438
+ def _is_item_overlapping_actual_type (_item : Type ) -> bool :
439
+ # Overlapping occurs when we have a Union where two types are
440
440
# compatible and the more generic one is chosen.
441
441
# For example, in Union[T, Sequence[T]], we have to choose
442
442
# Sequence[T] if actual type is list[int].
@@ -456,7 +456,7 @@ def _is_item_overlaping_actual_type(_item: Type) -> bool:
456
456
for t_item in [
457
457
item
458
458
for item in template .items
459
- if not (can_have_union_overlaping and _is_item_overlaping_actual_type (item ))
459
+ if not (can_have_union_overlapping and _is_item_overlapping_actual_type (item ))
460
460
]
461
461
],
462
462
eager = False ,
0 commit comments