link.data
Data()
Bases: BipObject
Utility class for data entities.
Data entities are the hierarchical backbone of Bip: Project > Item > Document > Version.
This utility class groups all the methods that are shared for these four entities.
Source code in client/bip/link/data.py
25 26 27 28 29 |
|
project: Project
property
add_to(group)
Add the entity to a Group.
The Group's model must allow the current entity type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group |
Group
|
Group: The Group to which the entity is added. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the operation is forbidden by the GroupModel rules. |
Source code in client/bip/link/data.py
39 40 41 42 43 44 45 46 47 48 49 50 |
|
delete_attribute(definition)
Convenient class implementation of: bip.link.attribute.delete_attribute
.
Warning
The signature of Data.delete_attribute()
and bip.link.attribute.delete_attribute
are different since Data.delete_attribute()
passes itself to the function as entity=self
.
Source code in client/bip/link/data.py
199 200 201 202 203 204 205 206 |
|
get_attribute(definition=None, existing_only=False)
Convenient class implementation of the link.attribute
getters.
- If
definition
is provided, usingbip.link.attribute.get_attribute
. - Otherwise, using
bip.link.attribute.get_all_attribute
.
Warning
The signature of Data.get_attribute()
and bip.link.attribute.get_attribute
or
bip.link.attribute.get_all_attribute
are different since Data.get_attribute()
passes itself to the function as entity=self
.
Source code in client/bip/link/data.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|
get_container(model)
Convenient shortcut for get_containers()
returning a single Group.
Returns a single Group from a given GroupModel. This is useful when it is certain that there is only one Group per model that can contain the current Item.
Examples:
# In the case where
example = link.project.get("example")
shot0100 = example.get_item_by_slug("0100", 'shot', "demo-001")
sequence = shot0100.get_container(model="sequence")
Raises:
Type | Description |
---|---|
ValueError
|
If the GroupModel accepts multiple memberships (an entity can be member of several Groups of the same GroupModel). |
Returns:
Name | Type | Description |
---|---|---|
Group |
List[Group]
|
Found Group. |
Source code in client/bip/link/data.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
|
get_containers(model=None)
Convenient class implementation of: bip.link.group.get_containers
.
Warning
The signature of Project.get_containers()
and bip.link.group.get_containers
are different since Project.get_containers()
passes itself to the function as project=self
.
Info
This method only returns Groups that contains the Project.
For getting the Groups that are owned (children) by the Project, get_group()
or get_groups()
must be used.
Source code in client/bip/link/data.py
90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
get_definition(slug=None, uid=None)
Convenient class implementation of: bip.link.attribute.get_definition
.
Info
This method only returns Definitions that are compatible with the Project entity.
For getting all the Project Definitions, get_all_definitions()
must be used.
Warning
The signature of Data.get_definition()
and bip.link.attribute.get_definition
are different since Data.get_definition()
passes itself to the function as project=self
.
Source code in client/bip/link/data.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
|
get_definitions()
Convenient class implementation of: bip.link.attribute.get_definitions
.
Info
This method only returns Definitions that are compatible with the Project entity.
For getting all the Project Definitions, get_all_definitions()
must be used.
Warning
The signature of Data.get_definitions()
and bip.link.attribute.get_definitions
are different since Data.get_definitions()
passes itself to the function as project=self
.
Source code in client/bip/link/data.py
223 224 225 226 227 228 229 230 231 232 233 234 |
|
get_group(model, slug=None, uid=None)
Get a child Group from a GroupModel.
The model can be provided as GroupModel object or a slug (str
).
The method uses the GroupModel.get_group()
Info
This method only returns Groups that are owned (children) by the Project.
For getting the Groups that contains the Project, get_containers()
must be used.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
Union[GroupModel, str]
|
Union[GroupModel, str]: GroupModel (or its slug) to search into. |
required |
slug |
Optional[str]
|
Optional[str]: Slug of a Group. If specified, |
None
|
uid |
Optional[str]
|
Optional[str]: Uid of a Group. If specified, |
None
|
Raises:
Type | Description |
---|---|
LookupError
|
No matching GroupModel or Group found. |
ValueError
|
No slug nor uid provided. |
Returns:
Name | Type | Description |
---|---|---|
Group |
Group
|
Matching group. |
Source code in client/bip/link/data.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
get_groups(model=None)
Get the children Groups from a GroupModel.
The model can be provided as GroupModel object or a slug (str
).
The method uses the GroupModel.get_groups()
Info
This method only returns Groups that are owned (children) by the Project.
For getting the Groups that contains the Project, get_containers()
must be used.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
Optional[Union[GroupModel, str]]
|
Union[GroupModel, str]: GroupModel (or its slug) to search into. |
None
|
Raises:
Type | Description |
---|---|
LookupError
|
No matching GroupModel or Group found. |
Returns:
Name | Type | Description |
---|---|---|
list |
List[Group]
|
Collection of Groups. |
Source code in client/bip/link/data.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|
set_attribute(definition, value)
Convenient class implementation of: bip.link.attribute.set_attribute
.
Warning
The signature of Data.set_attribute()
and bip.link.attribute.set_attribute
are different since Data.set_attribute()
passes itself to the function as entity=self
.
Source code in client/bip/link/data.py
190 191 192 193 194 195 196 197 |
|