ImportStatement
A Python import statement.
import { ImportStatement } from "@alloy-js/python";
<ImportStatement path="string" symbols={Set<ImportedSymbol>} />
import { ImportStatement } from "@alloy-js/python/stc";
ImportStatement({ path: string, symbols: Set<ImportedSymbol>,}).children(children)
path | string |
symbols | optionalSet<[unresolved link]> |
Remarks
Section titled “Remarks”This component renders an import statement for a given path and symbols. If no symbols are provided, it will render a simple import statement. If symbols are provided, it will render an import statement with the specified symbols.
Example
Section titled “Example”<ImportStatement path="os" /><ImportStatement path="math" symbols={new Set([new ImportedSymbol("sqrt", "sqrt")])} />
This will generate:
import osfrom math import sqrt