@@ -3277,15 +3277,15 @@ def check_lst_expr(self, items: List[Expression], fullname: str,
3277
3277
# Used for list and set expressions, as well as for tuples
3278
3278
# containing star expressions that don't refer to a
3279
3279
# Tuple. (Note: "lst" stands for list-set-tuple. :-)
3280
- tvdef = TypeVarType ('T' , 'T' , - 1 , [], self .object_type ())
3280
+ tv = TypeVarType ('T' , 'T' , - 1 , [], self .object_type ())
3281
3281
constructor = CallableType (
3282
- [tvdef ],
3282
+ [tv ],
3283
3283
[nodes .ARG_STAR ],
3284
3284
[None ],
3285
- self .chk .named_generic_type (fullname , [tvdef ]),
3285
+ self .chk .named_generic_type (fullname , [tv ]),
3286
3286
self .named_type ('builtins.function' ),
3287
3287
name = tag ,
3288
- variables = [tvdef ])
3288
+ variables = [tv ])
3289
3289
out = self .check_call (constructor ,
3290
3290
[(i .expr if isinstance (i , StarExpr ) else i )
3291
3291
for i in items ],
@@ -3434,22 +3434,22 @@ def visit_dict_expr(self, e: DictExpr) -> Type:
3434
3434
tup .column = value .column
3435
3435
args .append (tup )
3436
3436
# Define type variables (used in constructors below).
3437
- ktdef = TypeVarType ('KT' , 'KT' , - 1 , [], self .object_type ())
3438
- vtdef = TypeVarType ('VT' , 'VT' , - 2 , [], self .object_type ())
3437
+ kt = TypeVarType ('KT' , 'KT' , - 1 , [], self .object_type ())
3438
+ vt = TypeVarType ('VT' , 'VT' , - 2 , [], self .object_type ())
3439
3439
rv = None
3440
3440
# Call dict(*args), unless it's empty and stargs is not.
3441
3441
if args or not stargs :
3442
3442
# The callable type represents a function like this:
3443
3443
#
3444
3444
# def <unnamed>(*v: Tuple[kt, vt]) -> Dict[kt, vt]: ...
3445
3445
constructor = CallableType (
3446
- [TupleType ([ktdef , vtdef ], self .named_type ('builtins.tuple' ))],
3446
+ [TupleType ([kt , vt ], self .named_type ('builtins.tuple' ))],
3447
3447
[nodes .ARG_STAR ],
3448
3448
[None ],
3449
- self .chk .named_generic_type ('builtins.dict' , [ktdef , vtdef ]),
3449
+ self .chk .named_generic_type ('builtins.dict' , [kt , vt ]),
3450
3450
self .named_type ('builtins.function' ),
3451
3451
name = '<dict>' ,
3452
- variables = [ktdef , vtdef ])
3452
+ variables = [kt , vt ])
3453
3453
rv = self .check_call (constructor , args , [nodes .ARG_POS ] * len (args ), e )[0 ]
3454
3454
else :
3455
3455
# dict(...) will be called below.
@@ -3460,13 +3460,13 @@ def visit_dict_expr(self, e: DictExpr) -> Type:
3460
3460
for arg in stargs :
3461
3461
if rv is None :
3462
3462
constructor = CallableType (
3463
- [self .chk .named_generic_type ('typing.Mapping' , [ktdef , vtdef ])],
3463
+ [self .chk .named_generic_type ('typing.Mapping' , [kt , vt ])],
3464
3464
[nodes .ARG_POS ],
3465
3465
[None ],
3466
- self .chk .named_generic_type ('builtins.dict' , [ktdef , vtdef ]),
3466
+ self .chk .named_generic_type ('builtins.dict' , [kt , vt ]),
3467
3467
self .named_type ('builtins.function' ),
3468
3468
name = '<list>' ,
3469
- variables = [ktdef , vtdef ])
3469
+ variables = [kt , vt ])
3470
3470
rv = self .check_call (constructor , [arg ], [nodes .ARG_POS ], arg )[0 ]
3471
3471
else :
3472
3472
self .check_method_call_by_name ('update' , rv , [arg ], [nodes .ARG_POS ], arg )
@@ -3756,16 +3756,16 @@ def check_generator_or_comprehension(self, gen: GeneratorExpr,
3756
3756
3757
3757
# Infer the type of the list comprehension by using a synthetic generic
3758
3758
# callable type.
3759
- tvdef = TypeVarType ('T' , 'T' , - 1 , [], self .object_type ())
3760
- tv_list : List [Type ] = [tvdef ]
3759
+ tv = TypeVarType ('T' , 'T' , - 1 , [], self .object_type ())
3760
+ tv_list : List [Type ] = [tv ]
3761
3761
constructor = CallableType (
3762
3762
tv_list ,
3763
3763
[nodes .ARG_POS ],
3764
3764
[None ],
3765
3765
self .chk .named_generic_type (type_name , tv_list + additional_args ),
3766
3766
self .chk .named_type ('builtins.function' ),
3767
3767
name = id_for_messages ,
3768
- variables = [tvdef ])
3768
+ variables = [tv ])
3769
3769
return self .check_call (constructor ,
3770
3770
[gen .left_expr ], [nodes .ARG_POS ], gen )[0 ]
3771
3771
0 commit comments