titus.pfaast.EngineConfig

class titus.pfaast.EngineConfig(name, method, inputPlaceholder, outputPlaceholder, begin, action, end, fcns, zero, merge, cells, pools, randseed, doc, version, metadata, options, pos=None)[source]

Bases: titus.pfaast.Ast

Abstract syntax tree for a whole PFA document.

class Context(name, method, input, output, compiledTypes, begin, action, end, fcns, zero, merge, cells, pools, randseed, doc, version, metadata, options, parser)

Bases: titus.pfaast.AstContext

__init__(name, method, input, output, compiledTypes, begin, action, end, fcns, zero, merge, cells, pools, randseed, doc, version, metadata, options, parser)
EngineConfig.__init__(name, method, inputPlaceholder, outputPlaceholder, begin, action, end, fcns, zero, merge, cells, pools, randseed, doc, version, metadata, options, pos=None)
EngineConfig.collect(pf)

Walk over tree applying a partial function, returning a list of results in its domain.

Parameters:
  • pf (callable with isDefinedAt method) – partial function that takes any titus.pfaast.Ast as an argument, returning anything
  • pf.isDefinedAt (callable) – domain that takes any titus.pfaast.Ast as an argument, returning True if this item is in the domain, False otherwise
Return type:

list of function results

Returns:

a result for each abstract syntax tree node in the pf function’s domain

EngineConfig.input

Input type after type resolution (titus.datatype.AvroType).

EngineConfig.jsonNode(lineNumbers, memo)

Convert this abstract syntax tree to Pythonized JSON.

Parameters:
  • lineNumbers (bool) – if True, include locator marks in each JSON object
  • memo (set of string) – used to avoid recursion; provide an empty set if unsure
Return type:

Pythonized JSON

Returns:

JSON representation

EngineConfig.output

Output type after type resolution (titus.datatype.AvroType).

EngineConfig.replace(pf)

Walk over tree applying a partial function, returning a transformed copy of the tree.

Parameters:
  • pf (callable with isDefinedAt method) – partial function that takes any titus.pfaast.Ast as an argument, returning a replacement titus.pfaast.Ast
  • pf.isDefinedAt (callable) – domain that takes any titus.pfaast.Ast as an argument, returning True if this item is in the domain, False otherwise
Return type:

new titus.pfaast.Ast tree

Returns:

tree with nodes in the pf function’s domain transformed; everything else left as-is

EngineConfig.toString()
EngineConfig.walk(task, symbolTable, functionTable, engineOptions, pfaVersion)

Walk over tree applying a titus.pfaast.Task while checking for semantic errors.

This is how Python is generated from an abstract syntax tree: the titus.pfaast.Task in that case is titus.genpy.GeneratePython.

Parameters:
Return type:

(titus.pfaast.AstContext, titus.pfaast.TaskResult)

Returns:

(information about this abstract syntax tree node after type-checking, result of the generic task)