Skip to content

Commit

Permalink
Ignore non-aliased module nodes when collecting dependencies.
Browse files Browse the repository at this point in the history
This fixes a failure in typeshed's pytype_test.

PiperOrigin-RevId: 605760245
  • Loading branch information
rchen152 committed Feb 10, 2024
1 parent 28a1f48 commit 6bfe898
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pytype/pytd/visitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1536,7 +1536,12 @@ def EnterLateType(self, node):
self._ProcessName(node.name, self.late_dependencies)

def EnterModule(self, node):
self._ProcessName(node.module_name, self.dependencies)
# Most module nodes look like:
# Module(name='foo_module.bar_module', module_name='bar_module').
# We don't care about these. Nodes that don't follow this pattern are
# aliased modules, which we need to record.
if not node.name.endswith("." + node.module_name):
self._ProcessName(node.module_name, self.dependencies)


def ExpandSignature(sig):
Expand Down

0 comments on commit 6bfe898

Please sign in to comment.