ExprTree Class

class classad2.ExprTree(expr=None)

An expression in the ClassAd language.

Parameters

expr (Union[str, ExprTree, None]) –

  • If None, create an empty ExprTree.

  • If a str, parse the string in the ClassAd language and create the corresponding ExprTree.

  • If an ExprTree, create a deep copy of expr.

eval(scope=None, target=None)

Evaluate the expression and return the corresponding Python type; either a classad2.ClassAd, a boolean, a string, a datetime.datetime, a float, an integer, a classad::Value, or a list; the list may contain any of the above types, or classad2.ExprTrees.

To evaluate an classad2.ExprTree containing attribute references, you must supply a scope. An classad2.ExprTree does not record which classad2.ClassAd, if any, it was extracted from.

Expressions may contain TARGET. references, especially if they were originally intended for match-making. You may supply an additional ClassAd for resolving such references.

Parameters
  • scope (ClassAd) – The scope in which to look up MY. (and unscoped) attribute references.

  • target (ClassAd) – The scope in which to look up TARGET. references.

simplify(scope=None, target=None)

Evaluate the expression and return an ExprTree.

To evaluate an classad2.ExprTree containing attribute references, you must supply a scope. An classad2.ExprTree does not record which classad2.ClassAd, if any, it was extracted from.

Expressions may contain TARGET. references, especially if they were originally intended for match-making. You may supply an additional ClassAd for resolving such references.

Parameters
  • scope (ClassAd) – The scope in which to look up MY. (and unscoped) attribute references.

  • target (ClassAd) – The scope in which to look up TARGET. references.