MCPcopy
hub / github.com/psf/black / get_flags_parser

Function get_flags_parser

tests/util.py:236–278  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

234
235@functools.lru_cache
236def get_flags_parser() -> argparse.ArgumentParser:
237 parser = argparse.ArgumentParser()
238 parser.add_argument(
239 "--target-version",
240 action="store",
241 type=lambda val: (TargetVersion[val.upper()],),
242 default=(),
243 )
244 parser.add_argument("--line-length", default=DEFAULT_LINE_LENGTH, type=int)
245 parser.add_argument(
246 "--skip-string-normalization", default=False, action="store_true"
247 )
248 parser.add_argument("--pyi", default=False, action="store_true")
249 parser.add_argument("--ipynb", default=False, action="store_true")
250 parser.add_argument(
251 "--skip-magic-trailing-comma", default=False, action="store_true"
252 )
253 parser.add_argument("--preview", default=False, action="store_true")
254 parser.add_argument("--unstable", default=False, action="store_true")
255 parser.add_argument("--fast", default=False, action="store_true")
256 parser.add_argument(
257 "--minimum-version",
258 type=_parse_minimum_version,
259 default=None,
260 help=(
261 "Minimum version of Python where this test case is parseable. If this is"
262 " set, the test case will be run twice: once without the specified"
263 " --target-version, and once with --target-version set to exactly the"
264 " specified version. This ensures that Black's autodetection of the target"
265 " version works correctly."
266 ),
267 )
268 parser.add_argument("--line-ranges", action="append")
269 parser.add_argument(
270 "--no-preview-line-length-1",
271 default=False,
272 action="store_true",
273 help=(
274 "Don't run in preview mode with --line-length=1, as that's known to cause a"
275 " crash"
276 ),
277 )
278 return parser
279
280
281def parse_mode(flags_line: str) -> TestCaseArgs:

Callers 1

parse_modeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected