gazu 0.10.21__py2.py3-none-any.whl → 0.10.24__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "0.10.21"
1
+ __version__ = "0.10.24"
gazu/asset.py CHANGED
@@ -169,6 +169,7 @@ def new_asset(
169
169
  description=None,
170
170
  extra_data={},
171
171
  episode=None,
172
+ is_shared=False,
172
173
  client=default,
173
174
  ):
174
175
  """
@@ -181,6 +182,7 @@ def new_asset(
181
182
  description (str): Additional information.
182
183
  extra_data (dict): Free field to add any kind of metadata.
183
184
  episode (str / dict): The episode this asset is linked to.
185
+ is_shared (bool): True if asset is shared between multiple projects.
184
186
 
185
187
  Returns:
186
188
  dict: Created asset.
@@ -189,7 +191,7 @@ def new_asset(
189
191
  asset_type = normalize_model_parameter(asset_type)
190
192
  episode = normalize_model_parameter(episode)
191
193
 
192
- data = {"name": name, "data": extra_data}
194
+ data = {"name": name, "data": extra_data, "is_shared": is_shared}
193
195
 
194
196
  if description is not None:
195
197
  data["description"] = description
gazu/client.py CHANGED
@@ -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
 
gazu/files.py CHANGED
@@ -147,7 +147,7 @@ def get_preview_file(preview_file_id, client=default):
147
147
  return raw.fetch_one("preview-files", preview_file_id, client=client)
148
148
 
149
149
 
150
- def remove_preview_file(preview_file, client=default):
150
+ def remove_preview_file(preview_file, force=False, client=default):
151
151
  """
152
152
  Remove given preview file from database.
153
153
 
@@ -155,8 +155,12 @@ def remove_preview_file(preview_file, client=default):
155
155
  preview_file (str / dict): The preview_file dict or ID.
156
156
  """
157
157
  preview_file = normalize_model_parameter(preview_file)
158
+ params = {}
159
+ if force:
160
+ params = {"force": True}
158
161
  return raw.delete(
159
162
  "data/preview-files/%s" % preview_file["id"],
163
+ params=params,
160
164
  client=client,
161
165
  )
162
166
 
gazu/task.py CHANGED
@@ -675,13 +675,15 @@ def remove_task(task, client=default):
675
675
  raw.delete("data/tasks/%s" % task["id"], {"force": True}, client=client)
676
676
 
677
677
 
678
- def start_task(task, started_task_status=None, client=default):
678
+ def start_task(task, started_task_status=None, person=None, client=default):
679
679
  """
680
680
  Create a comment to change task status to started_task_status
681
681
  (by default WIP) and set its real start date to now.
682
682
 
683
683
  Args:
684
684
  task (str / dict): The task dict or the task ID.
685
+ started_task_status (str / dict): The task status dict or ID.
686
+ person (str / dict): The person dict or the person ID.
685
687
 
686
688
  Returns:
687
689
  dict: Created comment.
@@ -700,7 +702,7 @@ def start_task(task, started_task_status=None, client=default):
700
702
  )
701
703
  )
702
704
 
703
- return add_comment(task, started_task_status, client=client)
705
+ return add_comment(task, started_task_status, person=person, client=client)
704
706
 
705
707
 
706
708
  def task_to_review(
@@ -839,6 +841,7 @@ def add_comment(
839
841
  "task_status_id": task_status["id"],
840
842
  "comment": comment,
841
843
  "checklist": checklist,
844
+ "links": links,
842
845
  }
843
846
 
844
847
  if person is not None:
@@ -1014,6 +1017,7 @@ def publish_preview(
1014
1017
  normalize_movie=True,
1015
1018
  revision=None,
1016
1019
  set_thumbnail=False,
1020
+ links=[],
1017
1021
  client=default,
1018
1022
  ):
1019
1023
  """
@@ -1035,6 +1039,7 @@ def publish_preview(
1035
1039
  server side.
1036
1040
  revision (int): Revision number.
1037
1041
  set_thumbnail (bool): Set the preview as thumbnail of the entity.
1042
+ links (list): List of links to add to the comment
1038
1043
  Returns:
1039
1044
  tuple(dict, dict): Created comment model and created preview file
1040
1045
  model.
@@ -1047,6 +1052,7 @@ def publish_preview(
1047
1052
  checklist=checklist,
1048
1053
  attachments=attachments,
1049
1054
  created_at=created_at,
1055
+ links=links,
1050
1056
  client=client,
1051
1057
  )
1052
1058
  preview_file = add_preview(
@@ -1063,6 +1069,41 @@ def publish_preview(
1063
1069
  return new_comment, preview_file
1064
1070
 
1065
1071
 
1072
+ def batch_comments(comments=[], task=None, client=default):
1073
+ """
1074
+ Publish a list of comments (with attachments and previews) for given task.
1075
+ Each dict comments may contain a list of attachment files path and preview
1076
+ files path in the keys "attachment_files" and "preview_files". If no task is
1077
+ given each comments needs to have a task_id key.
1078
+
1079
+ Args:
1080
+ comments (list): List of comments to publish.
1081
+ task (str / dict): The task dict or the task ID.
1082
+
1083
+ Returns:
1084
+ list: List of created comments.
1085
+ """
1086
+ if task is not None:
1087
+ task = normalize_model_parameter(task)
1088
+
1089
+ files = {}
1090
+ for x, comment in enumerate(comments):
1091
+ if comment.get("attachment_files"):
1092
+ for y, file_path in enumerate(comment["attachment_files"]):
1093
+ files["attachment_file-%i-%i" % (x, y)] = open(file_path, "rb")
1094
+ if comment.get("preview_files"):
1095
+ for y, file_path in enumerate(comment["preview_files"]):
1096
+ files["preview_file-%i-%i" % (x, y)] = open(file_path, "rb")
1097
+
1098
+ files["comments"] = (None, json.dumps(comments), "application/json")
1099
+ return raw.upload(
1100
+ "actions/tasks/%sbatch-comment" % ("%s/" % task["id"] if task else ""),
1101
+ file_path=None,
1102
+ files=files,
1103
+ client=client,
1104
+ )
1105
+
1106
+
1066
1107
  def set_main_preview(preview_file, frame_number=None, client=default):
1067
1108
  """
1068
1109
  Set given preview as thumbnail of given entity.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: gazu
3
- Version: 0.10.21
3
+ Version: 0.10.24
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
@@ -41,6 +41,7 @@ Provides-Extra: lint
41
41
  Requires-Dist: autoflake==2.3.1; python_version >= "3.8" and extra == "lint"
42
42
  Requires-Dist: black==24.10.0; python_version >= "3.9" and extra == "lint"
43
43
  Requires-Dist: pre-commit==4.0.1; python_version >= "3.9" and extra == "lint"
44
+ Dynamic: requires-python
44
45
 
45
46
  .. figure:: https://zou.cg-wire.com/kitsu.png
46
47
  :alt: Kitsu Logo
@@ -1,9 +1,9 @@
1
1
  gazu/__init__.py,sha256=KPAVnFOSbzZnd24ItkZEOv7yQ5w0Pv7k1TFmL8saiqY,2594
2
- gazu/__version__.py,sha256=W69o5JUR26BK90cqamed5YGEcQII_Xm_6Nbg6iJ5L9o,24
3
- gazu/asset.py,sha256=2D7_2fFElfkS6DrHVh0FI-1H73-vhX7VuYCjRgQPVJ0,14564
2
+ gazu/__version__.py,sha256=M7vSf7B_3j-dfm2d_e8odhD9vChzxTqI_8h4_vaudOs,24
3
+ gazu/asset.py,sha256=ZAc8F-7GPQTU_nVcUpH_xSVf58k6TXudlP6XnFc_LJk,14686
4
4
  gazu/cache.py,sha256=MnxrnfYN7wHNTTL7qzkEpYCYzWcolT56fqQ0_RegMbE,5879
5
5
  gazu/casting.py,sha256=0LTdsHaCTHSKEflBWFeuraSaYNYetGkMHAIdg6Lv81U,5059
6
- gazu/client.py,sha256=6mK1NTV9I9cEedCp4SiHoJU3OjmFKkHssvqnyvrL6TY,21985
6
+ gazu/client.py,sha256=TNxUOy_kVKnMSLxQFC-fFPqPPE8BaIvL37ExeW2TI5k,22162
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
@@ -11,7 +11,7 @@ gazu/encoder.py,sha256=dj8U5mlGVy0GeaA7HIIdPSRdKswUQ8h4DzjFKLhwvR0,394
11
11
  gazu/entity.py,sha256=Pbc_sbgo8RhQV88nksP1whHyWL4hVyHR3CZ0sVplPY4,3670
12
12
  gazu/events.py,sha256=4j8wbF4K-f5Kyu_jI4bklS12huzAN0cjCdY4hcKyhuk,2221
13
13
  gazu/exception.py,sha256=Y0kVNm6h-uXLEU1sNIbMSUep7Zxk738uYHOIVs2waM8,1880
14
- gazu/files.py,sha256=L82d5Bx3TkcaNczQ5t9s8DTKAcYXiqGaKUrag2cKjqI,39645
14
+ gazu/files.py,sha256=3zx6GWRRI9RPc6cN7sUIsj4g-ARfeypUUVUIvxqqNj8,39744
15
15
  gazu/helpers.py,sha256=Qa4JlZitiXsfYMJGGuwVaedLvHQVMbIwcqEZ099EjMw,3916
16
16
  gazu/person.py,sha256=BFh54J_R6_pIgYxAF_yAxFzjsO98hTLeBAKiZxewiK0,11098
17
17
  gazu/playlist.py,sha256=fzrhVY0fhxp5rSlvrowZPWEOqdl4rEYD4TKmnuvyKHg,6740
@@ -20,10 +20,10 @@ gazu/scene.py,sha256=Q4AVmiMfGhSZfaXwOceyR-taTlpx1WCELe0UBSiHm8o,5357
20
20
  gazu/shot.py,sha256=mHg-8B7xk3PXMqbPo0oCx2X7br2sGCBmuM7hEhpXRas,18942
21
21
  gazu/sorting.py,sha256=qSIO0pOHkj0Tl4gm9BJrYrcifWGGGmsW68Pl86zB_bg,266
22
22
  gazu/sync.py,sha256=3clThVFC9pSIQiCyVkNRPnlbYQDA2kfR-lxaWxHbeUk,21611
23
- gazu/task.py,sha256=rnOKunR-vXLQPkD5nOufPhppYLLkgAWZS9tYlutCMp0,36412
23
+ gazu/task.py,sha256=_b30VF0ZooB-WTNoCYslJWzT0NI0RF8MZ31h8B4A218,38001
24
24
  gazu/user.py,sha256=GyJf6mrynHvLllw3Hsiv-6wjaYTHO_PBNkJzyJjJA1A,9556
25
- gazu-0.10.21.dist-info/LICENSE,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
26
- gazu-0.10.21.dist-info/METADATA,sha256=CbvK4jP5Wy6MvRx_UERfYSVihpw0ai6iU-OJQxJgIqM,5447
27
- gazu-0.10.21.dist-info/WHEEL,sha256=pxeNX5JdtCe58PUSYP9upmc7jdRPgvT0Gm9kb1SHlVw,109
28
- gazu-0.10.21.dist-info/top_level.txt,sha256=nv7fRIVpYYyIlk_66hBmMyvWcSC7UU-r-GE8uC1u1Go,5
29
- gazu-0.10.21.dist-info/RECORD,,
25
+ gazu-0.10.24.dist-info/LICENSE,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
26
+ gazu-0.10.24.dist-info/METADATA,sha256=bGlUtyA9O4HZBZ4xqO5IzJkNDxB2BrkRV6-X4thk4xM,5472
27
+ gazu-0.10.24.dist-info/WHEEL,sha256=9Hm2OB-j1QcCUq9Jguht7ayGIIZBRTdOXD1qg9cCgPM,109
28
+ gazu-0.10.24.dist-info/top_level.txt,sha256=nv7fRIVpYYyIlk_66hBmMyvWcSC7UU-r-GE8uC1u1Go,5
29
+ gazu-0.10.24.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any