ClassAd
Class
- class classad2.ClassAd(input=None)
The ClassAd language defines a ClassAd as a mapping from attribute names to expressions. A
ClassAd
is acollections.abc.MutableMapping
fromstr
ing keys toExprTree
values. Expressions are always evaluated before being returned, and unless you calllookup()
, converted into the corresponding Python type.A ClassAd expression may evaluate to (but is returned by
ClassAd
as):undefined (
classad2.Value.Undefined
)a boolean (
bool
)an integer (
int
)a float (
float
)a string (
str
)an absolute time value (
datetime.datetime
)a relative time value (
float
)a list (
list
)a ClassAd (
ClassAd
)error (
classad2.Value.Error
)
When setting a value, the reverse is true. Additionally,
None
is converted toclassad2.Value.Undefined
anddict
s are converted toClassAd
s.- Parameters
input (
Union
[str
,dict
,None
]) –If
None
, create an empty ClassAd.If a
str
, parse theParserType.New
format 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)
Returns the list of attributes referenced by the expression expr which are not defined by this ClassAd.
- flatten(expr)
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 * 1024
will evaluate to the amount of requested memory in bytes if this ClassAd defines theRequestMemory
attribute, and toRequestMemory * 1048576
otherwise.
- internalRefs(expr)
Returns the list of attributes referenced by the expression expr which are defined by this ClassAd.
- matches(ad)
Evaluate the
requirements
attribute of the given ad in the context of this one.