MCPcopy Index your code
hub / github.com/treeverse/dvc / command_tuples

Function command_tuples

tests/unit/command/test_help.py:13–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11
12
13def command_tuples():
14 root: tuple[str, ...] = ()
15 commands = [root]
16
17 def recurse_parser(parser: ArgumentParser, parents: tuple[str, ...] = root) -> None:
18 for positional in parser._get_positional_actions():
19 if positional.help != SUPPRESS and isinstance(positional.choices, dict):
20 public_cmds = shtab.get_public_subcommands(positional)
21 for subcmd, subparser in positional.choices.items():
22 cmd = (*parents, subcmd)
23 if subcmd in public_cmds:
24 commands.append(cmd)
25 recurse_parser(subparser, cmd)
26
27 main_parser = get_main_parser()
28 recurse_parser(main_parser)
29
30 # the no. of commands will usually go up,
31 # but if we ever remove commands and drop below, adjust the magic number accordingly
32 assert len(commands) >= 116
33 return sorted(commands)
34
35
36def ids(values):

Callers

nothing calls this directly

Calls 2

get_main_parserFunction · 0.90
recurse_parserFunction · 0.85

Tested by

no test coverage detected