Skip to content

Commit ee724fa

Browse files
committed
Fix upload annotations
1 parent ccb9cc7 commit ee724fa

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

src/superannotate/lib/app/helpers.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,22 @@ def get_annotation_paths(folder_path, s3_bucket=None, recursive=False):
4848
def get_local_annotation_paths(
4949
folder_path: Union[str, Path], annotation_paths: set, recursive: bool
5050
) -> List[str]:
51-
for path in Path(folder_path).glob("*"):
52-
if recursive and path.is_dir():
53-
get_local_annotation_paths(path, annotation_paths, recursive)
54-
else:
55-
if (
56-
path.name.endswith(VECTOR_ANNOTATION_POSTFIX)
57-
or path.name.endswith(PIXEL_ANNOTATION_POSTFIX)
58-
):
59-
annotation_paths.add(str(path))
51+
all_items = [*Path(folder_path).glob("*")]
52+
all_folders = [i for i in all_items if i.is_dir()]
53+
annotation_paths.update(
54+
[
55+
str(i)
56+
for i in all_items
57+
if i.name.endswith((VECTOR_ANNOTATION_POSTFIX, PIXEL_ANNOTATION_POSTFIX))
58+
]
59+
)
60+
if recursive:
61+
for folder in all_folders:
62+
get_local_annotation_paths(
63+
folder_path=folder,
64+
annotation_paths=annotation_paths,
65+
recursive=recursive,
66+
)
6067
return list(annotation_paths)
6168

6269

0 commit comments

Comments
 (0)