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/scene.py CHANGED
@@ -24,7 +24,7 @@ def new_scene(
24
24
  sequence = normalize_model_parameter(sequence)
25
25
  scene = {"name": name, "sequence_id": sequence["id"]}
26
26
  return raw.post(
27
- "data/projects/%s/scenes" % project["id"], scene, client=client
27
+ f"data/projects/{project['id']}/scenes", scene, client=client
28
28
  )
29
29
 
30
30
 
@@ -38,7 +38,7 @@ def all_scenes(
38
38
  project = normalize_model_parameter(project)
39
39
  if project is not None:
40
40
  scenes = raw.fetch_all(
41
- "projects/%s/scenes" % project["id"], client=client
41
+ f"projects/{project['id']}/scenes", client=client
42
42
  )
43
43
  else:
44
44
  scenes = raw.fetch_all("scenes", client=client)
@@ -53,7 +53,7 @@ def all_scenes_for_project(
53
53
  Retrieve all scenes for given project.
54
54
  """
55
55
  project = normalize_model_parameter(project)
56
- scenes = raw.fetch_all("projects/%s/scenes" % project["id"], client=client)
56
+ scenes = raw.fetch_all(f"projects/{project['id']}/scenes", client=client)
57
57
  return sort_by_name(scenes)
58
58
 
59
59
 
@@ -66,7 +66,7 @@ def all_scenes_for_sequence(
66
66
  """
67
67
  sequence = normalize_model_parameter(sequence)
68
68
  return sort_by_name(
69
- raw.fetch_all("sequences/%s/scenes" % sequence["id"], client=client),
69
+ raw.fetch_all(f"sequences/{sequence['id']}/scenes", client=client),
70
70
  )
71
71
 
72
72
 
@@ -98,7 +98,7 @@ def update_scene(scene: dict, client: KitsuClient = default) -> dict:
98
98
  """
99
99
  Save given scene data into the API.
100
100
  """
101
- return raw.put("data/entities/%s" % scene["id"], scene, client=client)
101
+ return raw.put(f"data/entities/{scene['id']}", scene, client=client)
102
102
 
103
103
 
104
104
  def new_scene_asset_instance(
@@ -119,7 +119,7 @@ def new_scene_asset_instance(
119
119
  data["description"] = description
120
120
 
121
121
  return raw.post(
122
- "data/scenes/%s/asset-instances" % scene["id"], data, client=client
122
+ f"data/scenes/{scene['id']}/asset-instances", data, client=client
123
123
  )
124
124
 
125
125
 
@@ -131,9 +131,7 @@ def all_asset_instances_for_scene(
131
131
  Return the list of asset instances listed in a scene.
132
132
  """
133
133
  scene = normalize_model_parameter(scene)
134
- return raw.get(
135
- "data/scenes/%s/asset-instances" % scene["id"], client=client
136
- )
134
+ return raw.get(f"data/scenes/{scene['id']}/asset-instances", client=client)
137
135
 
138
136
 
139
137
  @cache
@@ -160,7 +158,7 @@ def all_camera_instances_for_scene(
160
158
  """
161
159
  scene = normalize_model_parameter(scene)
162
160
  return raw.get(
163
- "data/scenes/%s/camera-instances" % scene["id"], client=client
161
+ f"data/scenes/{scene['id']}/camera-instances", client=client
164
162
  )
165
163
 
166
164
 
@@ -172,7 +170,7 @@ def all_shots_for_scene(
172
170
  Return the list of shots issued from given scene.
173
171
  """
174
172
  scene = normalize_model_parameter(scene)
175
- return raw.get("data/scenes/%s/shots" % scene["id"], client=client)
173
+ return raw.get(f"data/scenes/{scene['id']}/shots", client=client)
176
174
 
177
175
 
178
176
  def add_shot_to_scene(
@@ -185,7 +183,7 @@ def add_shot_to_scene(
185
183
  scene = normalize_model_parameter(scene)
186
184
  shot = normalize_model_parameter(shot)
187
185
  data = {"shot_id": shot["id"]}
188
- return raw.post("data/scenes/%s/shots" % scene["id"], data, client=client)
186
+ return raw.post(f"data/scenes/{scene['id']}/shots", data, client=client)
189
187
 
190
188
 
191
189
  def remove_shot_from_scene(
@@ -197,7 +195,7 @@ def remove_shot_from_scene(
197
195
  scene = normalize_model_parameter(scene)
198
196
  shot = normalize_model_parameter(shot)
199
197
  return raw.delete(
200
- "data/scenes/%s/shots/%s" % (scene["id"], shot["id"]), client=client
198
+ f"data/scenes/{scene['id']}/shots/{shot['id']}", client=client
201
199
  )
202
200
 
203
201
 
@@ -207,7 +205,7 @@ def update_asset_instance_name(
207
205
  """
208
206
  Update the name of given asset instance.
209
207
  """
210
- path = "/data/asset-instances/%s" % asset_instance["id"]
208
+ path = f"/data/asset-instances/{asset_instance['id']}"
211
209
  return raw.put(path, {"name": name}, client=client)
212
210
 
213
211
 
@@ -218,7 +216,7 @@ def update_asset_instance_data(
218
216
  Update the extra data of given asset instance.
219
217
  """
220
218
  asset_instance = normalize_model_parameter(asset_instance)
221
- path = "/data/asset-instances/%s" % asset_instance["id"]
219
+ path = f"/data/asset-instances/{asset_instance['id']}"
222
220
  return raw.put(path, {"data": data}, client=client)
223
221
 
224
222
 
gazu/shot.py CHANGED
@@ -26,7 +26,7 @@ def all_previews_for_shot(
26
26
  list: Previews from database for given shot.
27
27
  """
28
28
  shot = normalize_model_parameter(shot)
29
- return raw.fetch_all("shots/%s/preview-files" % shot["id"], client=client)
29
+ return raw.fetch_all(f"shots/{shot['id']}/preview-files", client=client)
30
30
 
31
31
 
32
32
  @cache
@@ -41,7 +41,7 @@ def all_shots_for_project(
41
41
  list: Shots from database or for given project.
42
42
  """
43
43
  project = normalize_model_parameter(project)
44
- shots = raw.fetch_all("projects/%s/shots" % project["id"], client=client)
44
+ shots = raw.fetch_all(f"projects/{project['id']}/shots", client=client)
45
45
  return sort_by_name(shots)
46
46
 
47
47
 
@@ -58,7 +58,7 @@ def all_shots_for_episode(
58
58
  """
59
59
  episode = normalize_model_parameter(episode)
60
60
  return sort_by_name(
61
- raw.fetch_all("episodes/%s/shots" % episode["id"], client=client)
61
+ raw.fetch_all(f"episodes/{episode['id']}/shots", client=client)
62
62
  )
63
63
 
64
64
 
@@ -75,7 +75,7 @@ def all_shots_for_sequence(
75
75
  """
76
76
  sequence = normalize_model_parameter(sequence)
77
77
  return sort_by_name(
78
- raw.fetch_all("sequences/%s/shots" % sequence["id"], client=client)
78
+ raw.fetch_all(f"sequences/{sequence['id']}/shots", client=client)
79
79
  )
80
80
 
81
81
 
@@ -91,7 +91,7 @@ def all_sequences_for_project(
91
91
  list: Sequences from database for given project.
92
92
  """
93
93
  project = normalize_model_parameter(project)
94
- path = "projects/%s/sequences" % project["id"]
94
+ path = f"projects/{project['id']}/sequences"
95
95
  sequences = raw.fetch_all(path, client=client)
96
96
  return sort_by_name(sequences)
97
97
 
@@ -108,7 +108,7 @@ def all_sequences_for_episode(
108
108
  list: Sequences which are children of given episode.
109
109
  """
110
110
  episode = normalize_model_parameter(episode)
111
- path = "episodes/%s/sequences" % episode["id"]
111
+ path = f"episodes/{episode['id']}/sequences"
112
112
  sequences = raw.fetch_all(path, client=client)
113
113
  return sort_by_name(sequences)
114
114
 
@@ -125,7 +125,7 @@ def all_episodes_for_project(
125
125
  list: Episodes from database for given project.
126
126
  """
127
127
  project = normalize_model_parameter(project)
128
- path = "projects/%s/episodes" % project["id"]
128
+ path = f"projects/{project['id']}/episodes"
129
129
  episodes = raw.fetch_all(path, client=client)
130
130
  return sort_by_name(episodes)
131
131
 
@@ -273,12 +273,10 @@ def get_episode_url(episode: str | dict, client: KitsuClient = default) -> str:
273
273
  """
274
274
  episode = normalize_model_parameter(episode)
275
275
  episode = get_episode(episode["id"])
276
- path = "{host}/productions/{project_id}/episodes/{episode_id}/shots"
277
- return path.format(
278
- host=raw.get_api_url_from_host(client=client),
279
- project_id=episode["project_id"],
280
- episode_id=episode["id"],
281
- )
276
+ host = raw.get_api_url_from_host(client=client)
277
+ project_id = episode["project_id"]
278
+ episode_id = episode["id"]
279
+ return f"{host}/productions/{project_id}/episodes/{episode_id}/shots"
282
280
 
283
281
 
284
282
  @cache
@@ -292,17 +290,14 @@ def get_shot_url(shot: str | dict, client: KitsuClient = default) -> str:
292
290
  """
293
291
  shot = normalize_model_parameter(shot)
294
292
  shot = get_shot(shot["id"])
295
- path = "{host}/productions/{project_id}/"
293
+ host = raw.get_api_url_from_host(client=client)
294
+ project_id = shot["project_id"]
295
+ shot_id = shot["id"]
296
296
  if shot["episode_id"] is None:
297
- path += "shots/{shot_id}/"
297
+ return f"{host}/productions/{project_id}/shots/{shot_id}/"
298
298
  else:
299
- path += "episodes/{episode_id}/shots/{shot_id}/"
300
- return path.format(
301
- host=raw.get_api_url_from_host(client=client),
302
- project_id=shot["project_id"],
303
- shot_id=shot["id"],
304
- episode_id=shot["episode_id"],
305
- )
299
+ episode_id = shot["episode_id"]
300
+ return f"{host}/productions/{project_id}/episodes/{episode_id}/shots/{shot_id}/"
306
301
 
307
302
 
308
303
  def new_sequence(
@@ -333,7 +328,7 @@ def new_sequence(
333
328
  project, name, episode=episode, client=client
334
329
  )
335
330
  if sequence is None:
336
- path = "data/projects/%s/sequences" % project["id"]
331
+ path = f"data/projects/{project['id']}/sequences"
337
332
  return raw.post(path, data, client=client)
338
333
  else:
339
334
  return sequence
@@ -382,7 +377,7 @@ def new_shot(
382
377
 
383
378
  shot = get_shot_by_name(sequence, name, client=client)
384
379
  if shot is None:
385
- path = "data/projects/%s/shots" % project["id"]
380
+ path = f"data/projects/{project['id']}/shots"
386
381
  return raw.post(path, data, client=client)
387
382
  else:
388
383
  return shot
@@ -399,7 +394,7 @@ def update_shot(shot: dict, client: KitsuClient = default) -> dict:
399
394
  Returns:
400
395
  dict: Updated shot.
401
396
  """
402
- return raw.put("data/entities/%s" % shot["id"], shot, client=client)
397
+ return raw.put(f"data/entities/{shot['id']}", shot, client=client)
403
398
 
404
399
 
405
400
  def update_sequence(sequence: dict, client: KitsuClient = default) -> dict:
@@ -413,9 +408,7 @@ def update_sequence(sequence: dict, client: KitsuClient = default) -> dict:
413
408
  Returns:
414
409
  dict: Updated sequence.
415
410
  """
416
- return raw.put(
417
- "data/entities/%s" % sequence["id"], sequence, client=client
418
- )
411
+ return raw.put(f"data/entities/{sequence['id']}", sequence, client=client)
419
412
 
420
413
 
421
414
  @cache
@@ -426,7 +419,7 @@ def get_asset_instances_for_shot(
426
419
  Return the list of asset instances linked to given shot.
427
420
  """
428
421
  shot = normalize_model_parameter(shot)
429
- return raw.get("data/shots/%s/asset-instances" % shot["id"], client=client)
422
+ return raw.get(f"data/shots/{shot['id']}/asset-instances", client=client)
430
423
 
431
424
 
432
425
  def update_shot_data(
@@ -497,7 +490,7 @@ def remove_shot(
497
490
  whether it has links to tasks.
498
491
  """
499
492
  shot = normalize_model_parameter(shot)
500
- path = "data/shots/%s" % shot["id"]
493
+ path = f"data/shots/{shot['id']}"
501
494
  params = {}
502
495
  if force:
503
496
  params = {"force": True}
@@ -512,7 +505,7 @@ def restore_shot(shot: str | dict, client: KitsuClient = default) -> dict:
512
505
  shot (str / dict): Shot to restore.
513
506
  """
514
507
  shot = normalize_model_parameter(shot)
515
- path = "data/shots/%s" % shot["id"]
508
+ path = f"data/shots/{shot['id']}"
516
509
  data = {"canceled": False}
517
510
  return raw.put(path, data, client=client)
518
511
 
@@ -535,7 +528,7 @@ def new_episode(
535
528
  episode = get_episode_by_name(project, name, client=client)
536
529
  if episode is None:
537
530
  return raw.post(
538
- "data/projects/%s/episodes" % project["id"], data, client=client
531
+ f"data/projects/{project['id']}/episodes", data, client=client
539
532
  )
540
533
  else:
541
534
  return episode
@@ -552,7 +545,7 @@ def update_episode(episode: dict, client: KitsuClient = default) -> dict:
552
545
  Returns:
553
546
  dict: Updated episode.
554
547
  """
555
- return raw.put("data/entities/%s" % episode["id"], episode, client=client)
548
+ return raw.put(f"data/entities/{episode['id']}", episode, client=client)
556
549
 
557
550
 
558
551
  def update_episode_data(
@@ -602,7 +595,7 @@ def remove_episode(
602
595
  has not been provided.
603
596
  """
604
597
  episode = normalize_model_parameter(episode)
605
- path = "data/episodes/%s" % episode["id"]
598
+ path = f"data/episodes/{episode['id']}"
606
599
  params = {}
607
600
  if force:
608
601
  params = {"force": True}
@@ -631,7 +624,7 @@ def remove_sequence(
631
624
  has not been provided.
632
625
  """
633
626
  sequence = normalize_model_parameter(sequence)
634
- path = "data/sequences/%s" % sequence["id"]
627
+ path = f"data/sequences/{sequence['id']}"
635
628
  params = {}
636
629
  if force:
637
630
  params = {"force": True}
@@ -650,7 +643,7 @@ def all_asset_instances_for_shot(
650
643
  list: Asset instances linked to given shot.
651
644
  """
652
645
  shot = normalize_model_parameter(shot)
653
- return raw.get("data/shots/%s/asset-instances" % shot["id"], client=client)
646
+ return raw.get(f"data/shots/{shot['id']}/asset-instances", client=client)
654
647
 
655
648
 
656
649
  def add_asset_instance_to_shot(
@@ -669,7 +662,7 @@ def add_asset_instance_to_shot(
669
662
  shot = normalize_model_parameter(shot)
670
663
  asset_instance = normalize_model_parameter(asset_instance)
671
664
  data = {"asset_instance_id": asset_instance["id"]}
672
- path = "data/shots/%s/asset-instances" % shot["id"]
665
+ path = f"data/shots/{shot['id']}/asset-instances"
673
666
  return raw.post(path, data, client=client)
674
667
 
675
668
 
@@ -685,10 +678,7 @@ def remove_asset_instance_from_shot(
685
678
  """
686
679
  shot = normalize_model_parameter(shot)
687
680
  asset_instance = normalize_model_parameter(asset_instance)
688
- path = "data/shots/%s/asset-instances/%s" % (
689
- shot["id"],
690
- asset_instance["id"],
691
- )
681
+ path = f"data/shots/{shot['id']}/asset-instances/{asset_instance['id']}"
692
682
  return raw.delete(path, client=client)
693
683
 
694
684
 
@@ -709,7 +699,7 @@ def import_shots_with_csv(
709
699
  """
710
700
  project = normalize_model_parameter(project)
711
701
  return raw.upload(
712
- "import/csv/projects/%s/shots" % project["id"],
702
+ f"import/csv/projects/{project['id']}/shots",
713
703
  csv_file_path,
714
704
  client=client,
715
705
  )
@@ -746,10 +736,10 @@ def import_otio(
746
736
  else:
747
737
  naming_convention = "${project_name}_${sequence_name}-${shot_name}"
748
738
  project = normalize_model_parameter(project)
749
- path = "/import/otio/projects/%s" % project["id"]
739
+ path = f"/import/otio/projects/{project['id']}"
750
740
  if episode is not None:
751
741
  episode = normalize_model_parameter(episode)
752
- path += "/episodes/%s" % episode["id"]
742
+ path += f"/episodes/{episode['id']}"
753
743
  return raw.upload(
754
744
  path,
755
745
  otio_file_path,
@@ -798,7 +788,7 @@ def export_shots_with_csv(
798
788
  if assigned_to:
799
789
  params["assigned_to"] = assigned_to["id"]
800
790
  return raw.download(
801
- "export/csv/projects/%s/shots.csv" % project["id"],
791
+ f"export/csv/projects/{project['id']}/shots.csv",
802
792
  csv_file_path,
803
793
  params=params,
804
794
  client=client,