From fc22c926d65530d12c8605e3453c58b642816a2d Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 1 Sep 2023 09:14:06 -0400 Subject: [PATCH 1/2] ENH: flake8 - use kwarg maxsplit in re.split --- heudiconv/heuristics/reproin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/heudiconv/heuristics/reproin.py b/heudiconv/heuristics/reproin.py index 8499f14b..8597cdbf 100644 --- a/heudiconv/heuristics/reproin.py +++ b/heudiconv/heuristics/reproin.py @@ -742,9 +742,9 @@ def infotoids(seqinfos: Iterable[SeqInfo], outdir: str) -> dict[str, Optional[st # TODO: fix up subject id if missing some 0s if study_description: # Generally it is a ^ but if entered manually, ppl place space in it - split = re.split("[ ^]", study_description, 1) - # split first one even more, since couldbe PI_Student or PI-Student - split = re.split("-|_", split[0], 1) + split[1:] + split = re.split("[ ^]", study_description, maxsplit=1) + # split first one even more, since could be PI_Student or PI-Student + split = re.split("-|_", split[0], maxsplit=1) + split[1:] # locator = study_description.replace('^', '/') locator = "/".join(split) From 1215a2cc0279b750011b32a2c64cf355e5a97333 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 1 Sep 2023 10:14:35 -0400 Subject: [PATCH 2/2] ENH: just followed some linting suggestion here --- heudiconv/heuristics/reproin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heudiconv/heuristics/reproin.py b/heudiconv/heuristics/reproin.py index 8597cdbf..5ddde1be 100644 --- a/heudiconv/heuristics/reproin.py +++ b/heudiconv/heuristics/reproin.py @@ -744,7 +744,7 @@ def infotoids(seqinfos: Iterable[SeqInfo], outdir: str) -> dict[str, Optional[st # Generally it is a ^ but if entered manually, ppl place space in it split = re.split("[ ^]", study_description, maxsplit=1) # split first one even more, since could be PI_Student or PI-Student - split = re.split("-|_", split[0], maxsplit=1) + split[1:] + split = re.split("[-_]", split[0], maxsplit=1) + split[1:] # locator = study_description.replace('^', '/') locator = "/".join(split)