Skip to content

Commit

Permalink
[BUGFIX] Use Path.is_dir instead of Path.suffix == "" (#919)
Browse files Browse the repository at this point in the history
bug fix

The method of determining whether a path points to a file or a directory by the presence or absence of a file extension has been changed to the method of determining by .is_dir().
  • Loading branch information
strelka145 authored Mar 1, 2023
1 parent c2cb18c commit 98a759e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion anomalib/data/utils/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def generate_output_image_filename(input_path: str | Path, output_path: str | Pa
raise ValueError("input_path is expected to be a file to generate a proper output filename.")

file_path: Path
if output_path.suffix == "":
if output_path.is_dir():
# If the output is a directory, then add parent directory name
# and filename to the path. This is to ensure we do not overwrite
# images and organize based on the categories.
Expand Down

0 comments on commit 98a759e

Please sign in to comment.