Skip to content

Commit

Permalink
Refactor file name handling for better clarity and consistency.
Browse files Browse the repository at this point in the history
- Refactored variable names for improved readability
- Updated logic to handle file name patterns consistently
  • Loading branch information
jakubjezek001 committed Sep 26, 2024
1 parent 651d54b commit 52d59ed
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/ayon_traypublisher/plugins/create/create_csv_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,12 +644,12 @@ def _add_representation(
# convert ### string in file name to %03d
# this is for correct frame range validation
# example: file.###.exr -> file.%03d.exr
file_name = basename.split(".")[0]
file_head = basename.split(".")[0]
if "#" in basename:
padding = len(basename.split("#")) - 1
seq_padding = f"%0{padding}d"
basename = basename.replace("#" * padding, seq_padding)
file_name = basename.split(seq_padding)[0]
file_head = basename.split(seq_padding)[0]
is_sequence = True
if "%" in basename:
pattern = re.compile(r"%\d+d|%d")
Expand All @@ -658,7 +658,7 @@ def _add_representation(
raise CreatorError(
f"File sequence padding not found in '{basename}'."
)
file_name = basename.split("%")[0]
file_head = basename.split("%")[0]
is_sequence = True

# make absolute path to file
Expand All @@ -677,7 +677,7 @@ def _add_representation(
# get only filtered files form dirname
files_from_dir = [
file for file in os.listdir(dirname)
if file_name in file
if file_head in file
]
# collect all data from dirname
cols, _ = clique.assemble(files_from_dir)
Expand Down

0 comments on commit 52d59ed

Please sign in to comment.