Skip to content

Commit 79562fe

Browse files
committed
remove shortest name functionality
1 parent bdbdd18 commit 79562fe

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

mypy/stubutil.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,6 @@ def visit_any(self, t: AnyType) -> str:
224224

225225
def visit_unbound_type(self, t: UnboundType) -> str:
226226
s = t.name
227-
# short_name = self.stubgen.get_shortest_name(s)
228-
# if short_name:
229-
# s = short_name
230227
if self.known_modules is not None and "." in s:
231228
# see if this object is from any of the modules that we're currently processing.
232229
# 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
551548
name == short or self.import_tracker.reverse_alias.get(name) == short
552549
)
553550

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-
575551
def add_obj_import(self, module: str, name: str, require: bool = False) -> str:
576552
"""Add a name to be imported.
577553

0 commit comments

Comments
 (0)