Skip to content

Commit 11bac24

Browse files
🎨 Avoid generating duplicate imports.
1 parent 6930852 commit 11bac24

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎src/lapidary/render/model/conv_cst.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,11 @@ def mk_imports(module: python.AbstractModule) -> Iterator[cst.SimpleStatementLin
709709
cst.SimpleStatementLine([cst.Import([cst.ImportAlias(mk_name('lapidary', 'runtime'))])], [cst.EmptyLine()]),
710710
cst.Import([cst.ImportAlias(cst.Name('pydantic'))]),
711711
cst.Import([cst.ImportAlias(cst.Name('typing_extensions'), cst.AsName(cst.Name('typing')))]),
712-
*(mk_import(mod_name) for mod_name in module.imports),
712+
*(
713+
mk_import(mod_name)
714+
for mod_name in module.imports
715+
if mod_name not in ('pydantic', 'typing', 'lapidary.runtime')
716+
),
713717
]
714718
return (cst.SimpleStatementLine([imp]) if not isinstance(imp, cst.SimpleStatementLine) else imp for imp in imports)
715719

0 commit comments

Comments
 (0)