compile
¶
APPLCompiled
¶
A compiled APPL function that can be called with context.
Parameters:
-
code
(CodeType
) –The compiled code object.
-
ast
(AST
) –The AST of the compiled code.
-
original_func
(Callable
) –The original function.
-
compile_info
(Dict
) –The compile information.
Source code in src/appl/core/compile.py
AddCtxToArgs
¶
Bases: ApplNodeTransformer
An AST node transformer that adds _ctx to the function arguments.
Source code in src/appl/core/compile.py
visit_FunctionDef
¶
visit_FunctionDef(node: FunctionDef) -> FunctionDef
Add _ctx to the function arguments if not present.
Source code in src/appl/core/compile.py
AddExecuteWrapper
¶
Bases: ApplNodeTransformer
An AST node transformer that adds the appl.execute wrapper to expression statements.
Source code in src/appl/core/compile.py
visit_Expr
¶
Add appl.execute wrapper to expression statements.
Source code in src/appl/core/compile.py
ApplNodeTransformer
¶
Bases: NodeTransformer
A base class for AST node transformers in APPL.
Source code in src/appl/core/compile.py
CallWithContext
¶
Bases: ApplNodeTransformer
An AST node transformer provides the context to function calls.
Source code in src/appl/core/compile.py
visit_Call
¶
Provide context (_ctx) to function calls that needs ctx.
Source code in src/appl/core/compile.py
DedentTripleQuotedString
¶
Bases: CSTTransformer
A CST transformer that dedents triple-quoted strings in the source code.
leave_FormattedString
¶
leave_FormattedString(
original_node: FormattedString,
updated_node: FormattedString,
) -> FormattedString
Dedent triple-quoted formatted strings in the source code.
Source code in src/appl/core/compile.py
leave_SimpleString
¶
Dedent triple-quoted strings in the source code.
Source code in src/appl/core/compile.py
RemoveApplDecorator
¶
Bases: ApplNodeTransformer
An AST node transformer that removes the ppl decorator.
Source code in src/appl/core/compile.py
visit_FunctionDef
¶
Remove the ppl decorator from the function definition.
Source code in src/appl/core/compile.py
SplitString
¶
Bases: ApplNodeTransformer
An AST node transformer that splits the f-string into multiple parts.
Source code in src/appl/core/compile.py
visit_Expr
¶
visit_Expr(node: Expr) -> stmt
Split the f-string into multiple parts, so that we can add appl.execute wrapper to each part.
Source code in src/appl/core/compile.py
appl_compile
¶
appl_compile(func: Callable) -> APPLCompiled
Compile an APPL function.
Source code in src/appl/core/compile.py
appl_dedent
¶
Dedent the source code.
Source code in src/appl/core/compile.py
dedent_triple_quoted_string
¶
Automatically dedent triple-quoted strings with in the code (with inspect.cleandoc).