Skip to content
This repository was archived by the owner on Oct 10, 2024. It is now read-only.

Commit 223ea37

Browse files
authored
Merge pull request #80 from pypeclub/bugfix/sequences_in_get_repre_path
naive check of sequences in filename during path_from_data
2 parents e487bf0 + 9ca41fc commit 223ea37

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

avalon/pipeline.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,26 @@ def path_from_data():
13401340
if os.path.exists(path):
13411341
return os.path.normpath(path)
13421342

1343+
dir_path, file_name = os.path.split(path)
1344+
if not os.path.exists(dir_path):
1345+
return
1346+
1347+
base_name, ext = os.path.splitext(file_name)
1348+
file_name_items = None
1349+
if "#" in base_name:
1350+
file_name_items = [part for part in base_name.split("#") if part]
1351+
elif "%" in base_name:
1352+
file_name_items = base_name.split("%")
1353+
1354+
if not file_name_items:
1355+
return
1356+
1357+
filename_start = file_name_items[0]
1358+
1359+
for _file in os.listdir(dir_path):
1360+
if _file.startswith(filename_start) and _file.endswith(ext):
1361+
return os.path.normpath(path)
1362+
13431363
return (
13441364
path_from_represenation() or
13451365
path_from_config() or

0 commit comments

Comments
 (0)