Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
improving code readability
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubjezek001 committed Nov 21, 2023
1 parent e6c0504 commit 166bfb2
Showing 1 changed file with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,17 @@ def process(self, instance):

# Create thumbnail components
for repre in thumbnail_representations:
repre_path = get_publish_repre_path(instance, repre, False)
# get repre path from representation
# and return published_path if available
# the path is validated and if it does not exists it returns None
repre_path = get_publish_repre_path(
instance,
repre,
only_published=False
)
if not repre_path:
self.log.warning(
"Published path is not set and source was removed."
"Published path is not set or source was removed."
)
continue

Expand All @@ -199,26 +206,26 @@ def process(self, instance):
"component_location_name": ftrack_server_location_name
})

# add thumbnail to items data for future synchronization
current_item = {
# add thumbnail data to items for future synchronization
current_item_data = {
"sync_key": repre.get("outputName"),
"representation": repre,
"item": thumbnail_item
}
# Create copy of item before setting location
if "delete" not in repre.get("tags", []):
src_comp = self._create_src_components(
src_comp = self._create_src_component(
instance,
repre,
copy.deepcopy(thumbnail_item),
unmanaged_location_name
)
component_list.append(src_comp)

current_item["src_component"] = src_comp
current_item_data["src_component"] = src_comp

# Add item to component list
thumbnail_data_items.append(current_item)
thumbnail_data_items.append(current_item_data)

# Create review components
# Change asset name of each new component for review
Expand Down Expand Up @@ -249,7 +256,8 @@ def process(self, instance):
)
if sync_thumbnail_data:
sync_thumbnail_item = sync_thumbnail_data.get("item")
sync_thumbnail_item_src = sync_thumbnail_data.get("src_component")
sync_thumbnail_item_src = sync_thumbnail_data.get(
"src_component")

"""
Renaming asset name only to those components which are explicitly
Expand Down Expand Up @@ -305,7 +313,7 @@ def process(self, instance):

# Create copy of item before setting location
if "delete" not in repre.get("tags", []):
src_comp = self._create_src_components(
src_comp = self._create_src_component(
instance,
repre,
copy.deepcopy(review_item),
Expand Down Expand Up @@ -455,7 +463,7 @@ def _make_extended_component_name(
(asset_name, repre["name"])
)

def _create_src_components(
def _create_src_component(
self, instance, repre, component_item, location):
"""Create src component for thumbnail.
Expand Down

0 comments on commit 166bfb2

Please sign in to comment.