Skip to content

Commit

Permalink
revise according to the comments
Browse files Browse the repository at this point in the history
Signed-off-by: Wenqi Li <[email protected]>
  • Loading branch information
wyli committed Mar 10, 2022
1 parent 81fabd3 commit c89e3a2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions monai/bundle/config_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ def split_path_id(cls, src: str) -> Tuple[str, str]:
src: source string to split.
"""
result = re.compile(cls.suffix_match, re.IGNORECASE).findall(src)
if len(result) != 1:
result = re.compile(rf"(.*{cls.suffix_match}(?=(?:{cls.sep}.*)|$))", re.IGNORECASE).findall(src)
if not result:
return "", src # the src is a pure id
items = src.split(result[0])
# return file path and the
return items[0] + result[0], items[1][len(cls.sep) :] if items[1] != "" else ""
path_name = result[0][0] # at most one path_name
_, ids = src.rsplit(path_name, 1)
return path_name, ids[len(cls.sep) :] if ids.startswith(cls.sep) else ""

def read_meta(self, f: Union[PathLike, Sequence[PathLike], Dict], **kwargs):
"""
Expand Down

0 comments on commit c89e3a2

Please sign in to comment.