MCPcopy Index your code
hub / github.com/python/mypy / parse_script

Function parse_script

mypy/test/testdaemon.py:58–76  ·  view source on GitHub ↗

Parse testcase.input into steps. Each command starts with a line starting with '$'. The first line (less '$') is sent to the shell. The remaining lines are expected output.

(input: list[str])

Source from the content-addressed store, hash-verified

56
57
58def parse_script(input: list[str]) -> list[list[str]]:
59 """Parse testcase.input into steps.
60
61 Each command starts with a line starting with '$'.
62 The first line (less '$') is sent to the shell.
63 The remaining lines are expected output.
64 """
65 steps = []
66 step: list[str] = []
67 for line in input:
68 if line.startswith("$"):
69 if step:
70 assert step[0].startswith("$")
71 steps.append(step)
72 step = []
73 step.append(line)
74 if step:
75 steps.append(step)
76 return steps
77
78
79def run_cmd(input: str) -> tuple[int, str]:

Callers 1

test_daemonFunction · 0.85

Calls 2

appendMethod · 0.80
startswithMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…