ClassAd Class
- class classad2.ClassAd(input=None)
A
ClassAdis acollections.abc.MutableMappingwith class:string keys that represents a “record expression” in the ClassAd language, more usually called “a ClassAd”.Values in a ClassAd have types, and those types are represented as built-in Python types –
– with the following exceptions:
ClassAd (
ClassAd)undefined (
classad2.Value.Undefined)error (
classad2.Value.Error)expression (
ExprTree)
When setting a value,
Noneis converted toclassad2.Value.Undefinedanddicts are converted toClassAds.Expressions are always evaluated lazily, so setting a value to
ExprTree2 + 2will not result in the value being theint4; this also applies when constructing or parsingClassAds orExprTrees.- Parameters
input (Optional[Union[str, dict]]) –
If
None, create an empty ClassAd.If a
str, parse theParserType.Newformat string and create the corresponding ClassAd.If a
dict, convert the dictionary to a ClassAd.
- eval(attr)
Evaluate the attribute named by attr in the context of this ClassAd.
- Parameters
attr (str) – The attribute to evaluate.
- externalRefs(expr) List[str]
Returns the list of attributes referenced by the expression expr which are not defined by this ClassAd.
- Parameters
expr (ExprTree) – The expression.
- flatten(expr) ExprTree
Partially evaluate the expression in the context of this ad. Attributes referenced by the expression which are not defined by this ClassAd are not evaluated, but other attributes and subexpressions are. Thus,
RequestMemory * 1024 * 1024will evaluate to the amount of requested memory in bytes if this ClassAd defines theRequestMemoryattribute, and toRequestMemory * 1048576otherwise.- Parameters
expr (ExprTree) – The expression.
- internalRefs(expr) List[str]
Returns the list of attributes referenced by the expression expr which are defined by this ClassAd.
- Parameters
expr (ExprTree) – The expression.
- lookup(attr) ExprTree
Return the
ExprTreenamed by attr.- Parameters
attr (str) – The attribute to look up.