Ayon-Python-Api 0.1.13__tar.gz → 0.1.14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/PKG-INFO +1 -1
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_api/__init__.py +2 -0
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_api/_api.py +5 -0
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_api/constants.py +1 -1
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_api/server_api.py +88 -0
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_api/utils.py +1 -1
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_api/version.py +1 -1
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_python_api.egg-info/PKG-INFO +1 -1
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/pyproject.toml +1 -1
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/LICENSE +0 -0
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/README.md +0 -0
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_api/entity_hub.py +0 -0
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_api/events.py +0 -0
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_api/exceptions.py +0 -0
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_api/graphql.py +0 -0
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_api/graphql_queries.py +0 -0
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_api/operations.py +0 -0
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_api/thumbnails.py +0 -0
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_python_api.egg-info/SOURCES.txt +0 -0
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_python_api.egg-info/dependency_links.txt +0 -0
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_python_api.egg-info/requires.txt +0 -0
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_python_api.egg-info/top_level.txt +0 -0
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/setup.cfg +0 -0
- {ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/setup.py +0 -0
|
@@ -119,6 +119,7 @@ from ._api import (
|
|
|
119
119
|
get_representations,
|
|
120
120
|
get_representations_parents,
|
|
121
121
|
get_representation_parents,
|
|
122
|
+
get_repre_ids_by_context_filters,
|
|
122
123
|
|
|
123
124
|
create_thumbnail,
|
|
124
125
|
get_thumbnail,
|
|
@@ -245,6 +246,7 @@ __all__ = (
|
|
|
245
246
|
"get_representations",
|
|
246
247
|
"get_representations_parents",
|
|
247
248
|
"get_representation_parents",
|
|
249
|
+
"get_repre_ids_by_context_filters",
|
|
248
250
|
|
|
249
251
|
"create_thumbnail",
|
|
250
252
|
"get_thumbnail",
|
|
@@ -751,6 +751,11 @@ def get_representations_parents(*args, **kwargs):
|
|
|
751
751
|
return con.get_representations_parents(*args, **kwargs)
|
|
752
752
|
|
|
753
753
|
|
|
754
|
+
def get_repre_ids_by_context_filters(*args, **kwargs):
|
|
755
|
+
con = get_server_api_connection()
|
|
756
|
+
return con.get_repre_ids_by_context_filters(*args, **kwargs)
|
|
757
|
+
|
|
758
|
+
|
|
754
759
|
def create_project(
|
|
755
760
|
project_name,
|
|
756
761
|
project_code,
|
|
@@ -56,6 +56,7 @@ from .utils import (
|
|
|
56
56
|
TransferProgress,
|
|
57
57
|
)
|
|
58
58
|
|
|
59
|
+
PatternType = type(re.compile(""))
|
|
59
60
|
JSONDecodeError = getattr(json, "JSONDecodeError", ValueError)
|
|
60
61
|
# This should be collected from server schema
|
|
61
62
|
PROJECT_NAME_ALLOWED_SYMBOLS = "a-zA-Z0-9_"
|
|
@@ -1182,6 +1183,7 @@ class ServerAPI(object):
|
|
|
1182
1183
|
self._graphl_url,
|
|
1183
1184
|
json=data
|
|
1184
1185
|
)
|
|
1186
|
+
response.raise_for_status()
|
|
1185
1187
|
return GraphQlResponse(response)
|
|
1186
1188
|
|
|
1187
1189
|
def get_graphql_schema(self):
|
|
@@ -3129,6 +3131,92 @@ class ServerAPI(object):
|
|
|
3129
3131
|
|
|
3130
3132
|
return output
|
|
3131
3133
|
|
|
3134
|
+
def get_repre_ids_by_context_filters(
|
|
3135
|
+
self,
|
|
3136
|
+
project_name,
|
|
3137
|
+
context_filters,
|
|
3138
|
+
representation_names=None,
|
|
3139
|
+
version_ids=None
|
|
3140
|
+
):
|
|
3141
|
+
"""Find representation ids which match passed context filters.
|
|
3142
|
+
|
|
3143
|
+
Each representation has context integrated on representation entity in
|
|
3144
|
+
database. The context may contain project, folder, task name or subset,
|
|
3145
|
+
family and many more. This implementation gives option to quickly
|
|
3146
|
+
filter representation based on representation data in database.
|
|
3147
|
+
|
|
3148
|
+
Context filters have defined structure. To define filter of nested
|
|
3149
|
+
subfield use dot '.' as delimiter (For example 'task.name').
|
|
3150
|
+
Filter values can be regex filters. String or 're.Pattern' can be used.
|
|
3151
|
+
|
|
3152
|
+
Args:
|
|
3153
|
+
project_name (str): Project where to look for representations.
|
|
3154
|
+
context_filters (dict[str, list[str]]): Filters of context fields.
|
|
3155
|
+
representation_names (Iterable[str]): Representation names, can be
|
|
3156
|
+
used as additional filter for representations by their names.
|
|
3157
|
+
version_ids (Iterable[str]): Version ids, can be used as additional
|
|
3158
|
+
filter for representations by their parent ids.
|
|
3159
|
+
|
|
3160
|
+
Returns:
|
|
3161
|
+
list[str]: Representation ids that match passed filters.
|
|
3162
|
+
|
|
3163
|
+
Example:
|
|
3164
|
+
The function returns just representation ids so if entities are
|
|
3165
|
+
required for funtionality they must be queried afterwards by
|
|
3166
|
+
their ids.
|
|
3167
|
+
>>> project_name = "testProject"
|
|
3168
|
+
>>> filters = {
|
|
3169
|
+
... "task.name": ["[aA]nimation"],
|
|
3170
|
+
... "subset": [".*[Mm]ain"]
|
|
3171
|
+
... }
|
|
3172
|
+
>>> repre_ids = get_repre_ids_by_context_filters(
|
|
3173
|
+
... project_name, filters)
|
|
3174
|
+
>>> repres = get_representations(project_name, repre_ids)
|
|
3175
|
+
"""
|
|
3176
|
+
|
|
3177
|
+
if not isinstance(context_filters, dict):
|
|
3178
|
+
raise TypeError(
|
|
3179
|
+
"Expected 'dict' got {}".format(str(type(context_filters)))
|
|
3180
|
+
)
|
|
3181
|
+
|
|
3182
|
+
filter_body = {}
|
|
3183
|
+
if representation_names is not None:
|
|
3184
|
+
if not representation_names:
|
|
3185
|
+
return []
|
|
3186
|
+
filter_body["names"] = list(set(representation_names))
|
|
3187
|
+
|
|
3188
|
+
if version_ids is not None:
|
|
3189
|
+
if not version_ids:
|
|
3190
|
+
return []
|
|
3191
|
+
filter_body["versionIds"] = list(set(version_ids))
|
|
3192
|
+
|
|
3193
|
+
body_context_filters = []
|
|
3194
|
+
for key, filters in context_filters.items():
|
|
3195
|
+
if not isinstance(filters, (set, list, tuple)):
|
|
3196
|
+
raise TypeError(
|
|
3197
|
+
"Expected 'set', 'list', 'tuple' got {}".format(
|
|
3198
|
+
str(type(filters))))
|
|
3199
|
+
|
|
3200
|
+
|
|
3201
|
+
new_filters = set()
|
|
3202
|
+
for filter_value in filters:
|
|
3203
|
+
if isinstance(filter_value, PatternType):
|
|
3204
|
+
filter_value = filter_value.pattern
|
|
3205
|
+
new_filters.add(filter_value)
|
|
3206
|
+
|
|
3207
|
+
body_context_filters.append({
|
|
3208
|
+
"key": key,
|
|
3209
|
+
"values": list(new_filters)
|
|
3210
|
+
})
|
|
3211
|
+
|
|
3212
|
+
response = self.post(
|
|
3213
|
+
"projects/{}/repreContextFilter".format(project_name),
|
|
3214
|
+
context=body_context_filters,
|
|
3215
|
+
**filter_body
|
|
3216
|
+
)
|
|
3217
|
+
response.raise_for_status()
|
|
3218
|
+
return response.data["ids"]
|
|
3219
|
+
|
|
3132
3220
|
def get_workfiles_info(
|
|
3133
3221
|
self,
|
|
3134
3222
|
project_name,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""Package declaring Python API for Ayon server."""
|
|
2
|
-
__version__ = "0.1.
|
|
2
|
+
__version__ = "0.1.14"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ayon-python-api-0.1.13 → ayon-python-api-0.1.14}/ayon_python_api.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|