@@ -224,9 +224,6 @@ def visit_any(self, t: AnyType) -> str:
224
224
225
225
def visit_unbound_type (self , t : UnboundType ) -> str :
226
226
s = t .name
227
- # short_name = self.stubgen.get_shortest_name(s)
228
- # if short_name:
229
- # s = short_name
230
227
if self .known_modules is not None and "." in s :
231
228
# see if this object is from any of the modules that we're currently processing.
232
229
# reverse sort so that subpackages come before parents: e.g. "foo.bar" before "foo".
@@ -551,27 +548,6 @@ def refers_to_fullname(self, name: str, fullname: str | tuple[str, ...]) -> bool
551
548
name == short or self .import_tracker .reverse_alias .get (name ) == short
552
549
)
553
550
554
- def get_shortest_name (self , fullname : str ) -> str | None :
555
- """Find the shortest path in the current module for the given object path."""
556
- if "." not in fullname :
557
- return None
558
-
559
- module , name = fullname .rsplit ("." , 1 )
560
-
561
- # if fullname is 'x.y.z', this will find imports of the form 'from x.y import z'
562
- # and return 'z' as the short name.
563
- mod = self .import_tracker .module_for .get (name )
564
- if mod and mod == module :
565
- return name
566
-
567
- # if fullname is 'x.y.z', this will find imports of the form 'import x.y as z'
568
- # and return 'z' as the short name.
569
- for alias , mod in self .import_tracker .reverse_alias .items ():
570
- if mod == module :
571
- return f"{ alias } .{ name } "
572
-
573
- return None
574
-
575
551
def add_obj_import (self , module : str , name : str , require : bool = False ) -> str :
576
552
"""Add a name to be imported.
577
553
0 commit comments