ftrack_api.attribute
- ftrack_api.attribute.merge_references(function)[source]
Decorator to handle merging of references / collections.
- class ftrack_api.attribute.Attributes(attributes=None)[source]
Collection of properties accessible by name.
- class ftrack_api.attribute.Attribute(name, default_value=Symbol(NOT_SET), mutable=True, computed=False)[source]
A name and value pair persisted remotely.
- __init__(name, default_value=Symbol(NOT_SET), mutable=True, computed=False)[source]
Initialise attribute with name.
default_value represents the default value for the attribute. It may be a callable. It is not used within the attribute when providing values, but instead exists for other parts of the system to reference.
If mutable is set to False then the local value of the attribute on an entity can only be set when both the existing local and remote values are
ftrack_api.symbol.NOT_SET
. The exception to this is when the target value is alsoftrack_api.symbol.NOT_SET
.If computed is set to True the value is a remote side computed value and should not be long-term cached.
- property name
Return name.
- property mutable
Return whether attribute is mutable.
- property computed
Return whether attribute is computed.
- get_value(entity)[source]
Return current value for entity.
If a value was set locally then return it, otherwise return last known remote value. If no remote value yet retrieved, make a request for it via the session and block until available.
- get_remote_value(entity)[source]
Return remote value for entity.
Note
Only return locally stored remote value, do not fetch from remote.
- set_remote_value(entity, value)[source]
Set remote value.
Note
Only set locally stored remote value, do not persist to remote.
- class ftrack_api.attribute.ScalarAttribute(name, data_type, **kw)[source]
Represent a scalar value.
- property computed
Return whether attribute is computed.
- get_entity_storage(entity)
Return attribute storage on entity creating if missing.
- get_local_value(entity)
Return locally set value for entity.
- get_remote_value(entity)
Return remote value for entity.
Note
Only return locally stored remote value, do not fetch from remote.
- get_value(entity)
Return current value for entity.
If a value was set locally then return it, otherwise return last known remote value. If no remote value yet retrieved, make a request for it via the session and block until available.
- is_modified(entity)
Return whether local value set and differs from remote.
Note
Will not fetch remote value so may report True even when values are the same on the remote.
- is_set(entity)
Return whether a value is set for entity.
- property mutable
Return whether attribute is mutable.
- property name
Return name.
- populate_remote_value(entity)
Populate remote value for entity.
- set_local_value(entity, value)
Set local value for entity.
- set_remote_value(entity, value)
Set remote value.
Note
Only set locally stored remote value, do not persist to remote.
- class ftrack_api.attribute.ReferenceAttribute(name, entity_type, **kw)[source]
Reference another entity.
- populate_remote_value(entity)[source]
Populate remote value for entity.
As attribute references another entity, use that entity’s configured default projections to auto populate useful attributes when loading.
- is_modified(entity)[source]
Return whether a local value has been set and differs from remote.
Note
Will not fetch remote value so may report True even when values are the same on the remote.
- get_value(entity)[source]
Return current value for entity.
If a value was set locally then return it, otherwise return last known remote value. If no remote value yet retrieved, make a request for it via the session and block until available.
- property computed
Return whether attribute is computed.
- get_entity_storage(entity)
Return attribute storage on entity creating if missing.
- get_local_value(entity)
Return locally set value for entity.
- get_remote_value(entity)
Return remote value for entity.
Note
Only return locally stored remote value, do not fetch from remote.
- is_set(entity)
Return whether a value is set for entity.
- property mutable
Return whether attribute is mutable.
- property name
Return name.
- set_local_value(entity, value)
Set local value for entity.
- set_remote_value(entity, value)
Set remote value.
Note
Only set locally stored remote value, do not persist to remote.
- class ftrack_api.attribute.AbstractCollectionAttribute(name, default_value=Symbol(NOT_SET), mutable=True, computed=False)[source]
Base class for collection attributes.
- collection_class = None
Collection class used by attribute.
- get_value(entity)[source]
Return current value for entity.
If a value was set locally then return it, otherwise return last known remote value. If no remote value yet retrieved, make a request for it via the session and block until available.
Note
As value is a collection that is mutable, will transfer a remote value into the local value on access if no local value currently set.
- set_remote_value(entity, value)[source]
Set remote value.
Note
Only set locally stored remote value, do not persist to remote.
- __init__(name, default_value=Symbol(NOT_SET), mutable=True, computed=False)
Initialise attribute with name.
default_value represents the default value for the attribute. It may be a callable. It is not used within the attribute when providing values, but instead exists for other parts of the system to reference.
If mutable is set to False then the local value of the attribute on an entity can only be set when both the existing local and remote values are
ftrack_api.symbol.NOT_SET
. The exception to this is when the target value is alsoftrack_api.symbol.NOT_SET
.If computed is set to True the value is a remote side computed value and should not be long-term cached.
- property computed
Return whether attribute is computed.
- get_entity_storage(entity)
Return attribute storage on entity creating if missing.
- get_local_value(entity)
Return locally set value for entity.
- get_remote_value(entity)
Return remote value for entity.
Note
Only return locally stored remote value, do not fetch from remote.
- is_modified(entity)
Return whether local value set and differs from remote.
Note
Will not fetch remote value so may report True even when values are the same on the remote.
- is_set(entity)
Return whether a value is set for entity.
- property mutable
Return whether attribute is mutable.
- property name
Return name.
- populate_remote_value(entity)
Populate remote value for entity.
- class ftrack_api.attribute.CollectionAttribute(name, default_value=Symbol(NOT_SET), mutable=True, computed=False)[source]
Represent a collection of other entities.
- collection_class
Collection class used by attribute.
alias of
Collection
- __init__(name, default_value=Symbol(NOT_SET), mutable=True, computed=False)
Initialise attribute with name.
default_value represents the default value for the attribute. It may be a callable. It is not used within the attribute when providing values, but instead exists for other parts of the system to reference.
If mutable is set to False then the local value of the attribute on an entity can only be set when both the existing local and remote values are
ftrack_api.symbol.NOT_SET
. The exception to this is when the target value is alsoftrack_api.symbol.NOT_SET
.If computed is set to True the value is a remote side computed value and should not be long-term cached.
- property computed
Return whether attribute is computed.
- get_entity_storage(entity)
Return attribute storage on entity creating if missing.
- get_local_value(entity)
Return locally set value for entity.
- get_remote_value(entity)
Return remote value for entity.
Note
Only return locally stored remote value, do not fetch from remote.
- get_value(entity)
Return current value for entity.
If a value was set locally then return it, otherwise return last known remote value. If no remote value yet retrieved, make a request for it via the session and block until available.
Note
As value is a collection that is mutable, will transfer a remote value into the local value on access if no local value currently set.
- is_modified(entity)
Return whether local value set and differs from remote.
Note
Will not fetch remote value so may report True even when values are the same on the remote.
- is_set(entity)
Return whether a value is set for entity.
- property mutable
Return whether attribute is mutable.
- property name
Return name.
- populate_remote_value(entity)
Populate remote value for entity.
- set_local_value(entity, value)
Set local value for entity.
- set_remote_value(entity, value)
Set remote value.
Note
Only set locally stored remote value, do not persist to remote.
- class ftrack_api.attribute.KeyValueMappedCollectionAttribute(name, creator, key_attribute, value_attribute, **kw)[source]
Represent a mapped key, value collection of entities.
- collection_class
Collection class used by attribute.
alias of
KeyValueMappedCollectionProxy
- __init__(name, creator, key_attribute, value_attribute, **kw)[source]
Initialise attribute with name.
creator should be a function that accepts a dictionary of data and is used by the referenced collection to create new entities in the collection.
key_attribute should be the name of the attribute on an entity in the collection that represents the value for ‘key’ of the dictionary.
value_attribute should be the name of the attribute on an entity in the collection that represents the value for ‘value’ of the dictionary.
- property computed
Return whether attribute is computed.
- get_entity_storage(entity)
Return attribute storage on entity creating if missing.
- get_local_value(entity)
Return locally set value for entity.
- get_remote_value(entity)
Return remote value for entity.
Note
Only return locally stored remote value, do not fetch from remote.
- get_value(entity)
Return current value for entity.
If a value was set locally then return it, otherwise return last known remote value. If no remote value yet retrieved, make a request for it via the session and block until available.
Note
As value is a collection that is mutable, will transfer a remote value into the local value on access if no local value currently set.
- is_modified(entity)
Return whether local value set and differs from remote.
Note
Will not fetch remote value so may report True even when values are the same on the remote.
- is_set(entity)
Return whether a value is set for entity.
- property mutable
Return whether attribute is mutable.
- property name
Return name.
- populate_remote_value(entity)
Populate remote value for entity.
- set_local_value(entity, value)
Set local value for entity.
- set_remote_value(entity, value)
Set remote value.
Note
Only set locally stored remote value, do not persist to remote.
- class ftrack_api.attribute.CustomAttributeCollectionAttribute(name, default_value=Symbol(NOT_SET), mutable=True, computed=False)[source]
Represent a mapped custom attribute collection of entities.
- collection_class
Collection class used by attribute.
alias of
CustomAttributeCollectionProxy
- __init__(name, default_value=Symbol(NOT_SET), mutable=True, computed=False)
Initialise attribute with name.
default_value represents the default value for the attribute. It may be a callable. It is not used within the attribute when providing values, but instead exists for other parts of the system to reference.
If mutable is set to False then the local value of the attribute on an entity can only be set when both the existing local and remote values are
ftrack_api.symbol.NOT_SET
. The exception to this is when the target value is alsoftrack_api.symbol.NOT_SET
.If computed is set to True the value is a remote side computed value and should not be long-term cached.
- property computed
Return whether attribute is computed.
- get_entity_storage(entity)
Return attribute storage on entity creating if missing.
- get_local_value(entity)
Return locally set value for entity.
- get_remote_value(entity)
Return remote value for entity.
Note
Only return locally stored remote value, do not fetch from remote.
- get_value(entity)
Return current value for entity.
If a value was set locally then return it, otherwise return last known remote value. If no remote value yet retrieved, make a request for it via the session and block until available.
Note
As value is a collection that is mutable, will transfer a remote value into the local value on access if no local value currently set.
- is_modified(entity)
Return whether local value set and differs from remote.
Note
Will not fetch remote value so may report True even when values are the same on the remote.
- is_set(entity)
Return whether a value is set for entity.
- property mutable
Return whether attribute is mutable.
- property name
Return name.
- populate_remote_value(entity)
Populate remote value for entity.
- set_local_value(entity, value)
Set local value for entity.
- set_remote_value(entity, value)
Set remote value.
Note
Only set locally stored remote value, do not persist to remote.