Skip to content

Commit bb94647

Browse files
authored
Use is_file instead of is_dir check. (#1156)
1 parent bba77ac commit bb94647

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

webknossos/webknossos/dataset/dataset.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -632,16 +632,16 @@ def from_images(
632632
if use_bioformats is not False:
633633
valid_suffixes.update(pims_images.get_valid_bioformats_suffixes())
634634

635-
if input_upath.is_dir():
635+
if input_upath.is_file():
636+
if input_upath.suffix.lstrip(".").lower() in valid_suffixes:
637+
input_files = [UPath(input_upath.name)]
638+
input_upath = input_upath.parent
639+
else:
636640
input_files = [
637641
i.relative_to(input_upath)
638642
for i in input_upath.glob("**/*")
639643
if i.is_file() and i.suffix.lstrip(".").lower() in valid_suffixes
640644
]
641-
else:
642-
if input_upath.suffix.lstrip(".").lower() in valid_suffixes:
643-
input_files = [UPath(input_upath.name)]
644-
input_upath = input_upath.parent
645645

646646
if len(input_files) == 0:
647647
raise ValueError(

0 commit comments

Comments
 (0)