@@ -1823,13 +1823,10 @@ def need_annotation_for_var(
1823
1823
recommended_type = f"Optional[{ type_dec } ]"
1824
1824
elif node .type .type .fullname in reverse_builtin_aliases :
1825
1825
# partial types other than partial None
1826
- alias = reverse_builtin_aliases [node .type .type .fullname ]
1827
- alias = alias .split ("." )[- 1 ]
1828
- if alias == "Dict" :
1826
+ name = node .type .type .fullname .partition ("." )[2 ]
1827
+ if name == "dict" :
1829
1828
type_dec = f"{ type_dec } , { type_dec } "
1830
- if self .options .use_lowercase_names ():
1831
- alias = alias .lower ()
1832
- recommended_type = f"{ alias } [{ type_dec } ]"
1829
+ recommended_type = f"{ name } [{ type_dec } ]"
1833
1830
if recommended_type is not None :
1834
1831
hint = f' (hint: "{ node .name } : { recommended_type } = ...")'
1835
1832
@@ -2424,8 +2421,7 @@ def format_long_tuple_type(self, typ: TupleType) -> str:
2424
2421
"""Format very long tuple type using an ellipsis notation"""
2425
2422
item_cnt = len (typ .items )
2426
2423
if item_cnt > MAX_TUPLE_ITEMS :
2427
- return "{}[{}, {}, ... <{} more items>]" .format (
2428
- "tuple" if self .options .use_lowercase_names () else "Tuple" ,
2424
+ return "tuple[{}, {}, ... <{} more items>]" .format (
2429
2425
format_type_bare (typ .items [0 ], self .options ),
2430
2426
format_type_bare (typ .items [1 ], self .options ),
2431
2427
str (item_cnt - 2 ),
@@ -2610,10 +2606,7 @@ def format_literal_value(typ: LiteralType) -> str:
2610
2606
if itype .type .fullname == "typing._SpecialForm" :
2611
2607
# This is not a real type but used for some typing-related constructs.
2612
2608
return "<typing special form>"
2613
- if itype .type .fullname in reverse_builtin_aliases and not options .use_lowercase_names ():
2614
- alias = reverse_builtin_aliases [itype .type .fullname ]
2615
- base_str = alias .split ("." )[- 1 ]
2616
- elif verbosity >= 2 or (fullnames and itype .type .fullname in fullnames ):
2609
+ if verbosity >= 2 or (fullnames and itype .type .fullname in fullnames ):
2617
2610
base_str = itype .type .fullname
2618
2611
else :
2619
2612
base_str = itype .type .name
@@ -2624,7 +2617,7 @@ def format_literal_value(typ: LiteralType) -> str:
2624
2617
return base_str
2625
2618
elif itype .type .fullname == "builtins.tuple" :
2626
2619
item_type_str = format (itype .args [0 ])
2627
- return f"{ ' tuple' if options . use_lowercase_names () else 'Tuple' } [{ item_type_str } , ...]"
2620
+ return f"tuple[{ item_type_str } , ...]"
2628
2621
else :
2629
2622
# There are type arguments. Convert the arguments to strings.
2630
2623
return f"{ base_str } [{ format_list (itype .args )} ]"
@@ -2660,11 +2653,7 @@ def format_literal_value(typ: LiteralType) -> str:
2660
2653
if typ .partial_fallback .type .fullname != "builtins.tuple" :
2661
2654
return format (typ .partial_fallback )
2662
2655
type_items = format_list (typ .items ) or "()"
2663
- if options .use_lowercase_names ():
2664
- s = f"tuple[{ type_items } ]"
2665
- else :
2666
- s = f"Tuple[{ type_items } ]"
2667
- return s
2656
+ return f"tuple[{ type_items } ]"
2668
2657
elif isinstance (typ , TypedDictType ):
2669
2658
# If the TypedDictType is named, return the name
2670
2659
if not typ .is_anonymous ():
@@ -2736,8 +2725,7 @@ def format_literal_value(typ: LiteralType) -> str:
2736
2725
elif isinstance (typ , UninhabitedType ):
2737
2726
return "Never"
2738
2727
elif isinstance (typ , TypeType ):
2739
- type_name = "type" if options .use_lowercase_names () else "Type"
2740
- return f"{ type_name } [{ format (typ .item )} ]"
2728
+ return f"type[{ format (typ .item )} ]"
2741
2729
elif isinstance (typ , FunctionLike ):
2742
2730
func = typ
2743
2731
if func .is_type_obj ():
0 commit comments