gazu 1.1.1__py2.py3-none-any.whl → 1.1.2__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__ = "1.1.1"
1
+ __version__ = "1.1.2"
gazu/asset.py CHANGED
@@ -47,7 +47,7 @@ def all_assets_for_project(
47
47
  if project is None:
48
48
  return sort_by_name(raw.fetch_all("assets/all", client=client))
49
49
  else:
50
- path = "projects/%s/assets" % project["id"]
50
+ path = f"projects/{project['id']}/assets"
51
51
  return sort_by_name(raw.fetch_all(path, client=client))
52
52
 
53
53
 
@@ -81,7 +81,7 @@ def all_assets_for_shot(
81
81
  list: Assets stored in the database for given shot.
82
82
  """
83
83
  shot = normalize_model_parameter(shot)
84
- path = "shots/%s/assets" % shot["id"]
84
+ path = f"shots/{shot['id']}/assets"
85
85
  return sort_by_name(raw.fetch_all(path, client=client))
86
86
 
87
87
 
@@ -102,8 +102,7 @@ def all_assets_for_project_and_type(
102
102
 
103
103
  project_id = project["id"]
104
104
  asset_type_id = asset_type["id"]
105
- path = "projects/{project_id}/asset-types/{asset_type_id}/assets"
106
- path = path.format(project_id=project_id, asset_type_id=asset_type_id)
105
+ path = f"projects/{project_id}/asset-types/{asset_type_id}/assets"
107
106
 
108
107
  assets = raw.fetch_all(path, client=client)
109
108
  return sort_by_name(assets)
@@ -164,22 +163,16 @@ def get_asset_url(asset: str | dict, client: KitsuClient = default) -> str:
164
163
  asset = normalize_model_parameter(asset)
165
164
  asset = get_asset(asset["id"])
166
165
  project = gazu_project.get_project(asset["project_id"])
167
- episode_id = "main"
168
- path = "{host}/productions/{project_id}/"
166
+ host = raw.get_api_url_from_host()
167
+ project_id = asset["project_id"]
168
+ asset_id = asset["id"]
169
169
  if project["production_type"] != "tvshow":
170
- path += "assets/{asset_id}/"
170
+ return f"{host}/productions/{project_id}/assets/{asset_id}/"
171
171
  else:
172
- path += "episodes/{episode_id}/assets/{asset_id}/"
172
+ episode_id = "main"
173
173
  if len(asset["episode_id"]) > 0:
174
174
  episode_id = asset["episode_id"]
175
-
176
- return path.format(
177
- host=raw.get_api_url_from_host(),
178
- project_id=asset["project_id"],
179
- asset_id=asset["id"],
180
- episode_id=episode_id,
181
- client=client,
182
- )
175
+ return f"{host}/productions/{project_id}/episodes/{episode_id}/assets/{asset_id}/"
183
176
 
184
177
 
185
178
  def new_asset(
@@ -222,8 +215,7 @@ def new_asset(
222
215
  asset = get_asset_by_name(project, name, asset_type, client=client)
223
216
  if asset is None:
224
217
  asset = raw.post(
225
- "data/projects/%s/asset-types/%s/assets/new"
226
- % (project["id"], asset_type["id"]),
218
+ f"data/projects/{project['id']}/asset-types/{asset_type['id']}/assets/new",
227
219
  data,
228
220
  client=client,
229
221
  )
@@ -240,7 +232,7 @@ def update_asset(asset: dict, client: KitsuClient = default) -> dict:
240
232
  """
241
233
  if "episode_id" in asset:
242
234
  asset["source_id"] = asset["episode_id"]
243
- return raw.put("data/entities/%s" % asset["id"], asset, client=client)
235
+ return raw.put(f"data/entities/{asset['id']}", asset, client=client)
244
236
 
245
237
 
246
238
  def update_asset_data(
@@ -280,7 +272,7 @@ def remove_asset(
280
272
  whether it has links to tasks.
281
273
  """
282
274
  asset = normalize_model_parameter(asset)
283
- path = "data/assets/%s" % asset["id"]
275
+ path = f"data/assets/{asset['id']}"
284
276
  params = {}
285
277
  if force:
286
278
  params = {"force": True}
@@ -308,7 +300,7 @@ def all_asset_types_for_project(
308
300
  list: Asset types from assets listed in given project.
309
301
  """
310
302
  project = normalize_model_parameter(project)
311
- path = "projects/%s/asset-types" % project["id"]
303
+ path = f"projects/{project['id']}/asset-types"
312
304
  return sort_by_name(raw.fetch_all(path, client=client))
313
305
 
314
306
 
@@ -323,7 +315,7 @@ def all_asset_types_for_shot(
323
315
  Returns:
324
316
  list: Asset types from assets casted in given shot.
325
317
  """
326
- path = "shots/%s/asset-types" % shot["id"]
318
+ path = f"shots/{shot['id']}/asset-types"
327
319
  return sort_by_name(raw.fetch_all(path, client=client))
328
320
 
329
321
 
@@ -382,7 +374,7 @@ def update_asset_type(asset_type: dict, client: KitsuClient = default) -> dict:
382
374
  asset_type (dict): Asset Type to save.
383
375
  """
384
376
  data = {"name": asset_type["name"]}
385
- path = "data/asset-types/%s" % asset_type["id"]
377
+ path = f"data/asset-types/{asset_type['id']}"
386
378
  return raw.put(path, data, client=client)
387
379
 
388
380
 
@@ -396,7 +388,7 @@ def remove_asset_type(
396
388
  asset_type (str / dict): Asset type to remove.
397
389
  """
398
390
  asset_type = normalize_model_parameter(asset_type)
399
- path = "data/asset-types/%s" % asset_type["id"]
391
+ path = f"data/asset-types/{asset_type['id']}"
400
392
  return raw.delete(path, client=client)
401
393
 
402
394
 
@@ -426,7 +418,7 @@ def all_shot_asset_instances_for_asset(
426
418
  list: Asset instances existing for a given asset.
427
419
  """
428
420
  asset = normalize_model_parameter(asset)
429
- path = "assets/%s/shot-asset-instances" % asset["id"]
421
+ path = f"assets/{asset['id']}/shot-asset-instances"
430
422
  return raw.fetch_all(path, client=client)
431
423
 
432
424
 
@@ -441,7 +433,7 @@ def enable_asset_instance(
441
433
  """
442
434
  asset_instance = normalize_model_parameter(asset_instance)
443
435
  data = {"active": True}
444
- path = "asset-instances/%s" % asset_instance["id"]
436
+ path = f"asset-instances/{asset_instance['id']}"
445
437
  return raw.put(path, data, client=client)
446
438
 
447
439
 
@@ -456,7 +448,7 @@ def disable_asset_instance(
456
448
  """
457
449
  asset_instance = normalize_model_parameter(asset_instance)
458
450
  data = {"active": False}
459
- path = "asset-instances/%s" % asset_instance["id"]
451
+ path = f"asset-instances/{asset_instance['id']}"
460
452
  return raw.put(path, data, client=client)
461
453
 
462
454
 
@@ -472,7 +464,7 @@ def all_scene_asset_instances_for_asset(
472
464
  list: Scene asset instances existing for a given asset.
473
465
  """
474
466
  asset = normalize_model_parameter(asset)
475
- path = "assets/%s/scene-asset-instances" % asset["id"]
467
+ path = f"assets/{asset['id']}/scene-asset-instances"
476
468
  return raw.fetch_all(path, client=client)
477
469
 
478
470
 
@@ -487,7 +479,7 @@ def all_asset_instances_for_shot(
487
479
  Returns:
488
480
  list: Asset instances existing for a given shot.
489
481
  """
490
- path = "shots/%s/asset-instances" % shot["id"]
482
+ path = f"shots/{shot['id']}/asset-instances"
491
483
  return raw.fetch_all(path, client=client)
492
484
 
493
485
 
@@ -503,7 +495,7 @@ def all_asset_instances_for_asset(
503
495
  list: Asset instances existing for a given asset.
504
496
  """
505
497
  asset = normalize_model_parameter(asset)
506
- path = "assets/%s/asset-asset-instances" % asset["id"]
498
+ path = f"assets/{asset['id']}/asset-asset-instances"
507
499
  return raw.fetch_all(path, client=client)
508
500
 
509
501
 
@@ -533,7 +525,7 @@ def new_asset_asset_instance(
533
525
  data["description"] = description
534
526
 
535
527
  return raw.post(
536
- "data/assets/%s/asset-asset-instances" % asset["id"],
528
+ f"data/assets/{asset['id']}/asset-asset-instances",
537
529
  data,
538
530
  client=client,
539
531
  )
@@ -556,7 +548,7 @@ def import_assets_with_csv(
556
548
  """
557
549
  project = normalize_model_parameter(project)
558
550
  return raw.upload(
559
- "import/csv/projects/%s/assets" % project["id"],
551
+ f"import/csv/projects/{project['id']}/assets",
560
552
  csv_file_path,
561
553
  client=client,
562
554
  )
@@ -599,7 +591,7 @@ def export_assets_with_csv(
599
591
  if assigned_to:
600
592
  params["assigned_to"] = assigned_to["id"]
601
593
  return raw.download(
602
- "export/csv/projects/%s/assets.csv" % project["id"],
594
+ f"export/csv/projects/{project['id']}/assets.csv",
603
595
  csv_file_path,
604
596
  params=params,
605
597
  client=client,
gazu/casting.py CHANGED
@@ -30,7 +30,7 @@ def update_shot_casting(
30
30
  """
31
31
  shot = normalize_model_parameter(shot)
32
32
  project = normalize_model_parameter(project)
33
- path = "data/projects/%s/entities/%s/casting" % (project["id"], shot["id"])
33
+ path = f"data/projects/{project['id']}/entities/{shot['id']}/casting"
34
34
  return raw.put(path, casting, client=client)
35
35
 
36
36
 
@@ -54,10 +54,7 @@ def update_asset_casting(
54
54
  """
55
55
  asset = normalize_model_parameter(asset)
56
56
  project = normalize_model_parameter(project)
57
- path = "data/projects/%s/entities/%s/casting" % (
58
- project["id"],
59
- asset["id"],
60
- )
57
+ path = f"data/projects/{project['id']}/entities/{asset['id']}/casting"
61
58
  return raw.put(path, casting, client=client)
62
59
 
63
60
 
@@ -81,10 +78,7 @@ def update_episode_casting(
81
78
  """
82
79
  episode = normalize_model_parameter(episode)
83
80
  project = normalize_model_parameter(project)
84
- path = "data/projects/%s/entities/%s/casting" % (
85
- project["id"],
86
- episode["id"],
87
- )
81
+ path = f"data/projects/{project['id']}/entities/{episode['id']}/casting"
88
82
  return raw.put(path, casting, client=client)
89
83
 
90
84
 
@@ -106,10 +100,7 @@ def get_asset_type_casting(
106
100
 
107
101
  project = normalize_model_parameter(project)
108
102
  asset_type = normalize_model_parameter(asset_type)
109
- path = "/data/projects/%s/asset-types/%s/casting" % (
110
- project["id"],
111
- asset_type["id"],
112
- )
103
+ path = f"/data/projects/{project['id']}/asset-types/{asset_type['id']}/casting"
113
104
  return raw.get(path, client=client)
114
105
 
115
106
 
@@ -127,10 +118,7 @@ def get_sequence_casting(
127
118
  list contains dictionaries with "asset_id" and "nb_occurences" keys
128
119
  representing which assets are cast in each shot of the sequence.
129
120
  """
130
- path = "/data/projects/%s/sequences/%s/casting" % (
131
- sequence["project_id"],
132
- sequence["id"],
133
- )
121
+ path = f"/data/projects/{sequence['project_id']}/sequences/{sequence['id']}/casting"
134
122
  return raw.get(path, client=client)
135
123
 
136
124
 
@@ -146,10 +134,7 @@ def get_shot_casting(shot: dict, client: KitsuClient = default) -> dict:
146
134
  and "nb_occurences" keys representing which assets are cast in the shot
147
135
  and how many times they appear.
148
136
  """
149
- path = "/data/projects/%s/entities/%s/casting" % (
150
- shot["project_id"],
151
- shot["id"],
152
- )
137
+ path = f"/data/projects/{shot['project_id']}/entities/{shot['id']}/casting"
153
138
  return raw.get(path, client=client)
154
139
 
155
140
 
@@ -166,9 +151,8 @@ def get_asset_casting(asset: dict, client: KitsuClient = default) -> dict:
166
151
  and "nb_occurences" keys representing which assets are cast in the
167
152
  given asset and how many times they appear.
168
153
  """
169
- path = "/data/projects/%s/entities/%s/casting" % (
170
- asset["project_id"],
171
- asset["id"],
154
+ path = (
155
+ f"/data/projects/{asset['project_id']}/entities/{asset['id']}/casting"
172
156
  )
173
157
  return raw.get(path, client=client)
174
158
 
@@ -186,10 +170,7 @@ def get_episode_casting(episode: dict, client: KitsuClient = default) -> dict:
186
170
  and "nb_occurences" keys representing which assets are cast in the
187
171
  episode and how many times they appear.
188
172
  """
189
- path = "/data/projects/%s/entities/%s/casting" % (
190
- episode["project_id"],
191
- episode["id"],
192
- )
173
+ path = f"/data/projects/{episode['project_id']}/entities/{episode['id']}/casting"
193
174
  return raw.get(path, client=client)
194
175
 
195
176
 
@@ -208,7 +189,7 @@ def get_asset_cast_in(
208
189
  fields like "id", "name", "project_id", etc.
209
190
  """
210
191
  asset = normalize_model_parameter(asset)
211
- path = "/data/assets/%s/cast-in" % asset["id"]
192
+ path = f"/data/assets/{asset['id']}/cast-in"
212
193
  return raw.get(path, client=client)
213
194
 
214
195
 
@@ -230,7 +211,7 @@ def all_entity_links_for_project(
230
211
  other link-related fields.
231
212
  """
232
213
  project = normalize_model_parameter(project)
233
- path = "/data/projects/%s/entity-links" % project["id"]
214
+ path = f"/data/projects/{project['id']}/entity-links"
234
215
  params = {}
235
216
  if page is not None:
236
217
  params["page"] = page
@@ -254,7 +235,7 @@ def get_episodes_casting(
254
235
  keys representing which assets are cast in each episode.
255
236
  """
256
237
  project = normalize_model_parameter(project)
257
- path = "/data/projects/%s/episodes/casting" % project["id"]
238
+ path = f"/data/projects/{project['id']}/episodes/casting"
258
239
  return raw.get(path, client=client)
259
240
 
260
241
 
@@ -275,10 +256,7 @@ def get_sequence_shots_casting(
275
256
  """
276
257
  project = normalize_model_parameter(project)
277
258
  sequence = normalize_model_parameter(sequence)
278
- path = "/data/projects/%s/sequences/%s/shots/casting" % (
279
- project["id"],
280
- sequence["id"],
281
- )
259
+ path = f"/data/projects/{project['id']}/sequences/{sequence['id']}/shots/casting"
282
260
  return raw.get(path, client=client)
283
261
 
284
262
 
@@ -299,10 +277,7 @@ def get_episode_shots_casting(
299
277
  """
300
278
  project = normalize_model_parameter(project)
301
279
  episode = normalize_model_parameter(episode)
302
- path = "/data/projects/%s/episodes/%s/shots/casting" % (
303
- project["id"],
304
- episode["id"],
305
- )
280
+ path = f"/data/projects/{project['id']}/episodes/{episode['id']}/shots/casting"
306
281
  return raw.get(path, client=client)
307
282
 
308
283
 
@@ -321,7 +296,7 @@ def get_project_shots_casting(
321
296
  representing which assets are cast in each shot of the project.
322
297
  """
323
298
  project = normalize_model_parameter(project)
324
- path = "/data/projects/%s/shots/casting" % project["id"]
299
+ path = f"/data/projects/{project['id']}/shots/casting"
325
300
  return raw.get(path, client=client)
326
301
 
327
302
 
@@ -338,6 +313,6 @@ def delete_entity_link(
338
313
  dict: The deleted entity link.
339
314
  """
340
315
  entity_link = normalize_model_parameter(entity_link)
341
- path = "/data/entity-links/%s" % entity_link["id"]
316
+ path = f"/data/entity-links/{entity_link['id']}"
342
317
  raw.delete(path, client=client)
343
318
  return entity_link
gazu/client.py CHANGED
@@ -535,8 +535,8 @@ def check_status(
535
535
  raise MethodNotAllowedException(path)
536
536
  elif status_code == 413:
537
537
  raise TooBigFileException(
538
- "%s: You send a too big file. "
539
- "Change your proxy configuration to allow bigger files." % path
538
+ f"{path}: You send a too big file. "
539
+ "Change your proxy configuration to allow bigger files."
540
540
  )
541
541
  elif status_code in [401, 422]:
542
542
  try:
@@ -562,12 +562,12 @@ def check_status(
562
562
  stacktrace = request.json().get(
563
563
  "stacktrace", "No stacktrace sent by the server"
564
564
  )
565
- print("Server stacktrace:\n%s" % stacktrace)
565
+ print(f"Server stacktrace:\n{stacktrace}")
566
566
  message = get_message_from_response(
567
567
  response=request,
568
568
  default_message="No message sent by the server",
569
569
  )
570
- print("Error message:\n%s\n" % message)
570
+ print(f"Error message:\n{message}\n")
571
571
  except Exception:
572
572
  print(request.text)
573
573
  raise ServerErrorException(path)
@@ -771,7 +771,7 @@ def _build_file_dict(file_path: str, extra_files: list[str]) -> dict:
771
771
  i = 0
772
772
  for file_path in extra_files:
773
773
  i += 1
774
- files["file-%s" % i] = open(file_path, "rb")
774
+ files[f"file-{i}"] = open(file_path, "rb")
775
775
 
776
776
  return files
777
777
 
@@ -847,7 +847,7 @@ def import_data(
847
847
  Returns:
848
848
  dict: The imported data.
849
849
  """
850
- return post("/import/kitsu/%s" % model_name, data, client=client)
850
+ return post(f"/import/kitsu/{model_name}", data, client=client)
851
851
 
852
852
 
853
853
  def get_api_version(client: KitsuClient = default_client) -> str:
gazu/concept.py CHANGED
@@ -36,7 +36,7 @@ def all_concepts_for_project(
36
36
  """
37
37
  project = normalize_model_parameter(project)
38
38
  concepts = raw.fetch_all(
39
- "projects/%s/concepts" % project["id"], client=client
39
+ f"projects/{project['id']}/concepts", client=client
40
40
  )
41
41
  return sort_by_name(concepts)
42
42
 
@@ -54,7 +54,7 @@ def all_previews_for_concept(
54
54
  """
55
55
  concept = normalize_model_parameter(concept)
56
56
  return raw.fetch_all(
57
- "concepts/%s/preview-files" % concept["id"], client=client
57
+ f"concepts/{concept['id']}/preview-files", client=client
58
58
  )
59
59
 
60
60
 
@@ -73,7 +73,7 @@ def remove_concept(
73
73
  force (bool): Whether to force the deletion of the concept.
74
74
  """
75
75
  concept = normalize_model_parameter(concept)
76
- path = "data/concepts/%s" % concept["id"]
76
+ path = f"data/concepts/{concept['id']}"
77
77
  params = {}
78
78
  if force:
79
79
  params = {"force": True}
@@ -147,7 +147,7 @@ def new_concept(
147
147
 
148
148
  concept = get_concept_by_name(project, name, client=client)
149
149
  if concept is None:
150
- path = "data/projects/%s/concepts" % project["id"]
150
+ path = f"data/projects/{project['id']}/concepts"
151
151
  return raw.post(path, data, client=client)
152
152
  else:
153
153
  return concept
@@ -164,4 +164,4 @@ def update_concept(concept: dict, client: KitsuClient = default) -> dict:
164
164
  Returns:
165
165
  dict: Updated concept.
166
166
  """
167
- return raw.put("data/entities/%s" % concept["id"], concept, client=client)
167
+ return raw.put(f"data/entities/{concept['id']}", concept, client=client)
gazu/edit.py CHANGED
@@ -53,17 +53,14 @@ def get_edit_url(edit: str | dict, client: KitsuClient = default) -> str:
53
53
  """
54
54
  edit = normalize_model_parameter(edit)
55
55
  edit = get_edit(edit["id"])
56
- path = "{host}/productions/{project_id}/"
56
+ host = raw.get_api_url_from_host(client=client)
57
+ project_id = edit["project_id"]
58
+ edit_id = edit["id"]
57
59
  if edit["episode_id"] is None:
58
- path += "edits/{edit_id}/"
60
+ return f"{host}/productions/{project_id}/edits/{edit_id}/"
59
61
  else:
60
- path += "episodes/{episode_id}/edits/{edit_id}/"
61
- return path.format(
62
- host=raw.get_api_url_from_host(client=client),
63
- project_id=edit["project_id"],
64
- edit_id=edit["id"],
65
- episode_id=edit["episode_id"],
66
- )
62
+ episode_id = edit["episode_id"]
63
+ return f"{host}/productions/{project_id}/episodes/{episode_id}/edits/{edit_id}/"
67
64
 
68
65
 
69
66
  @cache
@@ -78,7 +75,7 @@ def all_edits_for_project(
78
75
  list: Edits from database or for given project.
79
76
  """
80
77
  project = normalize_model_parameter(project)
81
- edits = raw.fetch_all("projects/%s/edits" % project["id"], client=client)
78
+ edits = raw.fetch_all(f"projects/{project['id']}/edits", client=client)
82
79
  return sort_by_name(edits)
83
80
 
84
81
 
@@ -94,7 +91,7 @@ def all_previews_for_edit(
94
91
  list: Previews from database for given edit.
95
92
  """
96
93
  edit = normalize_model_parameter(edit)
97
- return raw.fetch_all("edits/%s/preview-files" % edit["id"], client=client)
94
+ return raw.fetch_all(f"edits/{edit['id']}/preview-files", client=client)
98
95
 
99
96
 
100
97
  def new_edit(
@@ -131,7 +128,7 @@ def new_edit(
131
128
 
132
129
  edit = get_edit_by_name(project, name, client=client)
133
130
  if edit is None:
134
- path = "data/projects/%s/edits" % project["id"]
131
+ path = f"data/projects/{project['id']}/edits"
135
132
  return raw.post(path, data, client=client)
136
133
  else:
137
134
  return edit
@@ -153,7 +150,7 @@ def remove_edit(
153
150
  whether it has links to tasks.
154
151
  """
155
152
  edit = normalize_model_parameter(edit)
156
- path = "data/edits/%s" % edit["id"]
153
+ path = f"data/edits/{edit['id']}"
157
154
  params = {}
158
155
  if force:
159
156
  params = {"force": True}
@@ -171,7 +168,7 @@ def update_edit(edit: dict, client: KitsuClient = default) -> dict:
171
168
  Returns:
172
169
  dict: Updated edit.
173
170
  """
174
- return raw.put("data/entities/%s" % edit["id"], edit, client=client)
171
+ return raw.put(f"data/entities/{edit['id']}", edit, client=client)
175
172
 
176
173
 
177
174
  def update_edit_data(
gazu/entity.py CHANGED
@@ -140,7 +140,7 @@ def remove_entity_type(
140
140
  entity_type (str / dict): Entity type to remove.
141
141
  """
142
142
  entity_type = normalize_model_parameter(entity_type)
143
- path = "data/entity-types/%s" % entity_type["id"]
143
+ path = f"data/entity-types/{entity_type['id']}"
144
144
  return raw.delete(path, client=client)
145
145
 
146
146
 
@@ -160,7 +160,7 @@ def remove_entity(
160
160
  whether it has links to tasks.
161
161
  """
162
162
  entity = normalize_model_parameter(entity)
163
- path = "data/entities/%s" % entity["id"]
163
+ path = f"data/entities/{entity['id']}"
164
164
  params = {}
165
165
  if force:
166
166
  params = {"force": True}
@@ -179,5 +179,5 @@ def all_entities_with_tasks_linked_to_entity(
179
179
  """
180
180
  entity = normalize_model_parameter(entity)
181
181
  return raw.fetch_all(
182
- "entities/%s/entities-linked/with-tasks" % entity["id"], client=client
182
+ f"entities/{entity['id']}/entities-linked/with-tasks", client=client
183
183
  )