gazu 0.10.13__py2.py3-none-any.whl → 0.10.14__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.13"
1
+ __version__ = "0.10.14"
gazu/exception.py CHANGED
@@ -3,64 +3,48 @@ class HostException(Exception):
3
3
  Error raised when host is not valid.
4
4
  """
5
5
 
6
- pass
7
-
8
6
 
9
7
  class AuthFailedException(Exception):
10
8
  """
11
9
  Error raised when user credentials are wrong.
12
10
  """
13
11
 
14
- pass
15
-
16
12
 
17
13
  class NotAuthenticatedException(Exception):
18
14
  """
19
15
  Error raised when a 401 error (not authenticated) is sent by the API.
20
16
  """
21
17
 
22
- pass
23
-
24
18
 
25
19
  class NotAllowedException(Exception):
26
20
  """
27
21
  Error raised when a 403 error (not authorized) is sent by the API.
28
22
  """
29
23
 
30
- pass
31
-
32
24
 
33
25
  class MethodNotAllowedException(Exception):
34
26
  """
35
27
  Error raised when a 405 error (method not handled) is sent by the API.
36
28
  """
37
29
 
38
- pass
39
-
40
30
 
41
31
  class RouteNotFoundException(Exception):
42
32
  """
43
33
  Error raised when a 404 error (not found) is sent by the API.
44
34
  """
45
35
 
46
- pass
47
-
48
36
 
49
37
  class ServerErrorException(Exception):
50
38
  """
51
39
  Error raised when a 500 error (server error) is sent by the API.
52
40
  """
53
41
 
54
- pass
55
-
56
42
 
57
43
  class ParameterException(Exception):
58
44
  """
59
45
  Error raised when a 400 error (argument error) is sent by the API.
60
46
  """
61
47
 
62
- pass
63
-
64
48
 
65
49
  class UploadFailedException(Exception):
66
50
  """
@@ -68,24 +52,18 @@ class UploadFailedException(Exception):
68
52
  where processing that occurs on the remote server fails.
69
53
  """
70
54
 
71
- pass
72
-
73
55
 
74
56
  class TooBigFileException(Exception):
75
57
  """
76
58
  Error raised when a 413 error (payload too big error) is sent by the API.
77
59
  """
78
60
 
79
- pass
80
-
81
61
 
82
62
  class TaskStatusNotFoundException(Exception):
83
63
  """
84
64
  Error raised when a task status is not found.
85
65
  """
86
66
 
87
- pass
88
-
89
67
 
90
68
  class DownloadFileException(Exception):
91
69
  """
gazu/person.py CHANGED
@@ -78,6 +78,34 @@ def get_all_month_time_spents(id, date, client=default):
78
78
  )
79
79
 
80
80
 
81
+ @cache
82
+ def get_department_by_name(name, client=default):
83
+ """
84
+ Args:
85
+ name (str): Department name.
86
+
87
+ Returns:
88
+ dict: Department corresponding to given name.
89
+ """
90
+ return raw.fetch_first(
91
+ "departments",
92
+ {"name": name},
93
+ client=client,
94
+ )
95
+
96
+
97
+ @cache
98
+ def get_department(department_id, client=default):
99
+ """
100
+ Args:
101
+ department_id (str): An uuid identifying a department.
102
+
103
+ Returns:
104
+ dict: Department corresponding to given department_id.
105
+ """
106
+ return raw.fetch_one("departments", department_id, client=client)
107
+
108
+
81
109
  @cache
82
110
  def get_person(id, relations=False, client=default):
83
111
  """
@@ -182,6 +210,27 @@ def get_organisation(client=default):
182
210
  return raw.get("auth/authenticated", client=client)["organisation"]
183
211
 
184
212
 
213
+ def new_department(name, color="", archived=False, client=default):
214
+ """
215
+ Create a new departement based on given parameters.
216
+
217
+ Args:
218
+ name (str): the name of the departement.
219
+ color (str): the color of the departement.
220
+ archived (bool): Whether the departement is archived or not.
221
+ Returns:
222
+ dict: Created departement.
223
+ """
224
+ department = get_department_by_name(name, client=client)
225
+ if department is None:
226
+ department = raw.post(
227
+ "data/departments",
228
+ {"name": name, "color": color, "archived": archived},
229
+ client=client,
230
+ )
231
+ return department
232
+
233
+
185
234
  def new_person(
186
235
  first_name,
187
236
  last_name,
gazu/shot.py CHANGED
@@ -404,7 +404,9 @@ def update_shot_data(shot, data={}, client=default):
404
404
  """
405
405
  shot = normalize_model_parameter(shot)
406
406
  current_shot = get_shot(shot["id"], client=client)
407
- current_data = current_shot["data"] if current_shot["data"] is not None else {}
407
+ current_data = (
408
+ current_shot["data"] if current_shot["data"] is not None else {}
409
+ )
408
410
  updated_shot = {"id": current_shot["id"], "data": current_data}
409
411
  updated_shot["data"].update(data)
410
412
  return update_shot(updated_shot, client=client)
gazu/task.py CHANGED
@@ -1174,8 +1174,11 @@ def new_task_type(name, color="#000000", for_entity="Asset", client=default):
1174
1174
  Returns:
1175
1175
  dict: The created task type
1176
1176
  """
1177
- data = {"name": name, "color": color, "for_entity": for_entity}
1178
- return raw.post("data/task-types", data, client=client)
1177
+ task_type = get_task_type_by_name(name, for_entity)
1178
+ if task_type is None:
1179
+ data = {"name": name, "color": color, "for_entity": for_entity}
1180
+ task_type = raw.post("data/task-types", data, client=client)
1181
+ return task_type
1179
1182
 
1180
1183
 
1181
1184
  def new_task_status(name, short_name, color, client=default):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gazu
3
- Version: 0.10.13
3
+ Version: 0.10.14
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
@@ -31,7 +31,8 @@ Requires-Dist: python-socketio[client] <6,>=5.11.0 ; python_version != "2.7"
31
31
  Provides-Extra: dev
32
32
  Requires-Dist: wheel ; extra == 'dev'
33
33
  Provides-Extra: lint
34
- Requires-Dist: black ==24.4.2 ; (python_version >= "3.8") and extra == 'lint'
34
+ Requires-Dist: autoflake ==2.3.1 ; (python_version >= "3.8") and extra == 'lint'
35
+ Requires-Dist: black ==24.8.0 ; (python_version >= "3.8") and extra == 'lint'
35
36
  Requires-Dist: pre-commit ==3.8.0 ; (python_version >= "3.9") and extra == 'lint'
36
37
  Provides-Extra: test
37
38
  Requires-Dist: pytest ; extra == 'test'
@@ -1,5 +1,5 @@
1
1
  gazu/__init__.py,sha256=gVhtpZsvDiPuqvsEbCrgm6fKw8hluUhqspmlgGNIAvQ,3020
2
- gazu/__version__.py,sha256=y79JESzBvOjH_pWmT5Lt7k2s_slwZkMdVXCrdwe-NFY,24
2
+ gazu/__version__.py,sha256=pxrMEZK-Yqtv_P8vFxygBdkn1agAyjjzQFKamP7hRcg,24
3
3
  gazu/asset.py,sha256=GWwam0yqHna_b9_5g5r0-O2zhMb7KlhfbIC17IOXKkY,14488
4
4
  gazu/cache.py,sha256=MnxrnfYN7wHNTTL7qzkEpYCYzWcolT56fqQ0_RegMbE,5879
5
5
  gazu/casting.py,sha256=5xmGMoU3MFgv1br8_5xyTx-Z7wo9r51wRisiblqcr94,3945
@@ -10,20 +10,20 @@ gazu/edit.py,sha256=sPSsnzykGr1Htl6ceKulUSVHGhoQLGLeWDni3Pul7BE,4609
10
10
  gazu/encoder.py,sha256=dj8U5mlGVy0GeaA7HIIdPSRdKswUQ8h4DzjFKLhwvR0,394
11
11
  gazu/entity.py,sha256=Pbc_sbgo8RhQV88nksP1whHyWL4hVyHR3CZ0sVplPY4,3670
12
12
  gazu/events.py,sha256=GRjWsw-jeZrcBq6U8EcxiGJ8HNTdPUuamhJa0uRHeeg,1715
13
- gazu/exception.py,sha256=4lwaVWT7wyyXoy_HSPQagLRmX78FHKDvA_UrOI--vTQ,1743
13
+ gazu/exception.py,sha256=hWa4UQe5V36td4_jYwQSMNCJM9aDHR3P7N90Nq4fPOM,1633
14
14
  gazu/files.py,sha256=L82d5Bx3TkcaNczQ5t9s8DTKAcYXiqGaKUrag2cKjqI,39645
15
15
  gazu/helpers.py,sha256=Qa4JlZitiXsfYMJGGuwVaedLvHQVMbIwcqEZ099EjMw,3916
16
- gazu/person.py,sha256=9w85iUDzXne0JFsmpmXLVuUrgvDceCza14HBGrpJx84,9862
16
+ gazu/person.py,sha256=BFh54J_R6_pIgYxAF_yAxFzjsO98hTLeBAKiZxewiK0,11098
17
17
  gazu/playlist.py,sha256=n7LwOF5ZvHDzP_fng-soYUESfb-S2ATmZJHGBh8cRLo,3739
18
18
  gazu/project.py,sha256=fssI_Bf5UqqRd9bfM68oyfkhjxwWvjdiAcYvvUhI5LY,12649
19
19
  gazu/scene.py,sha256=bYsy7zKdQfDTfeqNAlgaqGMs2Hhxdy40NGt6TX_FBdA,5307
20
- gazu/shot.py,sha256=wFTvSmofrZOBS3O5IGR6wzpS5OLTTnpXofL5IT_j-fo,18926
20
+ gazu/shot.py,sha256=mHg-8B7xk3PXMqbPo0oCx2X7br2sGCBmuM7hEhpXRas,18942
21
21
  gazu/sorting.py,sha256=qSIO0pOHkj0Tl4gm9BJrYrcifWGGGmsW68Pl86zB_bg,266
22
22
  gazu/sync.py,sha256=OMsbQDROTdEwlukazUXPGnlC29QcaaHvsmqv3WsSexo,21582
23
- gazu/task.py,sha256=7A3A_Zms4WlFl72Jqi2u8dWcoVY3d81leFWAE8wOdQQ,35883
23
+ gazu/task.py,sha256=623td4cjNAqXQgQrD9opvxt2P8okv6rHNx-NYsGjVKg,35999
24
24
  gazu/user.py,sha256=GyJf6mrynHvLllw3Hsiv-6wjaYTHO_PBNkJzyJjJA1A,9556
25
- gazu-0.10.13.dist-info/LICENSE,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
26
- gazu-0.10.13.dist-info/METADATA,sha256=UKJevIpMML_auKqcK0wevYoZMi9mPHTkjTNwDZjmRi0,5182
27
- gazu-0.10.13.dist-info/WHEEL,sha256=XRxW4r1PNiVhMpP4bT9oWtu3HyndxpJ84SkubFgzp_Y,109
28
- gazu-0.10.13.dist-info/top_level.txt,sha256=nv7fRIVpYYyIlk_66hBmMyvWcSC7UU-r-GE8uC1u1Go,5
29
- gazu-0.10.13.dist-info/RECORD,,
25
+ gazu-0.10.14.dist-info/LICENSE,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
26
+ gazu-0.10.14.dist-info/METADATA,sha256=LRU9C0EJ10NXRe3C2VE3nsnaga6k9jn3NDS-z9xpZgs,5263
27
+ gazu-0.10.14.dist-info/WHEEL,sha256=XRxW4r1PNiVhMpP4bT9oWtu3HyndxpJ84SkubFgzp_Y,109
28
+ gazu-0.10.14.dist-info/top_level.txt,sha256=nv7fRIVpYYyIlk_66hBmMyvWcSC7UU-r-GE8uC1u1Go,5
29
+ gazu-0.10.14.dist-info/RECORD,,
File without changes