gazu 0.10.12__tar.gz → 0.10.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.
Files changed (55) hide show
  1. {gazu-0.10.12 → gazu-0.10.14}/PKG-INFO +4 -3
  2. gazu-0.10.14/gazu/__version__.py +1 -0
  3. {gazu-0.10.12 → gazu-0.10.14}/gazu/exception.py +0 -22
  4. {gazu-0.10.12 → gazu-0.10.14}/gazu/person.py +49 -0
  5. {gazu-0.10.12 → gazu-0.10.14}/gazu/shot.py +4 -1
  6. {gazu-0.10.12 → gazu-0.10.14}/gazu/task.py +5 -2
  7. {gazu-0.10.12 → gazu-0.10.14}/gazu.egg-info/PKG-INFO +4 -3
  8. {gazu-0.10.12 → gazu-0.10.14}/gazu.egg-info/requires.txt +3 -2
  9. {gazu-0.10.12 → gazu-0.10.14}/setup.cfg +3 -2
  10. {gazu-0.10.12 → gazu-0.10.14}/tests/test_client.py +1 -2
  11. {gazu-0.10.12 → gazu-0.10.14}/tests/test_context.py +1 -1
  12. {gazu-0.10.12 → gazu-0.10.14}/tests/test_edit.py +0 -2
  13. {gazu-0.10.12 → gazu-0.10.14}/tests/test_person.py +33 -0
  14. {gazu-0.10.12 → gazu-0.10.14}/tests/test_project.py +0 -1
  15. {gazu-0.10.12 → gazu-0.10.14}/tests/test_task.py +3 -7
  16. gazu-0.10.12/gazu/__version__.py +0 -1
  17. {gazu-0.10.12 → gazu-0.10.14}/LICENSE +0 -0
  18. {gazu-0.10.12 → gazu-0.10.14}/README.rst +0 -0
  19. {gazu-0.10.12 → gazu-0.10.14}/gazu/__init__.py +0 -0
  20. {gazu-0.10.12 → gazu-0.10.14}/gazu/asset.py +0 -0
  21. {gazu-0.10.12 → gazu-0.10.14}/gazu/cache.py +0 -0
  22. {gazu-0.10.12 → gazu-0.10.14}/gazu/casting.py +0 -0
  23. {gazu-0.10.12 → gazu-0.10.14}/gazu/client.py +0 -0
  24. {gazu-0.10.12 → gazu-0.10.14}/gazu/concept.py +0 -0
  25. {gazu-0.10.12 → gazu-0.10.14}/gazu/context.py +0 -0
  26. {gazu-0.10.12 → gazu-0.10.14}/gazu/edit.py +0 -0
  27. {gazu-0.10.12 → gazu-0.10.14}/gazu/encoder.py +0 -0
  28. {gazu-0.10.12 → gazu-0.10.14}/gazu/entity.py +0 -0
  29. {gazu-0.10.12 → gazu-0.10.14}/gazu/events.py +0 -0
  30. {gazu-0.10.12 → gazu-0.10.14}/gazu/files.py +0 -0
  31. {gazu-0.10.12 → gazu-0.10.14}/gazu/helpers.py +0 -0
  32. {gazu-0.10.12 → gazu-0.10.14}/gazu/playlist.py +0 -0
  33. {gazu-0.10.12 → gazu-0.10.14}/gazu/project.py +0 -0
  34. {gazu-0.10.12 → gazu-0.10.14}/gazu/scene.py +0 -0
  35. {gazu-0.10.12 → gazu-0.10.14}/gazu/sorting.py +0 -0
  36. {gazu-0.10.12 → gazu-0.10.14}/gazu/sync.py +0 -0
  37. {gazu-0.10.12 → gazu-0.10.14}/gazu/user.py +0 -0
  38. {gazu-0.10.12 → gazu-0.10.14}/gazu.egg-info/SOURCES.txt +0 -0
  39. {gazu-0.10.12 → gazu-0.10.14}/gazu.egg-info/dependency_links.txt +0 -0
  40. {gazu-0.10.12 → gazu-0.10.14}/gazu.egg-info/not-zip-safe +0 -0
  41. {gazu-0.10.12 → gazu-0.10.14}/gazu.egg-info/top_level.txt +0 -0
  42. {gazu-0.10.12 → gazu-0.10.14}/pyproject.toml +0 -0
  43. {gazu-0.10.12 → gazu-0.10.14}/setup.py +0 -0
  44. {gazu-0.10.12 → gazu-0.10.14}/tests/test_asset.py +0 -0
  45. {gazu-0.10.12 → gazu-0.10.14}/tests/test_cache.py +0 -0
  46. {gazu-0.10.12 → gazu-0.10.14}/tests/test_casting.py +0 -0
  47. {gazu-0.10.12 → gazu-0.10.14}/tests/test_concept.py +0 -0
  48. {gazu-0.10.12 → gazu-0.10.14}/tests/test_entity.py +0 -0
  49. {gazu-0.10.12 → gazu-0.10.14}/tests/test_files.py +0 -0
  50. {gazu-0.10.12 → gazu-0.10.14}/tests/test_helpers.py +0 -0
  51. {gazu-0.10.12 → gazu-0.10.14}/tests/test_playlist.py +0 -0
  52. {gazu-0.10.12 → gazu-0.10.14}/tests/test_scene.py +0 -0
  53. {gazu-0.10.12 → gazu-0.10.14}/tests/test_shot.py +0 -0
  54. {gazu-0.10.12 → gazu-0.10.14}/tests/test_sync.py +0 -0
  55. {gazu-0.10.12 → gazu-0.10.14}/tests/test_user.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gazu
3
- Version: 0.10.12
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
@@ -35,8 +35,9 @@ Requires-Dist: pytest; extra == "test"
35
35
  Requires-Dist: pytest-cov; extra == "test"
36
36
  Requires-Dist: requests_mock; extra == "test"
37
37
  Provides-Extra: lint
38
- Requires-Dist: black==24.4.2; python_version >= "3.8" and extra == "lint"
39
- Requires-Dist: pre-commit==3.7.1; python_version >= "3.9" and extra == "lint"
38
+ Requires-Dist: autoflake==2.3.1; python_version >= "3.8" and extra == "lint"
39
+ Requires-Dist: black==24.8.0; python_version >= "3.8" and extra == "lint"
40
+ Requires-Dist: pre-commit==3.8.0; python_version >= "3.9" and extra == "lint"
40
41
 
41
42
  .. figure:: https://zou.cg-wire.com/kitsu.png
42
43
  :alt: Kitsu Logo
@@ -0,0 +1 @@
1
+ __version__ = "0.10.14"
@@ -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
  """
@@ -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,
@@ -404,7 +404,10 @@ 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
- updated_shot = {"id": current_shot["id"], "data": current_shot["data"]}
407
+ current_data = (
408
+ current_shot["data"] if current_shot["data"] is not None else {}
409
+ )
410
+ updated_shot = {"id": current_shot["id"], "data": current_data}
408
411
  updated_shot["data"].update(data)
409
412
  return update_shot(updated_shot, client=client)
410
413
 
@@ -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.12
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
@@ -35,8 +35,9 @@ Requires-Dist: pytest; extra == "test"
35
35
  Requires-Dist: pytest-cov; extra == "test"
36
36
  Requires-Dist: requests_mock; extra == "test"
37
37
  Provides-Extra: lint
38
- Requires-Dist: black==24.4.2; python_version >= "3.8" and extra == "lint"
39
- Requires-Dist: pre-commit==3.7.1; python_version >= "3.9" and extra == "lint"
38
+ Requires-Dist: autoflake==2.3.1; python_version >= "3.8" and extra == "lint"
39
+ Requires-Dist: black==24.8.0; python_version >= "3.8" and extra == "lint"
40
+ Requires-Dist: pre-commit==3.8.0; python_version >= "3.9" and extra == "lint"
40
41
 
41
42
  .. figure:: https://zou.cg-wire.com/kitsu.png
42
43
  :alt: Kitsu Logo
@@ -10,10 +10,11 @@ wheel
10
10
  [lint]
11
11
 
12
12
  [lint:python_version >= "3.8"]
13
- black==24.4.2
13
+ autoflake==2.3.1
14
+ black==24.8.0
14
15
 
15
16
  [lint:python_version >= "3.9"]
16
- pre-commit==3.7.1
17
+ pre-commit==3.8.0
17
18
 
18
19
  [test]
19
20
  pytest
@@ -45,8 +45,9 @@ test =
45
45
  pytest-cov
46
46
  requests_mock
47
47
  lint =
48
- black==24.4.2; python_version >= '3.8'
49
- pre-commit==3.7.1; python_version >= '3.9'
48
+ autoflake==2.3.1; python_version >= '3.8'
49
+ black==24.8.0; python_version >= '3.8'
50
+ pre-commit==3.8.0; python_version >= '3.9'
50
51
 
51
52
  [bdist_wheel]
52
53
  universal = 1
@@ -1,13 +1,12 @@
1
1
  import datetime
2
2
  import json
3
- import sys
4
3
 
5
4
  import unittest
6
5
  import requests_mock
7
6
  import gazu
8
7
  from gazu.__version__ import __version__
9
8
 
10
- from gazu import client as raw, set_event_host
9
+ from gazu import client as raw
11
10
  from gazu.exception import (
12
11
  RouteNotFoundException,
13
12
  AuthFailedException,
@@ -7,7 +7,7 @@ import gazu.scene
7
7
  import gazu.shot
8
8
  import gazu.project
9
9
  import requests_mock
10
- from utils import mock_route, fakeid
10
+ from utils import mock_route
11
11
 
12
12
 
13
13
  class CastingTestCase(unittest.TestCase):
@@ -1,7 +1,5 @@
1
1
  import unittest
2
- import json
3
2
  import requests_mock
4
- import os
5
3
 
6
4
  import gazu.client
7
5
  import gazu.edit
@@ -53,6 +53,39 @@ class PersonTestCase(unittest.TestCase):
53
53
  person = gazu.person.get_person_by_full_name("", "John", "Doe")
54
54
  self.assertEqual(person["id"], "person-1")
55
55
 
56
+ def test_get_department_by_name(self):
57
+ with requests_mock.mock() as mock:
58
+ mock_route(
59
+ mock,
60
+ "GET",
61
+ "data/departments?name=department-1",
62
+ text=[{"name": "department-1"}],
63
+ )
64
+ department = gazu.person.get_department_by_name("department-1")
65
+ self.assertEqual(department["name"], "department-1")
66
+
67
+ def test_get_department(self):
68
+ with requests_mock.mock() as mock:
69
+ mock_route(
70
+ mock,
71
+ "GET",
72
+ "data/departments/%s" % fakeid("department-1"),
73
+ text={"name": "department-1"},
74
+ )
75
+ department = gazu.person.get_department(fakeid("department-1"))
76
+ self.assertEqual(department["name"], "department-1")
77
+
78
+ def test_new_department(self):
79
+ with requests_mock.mock() as mock:
80
+ result = {"name": "department-1"}
81
+ mock_route(
82
+ mock, "GET", "data/departments?name=department-1", text=[]
83
+ )
84
+ mock_route(mock, "POST", "data/departments", text=result)
85
+ self.assertEqual(
86
+ gazu.person.new_department("department-1"), result
87
+ )
88
+
56
89
  def test_get_person_by_desktop_login(self):
57
90
  with requests_mock.mock() as mock:
58
91
  mock.get(
@@ -1,4 +1,3 @@
1
- from gazu.helpers import normalize_model_parameter
2
1
  import unittest
3
2
  import requests_mock
4
3
  import gazu.client
@@ -1,4 +1,3 @@
1
- from re import T
2
1
  import unittest
3
2
  import json
4
3
  import requests_mock
@@ -508,13 +507,10 @@ class TaskTestCase(unittest.TestCase):
508
507
  self.assertIn("person-01", task["assignees"])
509
508
 
510
509
  def test_new_task_type(self):
511
- task_type_name = "task-type-name"
512
510
  with requests_mock.mock() as mock:
513
- task_type = {"id": "task-type-01", "name": task_type_name}
514
- mock.post(
515
- gazu.client.get_full_url("data/task-types"),
516
- text=json.dumps(task_type),
517
- )
511
+ task_type = {"id": "task-type-01", "name": "task-type-name"}
512
+ mock_route(mock, "GET", "data/task-types", text=[])
513
+ mock_route(mock, "POST", "data/task-types", text=task_type)
518
514
  self.assertEqual(gazu.task.new_task_type(task_type), task_type)
519
515
 
520
516
  def test_new_task_status(self):
@@ -1 +0,0 @@
1
- __version__ = "0.10.12"
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