This attribute type can hold a single arbitrary Python object.
Methods ¶
Static methods ¶
isValidName(str)
→ bool
Returns True
if the specified name is a valid attribute name, else returns
False
.
Instance Methods ¶
copyFrom(attribute)
Copies the Python Object from attribute
into this attribute.
copyTo(owner, overwrite=True, deep_copy=False)
Copies this attribute onto the specified pdg.AttributeOwner.
If overwrite
is True
, the attribute will overwrite an existing attribute with the same name.
If deep_copy
is True
, a new copy of the attribute data will be made on the owner
. Otherwise, a shallow copy will be made if possible.
asFile(index=0, tag='', hash=0, own=False)
→ pdg.File
Casts the value at the specified index to a pdg.File object, with the specified tag, hash value and ownernship flag.
asNumber(index=0)
→ float
Casts the value at the specified index to a numeric value.
asString(index=0)
→ str
Casts the value at the specified index to a string value.
asValues()
→ str
Returns the same value as asString
, but the result is quoted to make it safe for use in a commandline.
hasFlag(flag)
→ bool
Returns true if the attribute has the specified pdg.attribFlag set.
hasFlags(bits)
→ bool
Returns true if the attribute has the specified pdg.attribFlag bits
set. The bits should be passed in as an integer, ORed from entries in the
attribFlags
enum.
hasAnyFlags(bits)
→ bool
Returns true if the attribute has any of specified pdg.attribFlag bits
set. The bits should be passed in as an integer, ORed from entries in the
attribFlags
enum.
queryF(str)
→ float
Makes a floating point query using the attribute evaluator syntax. Expects the object is a composed of nested dictionaries/iterables
queryS(str)
→ str
Makes a string value query using the attribute evaluator syntax. Expects the object to be composed of nested dictionaries/iterables.
queryP(str)
→ object
Makes a python object query using the attribute evaluator syntax. Expects the object to be composed of nester dictionaries/iterables.
setFlag(flag, value=True)
→ bool
Sets or clears the specified pdg.attribFlag. Returns True
if the flag value was modified.
setFlags(flag, bits)
→ bool
Sets the attribute flags to the specified bits. Returns True
if the flag value was modified.
setValue(object, index=0)
Sets the value of the attribute at the specified index. This function is
provided for compatibility with other attribute types - the index
will
not be used since Python object attributes can only hold a single value
setValues(object)
This function is provided for compatibility with other attribute types,
and is the same as calling attr.setValue(obj, 0)
or attr.object = obj
.
value(index=0)
→ object
Returns the Python object stored in the attribute. Since Python object
attributes only hold a single value, the index
parameter is ignored. It
is only included for compatibility with other attribute types.
flags
: int
Property
The flag bit vector, contains ORed bits from the pdg.attribFlag enum.
hasData
: bool
Property
Set to True
if the attribute has been assigned a valid Python object.
isArray
: bool
Property
Set to False
for this type of attribute.
isNumeric
: bool
Property
Set to False
for this type of attribute.
name
: `str
Property
The name of the attribute.
object
: object
Property
Returns the PyObject contained in this attribute.
owner
: pdg.AttributeOwner
Property
The pdg.AttributeOwner that owns this attribute, i.e. a work item or graph instance.
size
: int
Property
The length of the array stored in the attribute. Can also be access as
len(attrib)
.
type
: pdg.attribType
Property
The type of the attribute, i.e. pdg.attribType.PyObject
.
values
: object
Property
Returns the object stored on the attribute. This function is provided for compatibility with other array attribute types.