@@ -549,8 +549,8 @@ def visit_call_expr_inner(self, e: CallExpr, allow_none_return: bool = False) ->
549
549
and e .callee .fullname == "typing.get_args"
550
550
and len (e .args ) == 1
551
551
):
552
- #Special hanlding for get_args(), returns a typed tuple
553
- #with the type set by the input
552
+ # Special hanlding for get_args(), returns a typed tuple
553
+ # with the type set by the input
554
554
typ = None
555
555
if isinstance (e .args [0 ], IndexExpr ):
556
556
self .accept (e .args [0 ].index )
@@ -559,24 +559,29 @@ def visit_call_expr_inner(self, e: CallExpr, allow_none_return: bool = False) ->
559
559
try :
560
560
node = self .chk .lookup_qualified (e .args [0 ].name )
561
561
except KeyError :
562
- # Undefined names should already be reported in semantic analysis.
563
- pass
562
+ # Undefined names should already be reported in semantic analysis.
563
+ pass
564
564
if node :
565
565
if isinstance (node .node , TypeAlias ):
566
- #Resolve type
566
+ # Resolve type
567
567
typ = get_proper_type (node .node .target )
568
568
else :
569
569
typ = node .node .type
570
- if ( typ is not None
570
+ if (
571
+ typ is not None
571
572
and isinstance (typ , UnionType )
572
573
and all ([isinstance (t , LiteralType ) for t in typ .items ])
573
574
):
574
575
# Returning strings is defined but order isn't so
575
576
# we need to return type * len of the union
576
- return TupleType ([typ ] * len (typ .items ), fallback = self .named_type ("builtins.tuple" ))
577
+ return TupleType (
578
+ [typ ] * len (typ .items ), fallback = self .named_type ("builtins.tuple" )
579
+ )
577
580
else :
578
581
# Fall back to what we did anyway (Tuple[Any])
579
- return TupleType ([AnyType (TypeOfAny .special_form )], fallback = self .named_type ("builtins.tuple" ))
582
+ return TupleType (
583
+ [AnyType (TypeOfAny .special_form )], fallback = self .named_type ("builtins.tuple" )
584
+ )
580
585
self .try_infer_partial_type (e )
581
586
type_context = None
582
587
if isinstance (e .callee , LambdaExpr ):
0 commit comments