Skip to content

Commit

Permalink
Do not remove default arg groups from group map
Browse files Browse the repository at this point in the history
The default names change across versions (e.g. 'optional arguments'
changes to 'options' in py311), adding a maintenance burden to keep
this. And there's no obvious benefit to keeping it.
  • Loading branch information
pvandyken committed Apr 17, 2024
1 parent 421e8a3 commit ebb7df4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions snakebids/bidsapp/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,7 @@ def build_parser(self):
if not self._parser_built:
self.pm.hook.initialize_config(config=self.config)
for group in self.parser._action_groups: # noqa: SLF001
if group.title is not None and group.title not in {
"positional arguments",
"optional arguments",
}:
if group.title is not None:
self.argument_groups[group.title] = group
self.pm.hook.add_cli_arguments(
parser=self.parser,
Expand Down
4 changes: 2 additions & 2 deletions snakebids/tests/test_bidsapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def add_cli_arguments(
assert len(config) == 1
assert config["initialized"]
assert len(parser._actions) == 1
assert not argument_groups
assert len(argument_groups) == 2
config["added_args"] = True
parser.add_argument("arg_one")
parser.add_argument("--arg-two")
Expand Down Expand Up @@ -192,5 +192,5 @@ def test_argument_groups_visible_to_add_arg_hook(self):
app.parser.add_argument_group("foo")
app.run()
assert self.group_names
assert set(self.group_names) == {"foo", "new"}
assert set(self.group_names).issuperset({"foo", "new"})
assert app.argument_groups["new"].title == "new"

0 comments on commit ebb7df4

Please sign in to comment.