gazu 0.10.21__tar.gz → 0.10.22__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.
Files changed (55) hide show
  1. {gazu-0.10.21 → gazu-0.10.22}/PKG-INFO +1 -1
  2. gazu-0.10.22/gazu/__version__.py +1 -0
  3. {gazu-0.10.21 → gazu-0.10.22}/gazu/client.py +19 -8
  4. {gazu-0.10.21 → gazu-0.10.22}/gazu/task.py +37 -0
  5. {gazu-0.10.21 → gazu-0.10.22}/gazu.egg-info/PKG-INFO +1 -1
  6. {gazu-0.10.21 → gazu-0.10.22}/tests/test_client.py +1 -1
  7. gazu-0.10.21/gazu/__version__.py +0 -1
  8. {gazu-0.10.21 → gazu-0.10.22}/LICENSE +0 -0
  9. {gazu-0.10.21 → gazu-0.10.22}/README.rst +0 -0
  10. {gazu-0.10.21 → gazu-0.10.22}/gazu/__init__.py +0 -0
  11. {gazu-0.10.21 → gazu-0.10.22}/gazu/asset.py +0 -0
  12. {gazu-0.10.21 → gazu-0.10.22}/gazu/cache.py +0 -0
  13. {gazu-0.10.21 → gazu-0.10.22}/gazu/casting.py +0 -0
  14. {gazu-0.10.21 → gazu-0.10.22}/gazu/concept.py +0 -0
  15. {gazu-0.10.21 → gazu-0.10.22}/gazu/context.py +0 -0
  16. {gazu-0.10.21 → gazu-0.10.22}/gazu/edit.py +0 -0
  17. {gazu-0.10.21 → gazu-0.10.22}/gazu/encoder.py +0 -0
  18. {gazu-0.10.21 → gazu-0.10.22}/gazu/entity.py +0 -0
  19. {gazu-0.10.21 → gazu-0.10.22}/gazu/events.py +0 -0
  20. {gazu-0.10.21 → gazu-0.10.22}/gazu/exception.py +0 -0
  21. {gazu-0.10.21 → gazu-0.10.22}/gazu/files.py +0 -0
  22. {gazu-0.10.21 → gazu-0.10.22}/gazu/helpers.py +0 -0
  23. {gazu-0.10.21 → gazu-0.10.22}/gazu/person.py +0 -0
  24. {gazu-0.10.21 → gazu-0.10.22}/gazu/playlist.py +0 -0
  25. {gazu-0.10.21 → gazu-0.10.22}/gazu/project.py +0 -0
  26. {gazu-0.10.21 → gazu-0.10.22}/gazu/scene.py +0 -0
  27. {gazu-0.10.21 → gazu-0.10.22}/gazu/shot.py +0 -0
  28. {gazu-0.10.21 → gazu-0.10.22}/gazu/sorting.py +0 -0
  29. {gazu-0.10.21 → gazu-0.10.22}/gazu/sync.py +0 -0
  30. {gazu-0.10.21 → gazu-0.10.22}/gazu/user.py +0 -0
  31. {gazu-0.10.21 → gazu-0.10.22}/gazu.egg-info/SOURCES.txt +0 -0
  32. {gazu-0.10.21 → gazu-0.10.22}/gazu.egg-info/dependency_links.txt +0 -0
  33. {gazu-0.10.21 → gazu-0.10.22}/gazu.egg-info/not-zip-safe +0 -0
  34. {gazu-0.10.21 → gazu-0.10.22}/gazu.egg-info/requires.txt +0 -0
  35. {gazu-0.10.21 → gazu-0.10.22}/gazu.egg-info/top_level.txt +0 -0
  36. {gazu-0.10.21 → gazu-0.10.22}/pyproject.toml +0 -0
  37. {gazu-0.10.21 → gazu-0.10.22}/setup.cfg +0 -0
  38. {gazu-0.10.21 → gazu-0.10.22}/setup.py +0 -0
  39. {gazu-0.10.21 → gazu-0.10.22}/tests/test_asset.py +0 -0
  40. {gazu-0.10.21 → gazu-0.10.22}/tests/test_cache.py +0 -0
  41. {gazu-0.10.21 → gazu-0.10.22}/tests/test_casting.py +0 -0
  42. {gazu-0.10.21 → gazu-0.10.22}/tests/test_concept.py +0 -0
  43. {gazu-0.10.21 → gazu-0.10.22}/tests/test_context.py +0 -0
  44. {gazu-0.10.21 → gazu-0.10.22}/tests/test_edit.py +0 -0
  45. {gazu-0.10.21 → gazu-0.10.22}/tests/test_entity.py +0 -0
  46. {gazu-0.10.21 → gazu-0.10.22}/tests/test_files.py +0 -0
  47. {gazu-0.10.21 → gazu-0.10.22}/tests/test_helpers.py +0 -0
  48. {gazu-0.10.21 → gazu-0.10.22}/tests/test_person.py +0 -0
  49. {gazu-0.10.21 → gazu-0.10.22}/tests/test_playlist.py +0 -0
  50. {gazu-0.10.21 → gazu-0.10.22}/tests/test_project.py +0 -0
  51. {gazu-0.10.21 → gazu-0.10.22}/tests/test_scene.py +0 -0
  52. {gazu-0.10.21 → gazu-0.10.22}/tests/test_shot.py +0 -0
  53. {gazu-0.10.21 → gazu-0.10.22}/tests/test_sync.py +0 -0
  54. {gazu-0.10.21 → gazu-0.10.22}/tests/test_task.py +0 -0
  55. {gazu-0.10.21 → gazu-0.10.22}/tests/test_user.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gazu
3
- Version: 0.10.21
3
+ Version: 0.10.22
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
@@ -0,0 +1 @@
1
+ __version__ = "0.10.22"
@@ -467,10 +467,11 @@ def get_message_from_response(
467
467
  message = default_message
468
468
  message_json = response.json()
469
469
 
470
- for key in ["error", "message"]:
471
- if message_json.get(key):
472
- message = message_json[key]
473
- break
470
+ if hasattr(message_json, "get"):
471
+ for key in ["error", "message"]:
472
+ if message_json.get(key):
473
+ message = message_json[key]
474
+ break
474
475
 
475
476
  return message
476
477
 
@@ -663,7 +664,14 @@ def update(model_name, model_id, data, client=default_client):
663
664
  )
664
665
 
665
666
 
666
- def upload(path, file_path, data={}, extra_files=[], client=default_client):
667
+ def upload(
668
+ path,
669
+ file_path=None,
670
+ data={},
671
+ extra_files=[],
672
+ files=None,
673
+ client=default_client,
674
+ ):
667
675
  """
668
676
  Upload file located at *file_path* to given url *path*.
669
677
 
@@ -672,13 +680,15 @@ def upload(path, file_path, data={}, extra_files=[], client=default_client):
672
680
  file_path (str): The file location on the hard drive.
673
681
  data (dict): The data to send with the file.
674
682
  extra_files (list): List of extra files to upload.
683
+ files (dict): The dictionary of files to upload.
675
684
  client (KitsuClient): The client to use for the request.
676
685
 
677
686
  Returns:
678
687
  Response: Request response object.
679
688
  """
680
689
  url = get_full_url(path, client)
681
- files = _build_file_dict(file_path, extra_files)
690
+ if not files:
691
+ files = _build_file_dict(file_path, extra_files)
682
692
  retry = True
683
693
  while retry:
684
694
  response = client.session.post(
@@ -714,10 +724,11 @@ def _build_file_dict(file_path, extra_files):
714
724
  """
715
725
 
716
726
  files = {"file": open(file_path, "rb")}
717
- i = 2
727
+ i = 0
718
728
  for file_path in extra_files:
719
- files["file-%s" % i] = open(file_path, "rb")
720
729
  i += 1
730
+ files["file-%s" % i] = open(file_path, "rb")
731
+
721
732
  return files
722
733
 
723
734
 
@@ -839,6 +839,7 @@ def add_comment(
839
839
  "task_status_id": task_status["id"],
840
840
  "comment": comment,
841
841
  "checklist": checklist,
842
+ "links": links,
842
843
  }
843
844
 
844
845
  if person is not None:
@@ -1014,6 +1015,7 @@ def publish_preview(
1014
1015
  normalize_movie=True,
1015
1016
  revision=None,
1016
1017
  set_thumbnail=False,
1018
+ links=[],
1017
1019
  client=default,
1018
1020
  ):
1019
1021
  """
@@ -1035,6 +1037,7 @@ def publish_preview(
1035
1037
  server side.
1036
1038
  revision (int): Revision number.
1037
1039
  set_thumbnail (bool): Set the preview as thumbnail of the entity.
1040
+ links (list): List of links to add to the comment
1038
1041
  Returns:
1039
1042
  tuple(dict, dict): Created comment model and created preview file
1040
1043
  model.
@@ -1047,6 +1050,7 @@ def publish_preview(
1047
1050
  checklist=checklist,
1048
1051
  attachments=attachments,
1049
1052
  created_at=created_at,
1053
+ links=links,
1050
1054
  client=client,
1051
1055
  )
1052
1056
  preview_file = add_preview(
@@ -1063,6 +1067,39 @@ def publish_preview(
1063
1067
  return new_comment, preview_file
1064
1068
 
1065
1069
 
1070
+ def publish_comments_previews(task, comments=[], client=default):
1071
+ """
1072
+ Publish a list of comments (with attachments and previews) for given task.
1073
+ Each dict comments may contain a list of attachment files path and preview
1074
+ files path in the keys "attachment_files" and "preview_files".
1075
+
1076
+ Args:
1077
+ task (str / dict): The task dict or the task ID.
1078
+ comments (list): List of comments to publish.
1079
+
1080
+ Returns:
1081
+ list: List of created comments.
1082
+ """
1083
+ task = normalize_model_parameter(task)
1084
+
1085
+ files = {}
1086
+ for x, comment in enumerate(comments):
1087
+ if comment.get("attachment_files"):
1088
+ for y, file_path in enumerate(comment["attachment_files"]):
1089
+ files["attachment_file-%i-%i" % (x, y)] = open(file_path, "rb")
1090
+ if comment.get("preview_files"):
1091
+ for y, file_path in enumerate(comment["preview_files"]):
1092
+ files["preview_file-%i-%i" % (x, y)] = open(file_path, "rb")
1093
+
1094
+ files["comments"] = (None, json.dumps(comments), "application/json")
1095
+ return raw.upload(
1096
+ "actions/tasks/%s/add-comments-previews" % task["id"],
1097
+ file_path=None,
1098
+ files=files,
1099
+ client=client,
1100
+ )
1101
+
1102
+
1066
1103
  def set_main_preview(preview_file, frame_number=None, client=default):
1067
1104
  """
1068
1105
  Set given preview as thumbnail of given entity.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gazu
3
- Version: 0.10.21
3
+ Version: 0.10.22
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
@@ -331,7 +331,7 @@ class BaseFuncTestCase(ClientTestCase):
331
331
  mock,
332
332
  {
333
333
  "file": test_file_read,
334
- "file-2": test_file_read,
334
+ "file-1": test_file_read,
335
335
  "test": "True",
336
336
  },
337
337
  )
@@ -1 +0,0 @@
1
- __version__ = "0.10.21"
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
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
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
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
File without changes
File without changes
File without changes
File without changes