From 97e046a83988393db99e17184fc52250b85d1f3d Mon Sep 17 00:00:00 2001 From: Evan Blaudy Date: Thu, 10 Oct 2024 15:12:48 +0200 Subject: [PATCH] [qa] black --- gazu/casting.py | 5 ++++- gazu/playlist.py | 32 ++++++++++------------------- tests/test_casting.py | 4 +++- tests/test_playlist.py | 46 +++++++++++++++++++++++++----------------- 4 files changed, 45 insertions(+), 42 deletions(-) diff --git a/gazu/casting.py b/gazu/casting.py index d5a855c1..c4a5033f 100644 --- a/gazu/casting.py +++ b/gazu/casting.py @@ -60,7 +60,10 @@ def update_episode_casting(project, episode, casting, client=default): """ episode = normalize_model_parameter(episode) project = normalize_model_parameter(project) - path = "data/projects/%s/entities/%s/casting" % (project["id"], episode["id"]) + path = "data/projects/%s/entities/%s/casting" % ( + project["id"], + episode["id"], + ) return raw.put(path, casting, client=client) diff --git a/gazu/playlist.py b/gazu/playlist.py index 8677eacc..03ae0cb8 100644 --- a/gazu/playlist.py +++ b/gazu/playlist.py @@ -166,16 +166,12 @@ def get_entity_preview_files(entity, client=default): entity = normalize_model_parameter(entity) return raw.get( "data/playlists/entities/%s/preview-files" % entity["id"], - client=client + client=client, ) def add_entity_to_playlist( - playlist, - entity, - preview_file=None, - persist=True, - client=default + playlist, entity, preview_file=None, persist=True, client=default ): """ Add an entity to the playlist, use the last uploaded preview as revision @@ -197,25 +193,23 @@ def add_entity_to_playlist( for task_type_id in preview_files.keys(): task_type_files = preview_files[task_type_id] first_file = task_type_files[0] - if preview_file is None or \ - preview_file["created_at"] < first_file["created_at"]: + if ( + preview_file is None + or preview_file["created_at"] < first_file["created_at"] + ): preview_file = first_file preview_file = normalize_model_parameter(preview_file) - playlist["shots"].append({ - "entity_id": entity["id"], - "preview_file_id": preview_file["id"] - }) + playlist["shots"].append( + {"entity_id": entity["id"], "preview_file_id": preview_file["id"]} + ) if persist: update_playlist(playlist, client=client) return playlist def remove_entity_from_playlist( - playlist, - entity, - persist=True, - client=default + playlist, entity, persist=True, client=default ): """ Remove all occurences of a given entity from a playlist. @@ -239,11 +233,7 @@ def remove_entity_from_playlist( def update_entity_preview( - playlist, - entity, - preview_file, - persist=True, - client=default + playlist, entity, preview_file, persist=True, client=default ): """ Remove all occurences of a given entity from a playlist. diff --git a/tests/test_casting.py b/tests/test_casting.py index ddc35778..72a0c99e 100644 --- a/tests/test_casting.py +++ b/tests/test_casting.py @@ -47,7 +47,9 @@ def test_update_episode_casting(self): mock.put(gazu.client.get_full_url(path), text=json.dumps(casting)) episode = {"id": fakeid("episode-01")} project = {"id": fakeid("project-01")} - casting = gazu.casting.update_episode_casting(project, episode, casting) + casting = gazu.casting.update_episode_casting( + project, episode, casting + ) self.assertEqual(casting[0]["asset_id"], fakeid("asset-1")) def test_get_asset_type_casting(self): diff --git a/tests/test_playlist.py b/tests/test_playlist.py index 7b02b31c..7f5a6fc9 100644 --- a/tests/test_playlist.py +++ b/tests/test_playlist.py @@ -179,7 +179,8 @@ def test_add_entity_to_playlist(self): ) mock.get( gazu.client.get_full_url( - "data/playlists/entities/%s/preview-files" % fakeid("shot-1") + "data/playlists/entities/%s/preview-files" + % fakeid("shot-1") ), text=json.dumps( {fakeid("task-type-1"): [{"id": fakeid("preview-1")}]} @@ -188,26 +189,33 @@ def test_add_entity_to_playlist(self): playlist = { "id": fakeid("playlist-1"), "name": "name_changed", - "shots": [] - } - shot = { - "id": fakeid("shot-1"), - "name": "SH01" + "shots": [], } + shot = {"id": fakeid("shot-1"), "name": "SH01"} playlist = gazu.playlist.add_entity_to_playlist(playlist, shot) self.assertEqual(playlist["id"], fakeid("playlist-1")) - self.assertEqual(playlist["shots"], [{ - "entity_id": fakeid("shot-1"), - "preview_file_id": fakeid("preview-1") - }]) + self.assertEqual( + playlist["shots"], + [ + { + "entity_id": fakeid("shot-1"), + "preview_file_id": fakeid("preview-1"), + } + ], + ) playlist = gazu.playlist.update_entity_preview( - playlist, - shot, - fakeid("preview-2") - ) - self.assertEqual(playlist["shots"], [{ - "entity_id": fakeid("shot-1"), - "preview_file_id": fakeid("preview-2") - }]) - playlist = gazu.playlist.remove_entity_from_playlist(playlist, shot) + playlist, shot, fakeid("preview-2") + ) + self.assertEqual( + playlist["shots"], + [ + { + "entity_id": fakeid("shot-1"), + "preview_file_id": fakeid("preview-2"), + } + ], + ) + playlist = gazu.playlist.remove_entity_from_playlist( + playlist, shot + ) self.assertEqual(playlist["shots"], [])