python.shotgun_model.data_handler_cache module¶
-
class
ShotgunDataHandlerCache
(raw_data=None)[source]¶ Bases:
object
Low level convenience wrapper around a data handler cache. Contains a dictionary structure of simple objects suitable for fast serialization with pickle.
Used in conjunction with the data handler.
-
CACHE_BY_UID
= 0¶
-
CACHE_CHILDREN
= 1¶
-
FIELD
= 5¶
-
IS_LEAF
= 3¶
-
PARENT
= 4¶
-
SG_DATA
= 6¶
-
UID
= 2¶
-
add_item
(parent_uid, sg_data, field_name, is_leaf, uid)[source]¶ Adds an item to the cache. Checks if the item already exists and if it does, performs an up to date check. If the data is different from the existing data, True is returned.
Parameters: - parent_uid – parent unique id
- sg_data – Shotgun data dictionary
- field_name – optional name of associated shotgun field
- is_leaf – boolean to indicate if node is a child node
- uid – unique id for the item.
Returns: True if the item was updated, False if not.
-
get_all_items
()[source]¶ Generator that returns all items in no particular order
Returns: ShotgunItemData
instances
-
get_child_uids
(parent_uid)[source]¶ Returns all the child uids for the given parent Returned in unspecified order as an iterator for scalability
Parameters: parent_uid – Parent uid Returns: list of child uids
-
get_children
(parent_uid)[source]¶ Generator that returns all childen for the given item.
Parameters: parent_uid – unique id for cache item Returns: ShotgunItemData
instances
-
get_entry_by_uid
(unique_id)[source]¶ Returns a
ShotgunItemData
for a given unique id.Parameters: unique_id – unique id for cache item Returns: ShotgunItemData
instance or None if not found.
-
get_shotgun_data
(unique_id)[source]¶ Optimization. Returns the shotgun data for the given uid.
Parameters: unique_id – unique id for cache item Returns: Associated Shotgun data dictionary
-
item_exists
(unique_id)[source]¶ Checks if an item exists in the cache
Parameters: unique_id – unique id for cache item Returns: True if item exists, false if not
-
raw_data
¶ The raw dictionary data contained in the cache.
-
size
¶ The number of items in the cache
-
take_item
(unique_id)[source]¶ Remove and return the given unique id from the cache
Parameters: unique_id – unique id for cache item Returns: ShotgunItemData
instance or None if not found.
-
uids
¶ All uids in unspecified order, as an iterator for scalability
-