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

Function parse_args

mypy/test/testcmdline.py:124–138  ·  view source on GitHub ↗

Parse the first line of the program for the command line. This should have the form # cmd: mypy For example: # cmd: mypy pkg/

(line: str)

Source from the content-addressed store, hash-verified

122
123
124def parse_args(line: str) -> list[str]:
125 """Parse the first line of the program for the command line.
126
127 This should have the form
128
129 # cmd: mypy <options>
130
131 For example:
132
133 # cmd: mypy pkg/
134 """
135 m = re.match("# cmd: mypy (.*)$", line)
136 if not m:
137 return [] # No args; mypy will spit out an error.
138 return m.group(1).split()
139
140
141def parse_cwd(line: str) -> str | None:

Callers 1

test_python_cmdlineFunction · 0.85

Calls 2

splitMethod · 0.80
groupMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…