@@ -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
@@ -2419,8 +2416,7 @@ def format_long_tuple_type(self, typ: TupleType) -> str:
24192416 """Format very long tuple type using an ellipsis notation"""
24202417 item_cnt = len (typ .items )
24212418 if item_cnt > MAX_TUPLE_ITEMS :
2422- return "{}[{}, {}, ... <{} more items>]" .format (
2423- "tuple" if self .options .use_lowercase_names () else "Tuple" ,
2419+ return "tuple[{}, {}, ... <{} more items>]" .format (
24242420 format_type_bare (typ .items [0 ], self .options ),
24252421 format_type_bare (typ .items [1 ], self .options ),
24262422 str (item_cnt - 2 ),
@@ -2595,10 +2591,7 @@ def format_literal_value(typ: LiteralType) -> str:
25952591 if itype .type .fullname == "typing._SpecialForm" :
25962592 # This is not a real type but used for some typing-related constructs.
25972593 return "<typing special form>"
2598- if itype .type .fullname in reverse_builtin_aliases and not options .use_lowercase_names ():
2599- alias = reverse_builtin_aliases [itype .type .fullname ]
2600- base_str = alias .split ("." )[- 1 ]
2601- elif verbosity >= 2 or (fullnames and itype .type .fullname in fullnames ):
2594+ if verbosity >= 2 or (fullnames and itype .type .fullname in fullnames ):
26022595 base_str = itype .type .fullname
26032596 else :
26042597 base_str = itype .type .name
@@ -2609,7 +2602,7 @@ def format_literal_value(typ: LiteralType) -> str:
26092602 return base_str
26102603 elif itype .type .fullname == "builtins.tuple" :
26112604 item_type_str = format (itype .args [0 ])
2612- return f"{ ' tuple' if options . use_lowercase_names () else 'Tuple' } [{ item_type_str } , ...]"
2605+ return f"tuple[{ item_type_str } , ...]"
26132606 else :
26142607 # There are type arguments. Convert the arguments to strings.
26152608 return f"{ base_str } [{ format_list (itype .args )} ]"
@@ -2645,11 +2638,7 @@ def format_literal_value(typ: LiteralType) -> str:
26452638 if typ .partial_fallback .type .fullname != "builtins.tuple" :
26462639 return format (typ .partial_fallback )
26472640 type_items = format_list (typ .items ) or "()"
2648- if options .use_lowercase_names ():
2649- s = f"tuple[{ type_items } ]"
2650- else :
2651- s = f"Tuple[{ type_items } ]"
2652- return s
2641+ return f"tuple[{ type_items } ]"
26532642 elif isinstance (typ , TypedDictType ):
26542643 # If the TypedDictType is named, return the name
26552644 if not typ .is_anonymous ():
@@ -2721,8 +2710,7 @@ def format_literal_value(typ: LiteralType) -> str:
27212710 elif isinstance (typ , UninhabitedType ):
27222711 return "Never"
27232712 elif isinstance (typ , TypeType ):
2724- type_name = "type" if options .use_lowercase_names () else "Type"
2725- return f"{ type_name } [{ format (typ .item )} ]"
2713+ return f"type[{ format (typ .item )} ]"
27262714 elif isinstance (typ , FunctionLike ):
27272715 func = typ
27282716 if func .is_type_obj ():
0 commit comments