MCPcopy Create free account
hub / github.com/NVIDIA/SkillEvaluator / curated

Function curated

scripts/script_invocation_differential.py:296–736  ·  view source on GitHub ↗

Command shapes chosen deliberately, each paired with its expected script.

()

Source from the content-addressed store, hash-verified

294
295
296def curated() -> list[tuple[str, str]]:
297 """Command shapes chosen deliberately, each paired with its expected script."""
298 cases: list[tuple[str, str]] = []
299
300 def add(command: str, script: str = "run.py") -> None:
301 cases.append((command, script))
302
303 for form in INTERPRETER_FORMS:
304 add(f"{PY} {form}{SCRIPT}")
305 for wrapper in WRAPPER_FORMS:
306 add(f"{wrapper}{PY} {SCRIPT}")
307 for verb in NON_EXECUTING_VERBS:
308 add(f"{verb} {SCRIPT}")
309 add(f"{verb} {SCRIPT} && {PY} {SCRIPT}")
310 for verb in TWO_ARGUMENT_VERBS:
311 add(f"{verb} {SCRIPT} copy.py")
312 add(f"{verb} {SCRIPT} copy.py && {PY} {SCRIPT}")
313 for prefix in PREFIX_FORMS:
314 target = "run.py" if prefix.startswith(("cd ", "(cd ")) else SCRIPT
315 closing = ")" if prefix.startswith("(") else ""
316 add(f"{prefix}{PY} {target}{closing}")
317 for suffix in SUFFIX_FORMS:
318 add(f"{PY} {SCRIPT}{suffix}")
319
320 # identity: a name that merely contains the expected one is a different file
321 add(f"{PY} skills/demo/run.py.bak", "run.py")
322 add(f"{PY} skills/demo/rerun.py", "run.py")
323 add(f"{PY} skills/demo/other.py skills/demo/run.py", "run.py")
324
325 # other interpreters, and options belonging to a different one
326 for interpreter, script in (
327 ("perl", "skills/demo/run.pl"),
328 ("ruby", "skills/demo/run.rb"),
329 ("node", "skills/demo/run.js"),
330 ("bash", "skills/demo/run.sh"),
331 ("sh", "skills/demo/run.sh"),
332 ):
333 name = script.rsplit("/", 1)[-1]
334 for option in (
335 "",
336 "-w ",
337 "-c ",
338 "-e 'x' ",
339 "--help ",
340 "--version ",
341 "--check ",
342 "--require ./lib.js ",
343 "-I lib ",
344 "-Mstrict ",
345 "-Wignore ",
346 ):
347 add(f"{interpreter} {option}{script}", name)
348
349 # nested shells, sourcing and grouping
350 add(f"sh -c '{PY} {SCRIPT}'")
351 add(f'bash -c "{PY} {SCRIPT}"')
352 add(f"sh -c 'cat {SCRIPT}'")
353 add(f"bash -xc '{PY} {SCRIPT}'")

Callers 1

mainFunction · 0.85

Calls 4

refusal_unitsFunction · 0.85
addFunction · 0.70
_heredocsFunction · 0.70
formatMethod · 0.45

Tested by

no test coverage detected