MCPcopy
hub / github.com/sphinx-doc/sphinx / _parse_logging

Function _parse_logging

sphinx/cmd/build.py:333–361  ·  view source on GitHub ↗
(
    parser: argparse.ArgumentParser,
    quiet: bool,
    really_quiet: bool,
    warnfile: str | None,
)

Source from the content-addressed store, hash-verified

331
332
333def _parse_logging(
334 parser: argparse.ArgumentParser,
335 quiet: bool,
336 really_quiet: bool,
337 warnfile: str | None,
338) -> tuple[TextIO | None, TextIO | None, TextIO, TextIO | None]:
339 status: TextIO | None = sys.stdout
340 warning: TextIO | None = sys.stderr
341 error = sys.stderr
342
343 if quiet:
344 status = None
345
346 if really_quiet:
347 status = warning = None
348
349 warnfp = None
350 if warning and warnfile:
351 try:
352 warn_file = Path(warnfile).resolve()
353 ensuredir(warn_file.parent)
354 # the caller is responsible for closing this file descriptor
355 warnfp = open(warn_file, 'w', encoding='utf-8') # NoQA: SIM115
356 except Exception as exc:
357 parser.error(__("cannot open warning file '%s': %s") % (warn_file, exc))
358 warning = TeeStripANSI(warning, warnfp) # type: ignore[assignment]
359 error = warning
360
361 return status, warning, error, warnfp # ty: ignore[invalid-return-type]
362
363
364def _parse_confoverrides(

Callers 1

build_mainFunction · 0.85

Calls 4

ensuredirFunction · 0.90
TeeStripANSIClass · 0.90
resolveMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…