pypuppetdbquery.evaluator module

class pypuppetdbquery.evaluator.Evaluator[source]

Bases: object

Converts a pypuppetdbquery.ast Abstract Syntax Tree into a PuppetDB native AST query.

DECAMEL_RE = re.compile('(?!^)([A-Z]+)')

Regular expression used when converting CamelCase class names to underscore_separated names.

evaluate(ast, mode='nodes')[source]

Process a parsed PuppetDBQuery AST and return a PuppetDB AST.

The resulting PuppetDB AST is a native Python list. It will need converting to JSON (using json.dumps()) before it can be used with PuppetDB.

Parameters:
Returns:

PuppetDB AST

Return type:

list