ftrack_api.collection
- class ftrack_api.collection.Collection(entity, attribute, mutable=True, data=None)[source]
A collection of entities.
- append(value)
S.append(value) – append value to the end of the sequence
- clear() None -- remove all items from S
- count(value) integer -- return number of occurrences of value
- extend(values)
S.extend(iterable) – extend sequence by appending elements from the iterable
- index(value[, start[, stop]]) integer -- return first index of value.
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
- pop([index]) item -- remove and return item at index (default last).
Raise IndexError if list is empty or index is out of range.
- remove(value)
S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.
- reverse()
S.reverse() – reverse IN PLACE
- class ftrack_api.collection.MappedCollectionProxy(collection)[source]
Common base class for mapped collection of entities.
- property mutable
Return whether collection is mutable.
- property attribute
Return attribute bound to.
- clear() None. Remove all items from D.
- get(k[, d]) D[k] if k in D, else d. d defaults to None.
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- pop(k[, d]) v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised.
- popitem() (k, v), remove and return some (key, value) pair
as a 2-tuple; but raise KeyError if D is empty.
- setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
- update([E, ]**F) None. Update D from mapping/iterable E and F.
If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
- values() an object providing a view on D's values
- class ftrack_api.collection.KeyValueMappedCollectionProxy(collection, creator, key_attribute, value_attribute)[source]
A mapped collection of key, value entities.
Proxy a standard
Collection
as a mapping where certain attributes from the entities in the collection are mapped to key, value pairs.For example:
>>> collection = [Metadata(key='foo', value='bar'), ...] >>> mapped = KeyValueMappedCollectionProxy( ... collection, create_metadata, ... key_attribute='key', value_attribute='value' ... ) >>> print mapped['foo'] 'bar' >>> mapped['bam'] = 'biz' >>> print mapped.collection[-1] Metadata(key='bam', value='biz')
- property attribute
Return attribute bound to.
- clear() None. Remove all items from D.
- get(k[, d]) D[k] if k in D, else d. d defaults to None.
- items() a set-like object providing a view on D's items
- property mutable
Return whether collection is mutable.
- pop(k[, d]) v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised.
- popitem() (k, v), remove and return some (key, value) pair
as a 2-tuple; but raise KeyError if D is empty.
- setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
- update([E, ]**F) None. Update D from mapping/iterable E and F.
If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
- values() an object providing a view on D's values
- class ftrack_api.collection.PerSessionDefaultKeyMaker[source]
Generate key for session.
- __init__()
Initialise key maker.
- key(*items)
Return key for items.
- ftrack_api.collection.memoise_session(function)
Memoiser for use with callables that should be called once per session.
- class ftrack_api.collection.CustomAttributeCollectionProxy(collection)[source]
A mapped collection of custom attribute value entities.
- get_configuration_id_from_key(key)[source]
Return id of configuration with matching key.
Raise
KeyError
if no configuration with matching key found.
- property attribute
Return attribute bound to.
- clear() None. Remove all items from D.
- get(k[, d]) D[k] if k in D, else d. d defaults to None.
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- property mutable
Return whether collection is mutable.
- pop(k[, d]) v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised.
- popitem() (k, v), remove and return some (key, value) pair
as a 2-tuple; but raise KeyError if D is empty.
- setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
- update([E, ]**F) None. Update D from mapping/iterable E and F.
If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
- values() an object providing a view on D's values