(
parser: argparse.ArgumentParser,
quiet: bool,
really_quiet: bool,
warnfile: str | None,
)
| 331 | |
| 332 | |
| 333 | def _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 | |
| 364 | def _parse_confoverrides( |
no test coverage detected
searching dependent graphs…