syside.pprint

pprint(arg0: syside.Element, printer: syside.ModelPrinter | None = None, config: syside.PrinterConfig = ...) str

Prints model subtree starting at root to textual syntax.

NOTE This performs very little checking that the given model can be represented in textual syntax, besides checking for elements that are missing. This has no effect when used as a formatter on a model parsed without syntax errors but programmatic models are not guaranteed to be valid textual syntax. In addition, it does not check that references are reachable from their scopes so parsing the printed model can fail to find them again. Otherwise, clearly unreachable references, such as when one of their ancestors is anonymous, will raise errors.

Only the first import from any parent namespaces that would shorten the printed reference is used. This does not apply to imports themselves to prevent reference resolution errors due to multiple or cyclical imports. Additionally, references relative to left-hand side expression result types, such as those from FeatureChainExpressions, are assumed to be directly or indirectly accessible so only their short or regular name is printed.