Skip to content

Commit

Permalink
added a simple check
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthakpati committed May 22, 2023
1 parent a5ea57a commit f2787c6
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions GANDLF/utils/write_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,14 @@ def convert_relative_paths_in_dataframe(input_dataframe, headers, path_root):
if (loc == headers["labelHeader"]) or (loc in headers["channelHeaders"]):
# These entries can be considered as paths to files
for index, entry in enumerate(input_dataframe[column]):
this_path = pathlib.Path(entry)
start_path = pathlib.Path(path_root)
if start_path.is_file():
start_path = start_path.parent
if not this_path.is_file():
if not this_path.is_absolute():
input_dataframe.loc[index, column] = str(
start_path.joinpath(this_path)
)
if isinstance(entry, str):
this_path = pathlib.Path(entry)
start_path = pathlib.Path(path_root)
if start_path.is_file():
start_path = start_path.parent
if not this_path.is_file():
if not this_path.is_absolute():
input_dataframe.loc[index, column] = str(

Check warning on line 210 in GANDLF/utils/write_parse.py

View check run for this annotation

Codecov / codecov/patch

GANDLF/utils/write_parse.py#L209-L210

Added lines #L209 - L210 were not covered by tests
start_path.joinpath(this_path)
)
return input_dataframe

0 comments on commit f2787c6

Please sign in to comment.