gazu 0.10.15__py2.py3-none-any.whl → 0.10.17__py2.py3-none-any.whl
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.
- gazu/__version__.py +1 -1
- gazu/casting.py +4 -1
- gazu/client.py +37 -8
- gazu/playlist.py +11 -21
- gazu/task.py +3 -23
- {gazu-0.10.15.dist-info → gazu-0.10.17.dist-info}/METADATA +3 -3
- {gazu-0.10.15.dist-info → gazu-0.10.17.dist-info}/RECORD +10 -10
- {gazu-0.10.15.dist-info → gazu-0.10.17.dist-info}/WHEEL +1 -1
- {gazu-0.10.15.dist-info → gazu-0.10.17.dist-info}/LICENSE +0 -0
- {gazu-0.10.15.dist-info → gazu-0.10.17.dist-info}/top_level.txt +0 -0
gazu/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.10.
|
|
1
|
+
__version__ = "0.10.17"
|
gazu/casting.py
CHANGED
|
@@ -60,7 +60,10 @@ def update_episode_casting(project, episode, casting, client=default):
|
|
|
60
60
|
"""
|
|
61
61
|
episode = normalize_model_parameter(episode)
|
|
62
62
|
project = normalize_model_parameter(project)
|
|
63
|
-
path = "data/projects/%s/entities/%s/casting" % (
|
|
63
|
+
path = "data/projects/%s/entities/%s/casting" % (
|
|
64
|
+
project["id"],
|
|
65
|
+
episode["id"],
|
|
66
|
+
)
|
|
64
67
|
return raw.put(path, casting, client=client)
|
|
65
68
|
|
|
66
69
|
|
gazu/client.py
CHANGED
|
@@ -303,6 +303,32 @@ def delete(path, params=None, client=default_client):
|
|
|
303
303
|
return response.text
|
|
304
304
|
|
|
305
305
|
|
|
306
|
+
def get_message_from_response(
|
|
307
|
+
response, default_message="No additional information"
|
|
308
|
+
):
|
|
309
|
+
"""
|
|
310
|
+
A utility function that handles Zou's inconsistent message keys.
|
|
311
|
+
For a given request, checks if any error messages or regular messages were given and returns their value.
|
|
312
|
+
If no messages are found, returns a default message.
|
|
313
|
+
|
|
314
|
+
Args:
|
|
315
|
+
response: requests.Request - A response to check.
|
|
316
|
+
default_message: str - An optional default value to revert to if no message is detected.
|
|
317
|
+
|
|
318
|
+
Returns:
|
|
319
|
+
The message of a given response, or a default message - if any.
|
|
320
|
+
"""
|
|
321
|
+
message = default_message
|
|
322
|
+
message_json = response.json()
|
|
323
|
+
|
|
324
|
+
for key in ["error", "message"]:
|
|
325
|
+
if message_json.get(key):
|
|
326
|
+
message = message_json[key]
|
|
327
|
+
break
|
|
328
|
+
|
|
329
|
+
return message
|
|
330
|
+
|
|
331
|
+
|
|
306
332
|
def check_status(request, path, client=None):
|
|
307
333
|
"""
|
|
308
334
|
Raise an exception related to status code, if the status code does not
|
|
@@ -329,8 +355,7 @@ def check_status(request, path, client=None):
|
|
|
329
355
|
elif status_code == 403:
|
|
330
356
|
raise NotAllowedException(path)
|
|
331
357
|
elif status_code == 400:
|
|
332
|
-
|
|
333
|
-
raise ParameterException(path, text)
|
|
358
|
+
raise ParameterException(path, get_message_from_response(request))
|
|
334
359
|
elif status_code == 405:
|
|
335
360
|
raise MethodNotAllowedException(path)
|
|
336
361
|
elif status_code == 413:
|
|
@@ -359,14 +384,15 @@ def check_status(request, path, client=None):
|
|
|
359
384
|
raise
|
|
360
385
|
elif status_code in [500, 502]:
|
|
361
386
|
try:
|
|
387
|
+
print("A server error occured!\n")
|
|
362
388
|
stacktrace = request.json().get(
|
|
363
389
|
"stacktrace", "No stacktrace sent by the server"
|
|
364
390
|
)
|
|
365
|
-
message = request.json().get(
|
|
366
|
-
"message", "No message sent by the server"
|
|
367
|
-
)
|
|
368
|
-
print("A server error occured!\n")
|
|
369
391
|
print("Server stacktrace:\n%s" % stacktrace)
|
|
392
|
+
message = get_message_from_response(
|
|
393
|
+
response=request,
|
|
394
|
+
default_message="No message sent by the server",
|
|
395
|
+
)
|
|
370
396
|
print("Error message:\n%s\n" % message)
|
|
371
397
|
except Exception:
|
|
372
398
|
print(request.text)
|
|
@@ -474,8 +500,11 @@ def upload(path, file_path, data={}, extra_files=[], client=default_client):
|
|
|
474
500
|
except JSONDecodeError:
|
|
475
501
|
print(response.text)
|
|
476
502
|
raise
|
|
477
|
-
|
|
478
|
-
|
|
503
|
+
|
|
504
|
+
result_message = get_message_from_response(response, default_message="")
|
|
505
|
+
if result_message:
|
|
506
|
+
raise UploadFailedException(result_message)
|
|
507
|
+
|
|
479
508
|
return result
|
|
480
509
|
|
|
481
510
|
|
gazu/playlist.py
CHANGED
|
@@ -166,16 +166,12 @@ def get_entity_preview_files(entity, client=default):
|
|
|
166
166
|
entity = normalize_model_parameter(entity)
|
|
167
167
|
return raw.get(
|
|
168
168
|
"data/playlists/entities/%s/preview-files" % entity["id"],
|
|
169
|
-
client=client
|
|
169
|
+
client=client,
|
|
170
170
|
)
|
|
171
171
|
|
|
172
172
|
|
|
173
173
|
def add_entity_to_playlist(
|
|
174
|
-
playlist,
|
|
175
|
-
entity,
|
|
176
|
-
preview_file=None,
|
|
177
|
-
persist=True,
|
|
178
|
-
client=default
|
|
174
|
+
playlist, entity, preview_file=None, persist=True, client=default
|
|
179
175
|
):
|
|
180
176
|
"""
|
|
181
177
|
Add an entity to the playlist, use the last uploaded preview as revision
|
|
@@ -197,25 +193,23 @@ def add_entity_to_playlist(
|
|
|
197
193
|
for task_type_id in preview_files.keys():
|
|
198
194
|
task_type_files = preview_files[task_type_id]
|
|
199
195
|
first_file = task_type_files[0]
|
|
200
|
-
if
|
|
201
|
-
|
|
196
|
+
if (
|
|
197
|
+
preview_file is None
|
|
198
|
+
or preview_file["created_at"] < first_file["created_at"]
|
|
199
|
+
):
|
|
202
200
|
preview_file = first_file
|
|
203
201
|
|
|
204
202
|
preview_file = normalize_model_parameter(preview_file)
|
|
205
|
-
playlist["shots"].append(
|
|
206
|
-
"entity_id": entity["id"],
|
|
207
|
-
|
|
208
|
-
})
|
|
203
|
+
playlist["shots"].append(
|
|
204
|
+
{"entity_id": entity["id"], "preview_file_id": preview_file["id"]}
|
|
205
|
+
)
|
|
209
206
|
if persist:
|
|
210
207
|
update_playlist(playlist, client=client)
|
|
211
208
|
return playlist
|
|
212
209
|
|
|
213
210
|
|
|
214
211
|
def remove_entity_from_playlist(
|
|
215
|
-
playlist,
|
|
216
|
-
entity,
|
|
217
|
-
persist=True,
|
|
218
|
-
client=default
|
|
212
|
+
playlist, entity, persist=True, client=default
|
|
219
213
|
):
|
|
220
214
|
"""
|
|
221
215
|
Remove all occurences of a given entity from a playlist.
|
|
@@ -239,11 +233,7 @@ def remove_entity_from_playlist(
|
|
|
239
233
|
|
|
240
234
|
|
|
241
235
|
def update_entity_preview(
|
|
242
|
-
playlist,
|
|
243
|
-
entity,
|
|
244
|
-
preview_file,
|
|
245
|
-
persist=True,
|
|
246
|
-
client=default
|
|
236
|
+
playlist, entity, preview_file, persist=True, client=default
|
|
247
237
|
):
|
|
248
238
|
"""
|
|
249
239
|
Remove all occurences of a given entity from a playlist.
|
gazu/task.py
CHANGED
|
@@ -257,12 +257,7 @@ def all_tasks_for_task_status(project, task_type, task_status, client=default):
|
|
|
257
257
|
|
|
258
258
|
|
|
259
259
|
@cache
|
|
260
|
-
def all_tasks_for_task_type(
|
|
261
|
-
project,
|
|
262
|
-
task_type,
|
|
263
|
-
episode=None,
|
|
264
|
-
client=default
|
|
265
|
-
):
|
|
260
|
+
def all_tasks_for_task_type(project, task_type, episode=None, client=default):
|
|
266
261
|
"""
|
|
267
262
|
Args:
|
|
268
263
|
project (str / dict): The project dict or the project ID.
|
|
@@ -532,18 +527,6 @@ def get_task_status_by_name(name, client=default):
|
|
|
532
527
|
return raw.fetch_first("task-status", {"name": name}, client=client)
|
|
533
528
|
|
|
534
529
|
|
|
535
|
-
@cache
|
|
536
|
-
def get_default_task_status(client=default):
|
|
537
|
-
"""
|
|
538
|
-
Args:
|
|
539
|
-
name (str / dict): The name of claimed task status.
|
|
540
|
-
|
|
541
|
-
Returns:
|
|
542
|
-
dict: Task status matching given name.
|
|
543
|
-
"""
|
|
544
|
-
return raw.fetch_first("task-status", {"is_default": True}, client=client)
|
|
545
|
-
|
|
546
|
-
|
|
547
530
|
@cache
|
|
548
531
|
def get_task_status_by_short_name(task_status_short_name, client=default):
|
|
549
532
|
"""
|
|
@@ -661,7 +644,7 @@ def new_task(
|
|
|
661
644
|
entity = normalize_model_parameter(entity)
|
|
662
645
|
task_type = normalize_model_parameter(task_type)
|
|
663
646
|
if task_status is None:
|
|
664
|
-
task_status = get_default_task_status()
|
|
647
|
+
task_status = get_default_task_status(client=client)
|
|
665
648
|
|
|
666
649
|
data = {
|
|
667
650
|
"project_id": entity["project_id"],
|
|
@@ -1267,10 +1250,7 @@ def get_task_url(task, client=default):
|
|
|
1267
1250
|
|
|
1268
1251
|
|
|
1269
1252
|
def all_tasks_for_project(
|
|
1270
|
-
project,
|
|
1271
|
-
task_type=None,
|
|
1272
|
-
episode=None,
|
|
1273
|
-
client=default
|
|
1253
|
+
project, task_type=None, episode=None, client=default
|
|
1274
1254
|
):
|
|
1275
1255
|
"""
|
|
1276
1256
|
Args:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gazu
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.17
|
|
4
4
|
Summary: Gazu is a client for Zou, the API to store the data of your CG production.
|
|
5
5
|
Home-page: https://gazu.cg-wire.com/
|
|
6
6
|
Author: CG Wire
|
|
@@ -32,8 +32,8 @@ Provides-Extra: dev
|
|
|
32
32
|
Requires-Dist: wheel ; extra == 'dev'
|
|
33
33
|
Provides-Extra: lint
|
|
34
34
|
Requires-Dist: autoflake ==2.3.1 ; (python_version >= "3.8") and extra == 'lint'
|
|
35
|
-
Requires-Dist: black ==24.
|
|
36
|
-
Requires-Dist: pre-commit ==
|
|
35
|
+
Requires-Dist: black ==24.10.0 ; (python_version >= "3.9") and extra == 'lint'
|
|
36
|
+
Requires-Dist: pre-commit ==4.0.1 ; (python_version >= "3.9") and extra == 'lint'
|
|
37
37
|
Provides-Extra: test
|
|
38
38
|
Requires-Dist: pytest ; extra == 'test'
|
|
39
39
|
Requires-Dist: pytest-cov ; extra == 'test'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
gazu/__init__.py,sha256=gVhtpZsvDiPuqvsEbCrgm6fKw8hluUhqspmlgGNIAvQ,3020
|
|
2
|
-
gazu/__version__.py,sha256=
|
|
2
|
+
gazu/__version__.py,sha256=S5Wijq3rq4_r-gYF455YCj2KcVfNM-QJlkM_f8Ti4x0,24
|
|
3
3
|
gazu/asset.py,sha256=GWwam0yqHna_b9_5g5r0-O2zhMb7KlhfbIC17IOXKkY,14488
|
|
4
4
|
gazu/cache.py,sha256=MnxrnfYN7wHNTTL7qzkEpYCYzWcolT56fqQ0_RegMbE,5879
|
|
5
|
-
gazu/casting.py,sha256=
|
|
6
|
-
gazu/client.py,sha256=
|
|
5
|
+
gazu/casting.py,sha256=0LTdsHaCTHSKEflBWFeuraSaYNYetGkMHAIdg6Lv81U,5059
|
|
6
|
+
gazu/client.py,sha256=1Ak9gXp-3tTAHgXYzY_y5CVt1vQjocvtkOGgOrEe_PY,15527
|
|
7
7
|
gazu/concept.py,sha256=GcOPEmkbtZcSwlX8tnUj9Q5DTPBprSxtmXhlq7ioPwk,3727
|
|
8
8
|
gazu/context.py,sha256=iUyug8EUz3kkF-kmYlH5JuLp66TUqR3uhAq7CouVd_U,4349
|
|
9
9
|
gazu/edit.py,sha256=sPSsnzykGr1Htl6ceKulUSVHGhoQLGLeWDni3Pul7BE,4609
|
|
@@ -14,16 +14,16 @@ gazu/exception.py,sha256=Y0kVNm6h-uXLEU1sNIbMSUep7Zxk738uYHOIVs2waM8,1880
|
|
|
14
14
|
gazu/files.py,sha256=L82d5Bx3TkcaNczQ5t9s8DTKAcYXiqGaKUrag2cKjqI,39645
|
|
15
15
|
gazu/helpers.py,sha256=Qa4JlZitiXsfYMJGGuwVaedLvHQVMbIwcqEZ099EjMw,3916
|
|
16
16
|
gazu/person.py,sha256=BFh54J_R6_pIgYxAF_yAxFzjsO98hTLeBAKiZxewiK0,11098
|
|
17
|
-
gazu/playlist.py,sha256=
|
|
17
|
+
gazu/playlist.py,sha256=fzrhVY0fhxp5rSlvrowZPWEOqdl4rEYD4TKmnuvyKHg,6740
|
|
18
18
|
gazu/project.py,sha256=fssI_Bf5UqqRd9bfM68oyfkhjxwWvjdiAcYvvUhI5LY,12649
|
|
19
19
|
gazu/scene.py,sha256=bYsy7zKdQfDTfeqNAlgaqGMs2Hhxdy40NGt6TX_FBdA,5307
|
|
20
20
|
gazu/shot.py,sha256=mHg-8B7xk3PXMqbPo0oCx2X7br2sGCBmuM7hEhpXRas,18942
|
|
21
21
|
gazu/sorting.py,sha256=qSIO0pOHkj0Tl4gm9BJrYrcifWGGGmsW68Pl86zB_bg,266
|
|
22
22
|
gazu/sync.py,sha256=0ZJ5Z7Nuh5Kj4cswZCXLpXTLf8zQRcXsBLnurMw-i_E,21627
|
|
23
|
-
gazu/task.py,sha256=
|
|
23
|
+
gazu/task.py,sha256=rnOKunR-vXLQPkD5nOufPhppYLLkgAWZS9tYlutCMp0,36412
|
|
24
24
|
gazu/user.py,sha256=GyJf6mrynHvLllw3Hsiv-6wjaYTHO_PBNkJzyJjJA1A,9556
|
|
25
|
-
gazu-0.10.
|
|
26
|
-
gazu-0.10.
|
|
27
|
-
gazu-0.10.
|
|
28
|
-
gazu-0.10.
|
|
29
|
-
gazu-0.10.
|
|
25
|
+
gazu-0.10.17.dist-info/LICENSE,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
|
|
26
|
+
gazu-0.10.17.dist-info/METADATA,sha256=Gt-aWHEx66R7KrBHVndGK13GTa-xLnSV-WQsjFTvaKE,5264
|
|
27
|
+
gazu-0.10.17.dist-info/WHEEL,sha256=0VNUDWQJzfRahYI3neAhz2UVbRCtztpN5dPHAGvmGXc,109
|
|
28
|
+
gazu-0.10.17.dist-info/top_level.txt,sha256=nv7fRIVpYYyIlk_66hBmMyvWcSC7UU-r-GE8uC1u1Go,5
|
|
29
|
+
gazu-0.10.17.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|