@@ -1823,13 +1823,10 @@ def need_annotation_for_var(
18231823 recommended_type = f"Optional[{ type_dec } ]"
18241824 elif node .type .type .fullname in reverse_builtin_aliases :
18251825 # 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" :
18291828 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 } ]"
18331830 if recommended_type is not None :
18341831 hint = f' (hint: "{ node .name } : { recommended_type } = ...")'
18351832
@@ -2424,8 +2421,7 @@ def format_long_tuple_type(self, typ: TupleType) -> str:
24242421 """Format very long tuple type using an ellipsis notation"""
24252422 item_cnt = len (typ .items )
24262423 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 (
24292425 format_type_bare (typ .items [0 ], self .options ),
24302426 format_type_bare (typ .items [1 ], self .options ),
24312427 str (item_cnt - 2 ),
@@ -2610,10 +2606,7 @@ def format_literal_value(typ: LiteralType) -> str:
26102606 if itype .type .fullname == "typing._SpecialForm" :
26112607 # This is not a real type but used for some typing-related constructs.
26122608 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 ):
26172610 base_str = itype .type .fullname
26182611 else :
26192612 base_str = itype .type .name
@@ -2624,7 +2617,7 @@ def format_literal_value(typ: LiteralType) -> str:
26242617 return base_str
26252618 elif itype .type .fullname == "builtins.tuple" :
26262619 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 } , ...]"
26282621 else :
26292622 # There are type arguments. Convert the arguments to strings.
26302623 return f"{ base_str } [{ format_list (itype .args )} ]"
@@ -2660,11 +2653,7 @@ def format_literal_value(typ: LiteralType) -> str:
26602653 if typ .partial_fallback .type .fullname != "builtins.tuple" :
26612654 return format (typ .partial_fallback )
26622655 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 } ]"
26682657 elif isinstance (typ , TypedDictType ):
26692658 # If the TypedDictType is named, return the name
26702659 if not typ .is_anonymous ():
@@ -2736,8 +2725,7 @@ def format_literal_value(typ: LiteralType) -> str:
27362725 elif isinstance (typ , UninhabitedType ):
27372726 return "Never"
27382727 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 )} ]"
27412729 elif isinstance (typ , FunctionLike ):
27422730 func = typ
27432731 if func .is_type_obj ():
0 commit comments