MCPcopy Create free account
hub / github.com/apple/axlearn / _insert_flags

Function _insert_flags

axlearn/cli/utils.py:272–276  ·  view source on GitHub ↗

Insert a sequence of --flag=value into argv, ensuring they are inserted before `--`.

(argv: list[str], flags: list[str])

Source from the content-addressed store, hash-verified

270
271
272def _insert_flags(argv: list[str], flags: list[str]) -> list[str]:
273 """Insert a sequence of --flag=value into argv, ensuring they are inserted before `--`."""
274 assert len(argv) > 0 and not argv[0].startswith("--"), "argv[0] should contain the program name"
275 i = len(_flags(argv))
276 return argv[0:i] + flags + argv[i:]
277
278
279def get_path(d: dict[str, Any], k: str, default: Optional[Any] = None) -> Optional[Any]:

Callers 5

test_insert_flagsMethod · 0.90
absl_mainFunction · 0.85
add_cmd_from_moduleMethod · 0.85
parse_known_argsMethod · 0.85

Calls 1

_flagsFunction · 0.85

Tested by 2

test_insert_flagsMethod · 0.72