Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e9c1274

Browse files
committed
.
1 parent 54512be commit e9c1274

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

mypy/checker.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6720,7 +6720,9 @@ def narrow_type_by_identity_equality(
67206720
if is_target_for_value_narrowing(get_proper_type(target_type)):
67216721
if_map, else_map = conditional_types_to_typemaps(
67226722
operands[i],
6723-
*conditional_types(expanded_expr_type, [target], consider_promotion_overlap=True),
6723+
*conditional_types(
6724+
expanded_expr_type, [target], consider_promotion_overlap=True
6725+
),
67246726
)
67256727
all_if_maps.append(if_map)
67266728
all_else_maps.append(else_map)
@@ -6759,7 +6761,9 @@ def narrow_type_by_identity_equality(
67596761
if is_target_for_value_narrowing(get_proper_type(target_type)):
67606762
if_map, else_map = conditional_types_to_typemaps(
67616763
operands[i],
6762-
*conditional_types(expr_type, [target], consider_promotion_overlap=True),
6764+
*conditional_types(
6765+
expr_type, [target], consider_promotion_overlap=True
6766+
),
67636767
)
67646768
if else_map:
67656769
all_else_maps.append(else_map)
@@ -8347,10 +8351,14 @@ def conditional_types(
83478351
consider_runtime_isinstance=consider_runtime_isinstance,
83488352
)
83498353
return default, remainder
8350-
if not is_overlapping_types(current_type, proposed_type, ignore_promotions=not consider_promotion_overlap):
8354+
if not is_overlapping_types(
8355+
current_type, proposed_type, ignore_promotions=not consider_promotion_overlap
8356+
):
83518357
# Expression is never of any type in proposed_type_ranges
83528358
return UninhabitedType(), default
8353-
if consider_promotion_overlap and not is_overlapping_types(current_type, proposed_type, ignore_promotions=True):
8359+
if consider_promotion_overlap and not is_overlapping_types(
8360+
current_type, proposed_type, ignore_promotions=True
8361+
):
83548362
return default, default
83558363
# we can only restrict when the type is precise, not bounded
83568364
proposed_precise_type = UnionType.make_union(

0 commit comments

Comments
 (0)