flowrep.compiler.sugar module

flowrep.compiler.sugar.attribute_name(label: str, recipe: WorkflowRecipe) str | None[source]

The identifier fed to label’s name port by a constant peer, else None.

flowrep.compiler.sugar.is_attribute_syntax(value: Any) bool[source]

True if value can be written after a . in Python source.

Deliberately laxer than base_models.is_valid_label(), which also excludes the reserved port names inputs/outputs. Those are perfectly legal attributes, and dc.inputs must compile back to dc.inputs.

flowrep.compiler.sugar.is_std_getattr(node: Annotated[AtomicRecipe | ConstantRecipe | ForEachRecipe | IfRecipe | TryRecipe | WhileRecipe | WorkflowRecipe, FieldInfo(annotation=NoneType, required=True, discriminator='type')]) bool[source]

True if node is the standard-library attribute-access recipe.

Matched on the referenced function’s fully qualified name rather than on VersionInfo equality, so a recipe serialised under a different flowrep version is still recognised.

flowrep.compiler.sugar.is_std_getitem(node: Annotated[AtomicRecipe | ConstantRecipe | ForEachRecipe | IfRecipe | TryRecipe | WhileRecipe | WorkflowRecipe, FieldInfo(annotation=NoneType, required=True, discriminator='type')]) bool[source]

True if node is the standard-library item-access recipe.

Matched on the referenced function’s fully qualified name rather than on VersionInfo equality, so a recipe serialised under a different flowrep version is still recognised.