Skip to content

Commit c0754c0

Browse files
committed
Avoid collecting scoped import for "Literal"
`py_import` can already be imported manually in the module's namespace. In which case `py_import` cannot be formatted as an import and shouldn't be collected.
1 parent c3bda5e commit c0754c0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/docstub/_docstrings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def natlang_literal(self, tree):
395395

396396
if self.matcher is not None:
397397
_, py_import = self.matcher.match("Literal")
398-
if py_import:
398+
if py_import.has_import:
399399
self._collected_imports.add(py_import)
400400
return out
401401

0 commit comments

Comments
 (0)