(
self, f_out: IO[str], f_err: IO[str], hide_error_codes: bool, hide_success: bool = False
)
| 610 | """ |
| 611 | |
| 612 | def __init__( |
| 613 | self, f_out: IO[str], f_err: IO[str], hide_error_codes: bool, hide_success: bool = False |
| 614 | ) -> None: |
| 615 | self.hide_error_codes = hide_error_codes |
| 616 | self.hide_success = hide_success |
| 617 | |
| 618 | # Check if we are in a human-facing terminal on a supported platform. |
| 619 | if sys.platform not in ("linux", "darwin", "win32", "emscripten"): |
| 620 | self.dummy_term = True |
| 621 | return |
| 622 | if not should_force_color() and (not f_out.isatty() or not f_err.isatty()): |
| 623 | self.dummy_term = True |
| 624 | return |
| 625 | if sys.platform == "win32": |
| 626 | self.dummy_term = not self.initialize_win_colors() |
| 627 | elif sys.platform == "emscripten": |
| 628 | self.dummy_term = not self.initialize_vt100_colors() |
| 629 | else: |
| 630 | self.dummy_term = not self.initialize_unix_colors() |
| 631 | if not self.dummy_term: |
| 632 | self.colors = { |
| 633 | "red": self.RED, |
| 634 | "green": self.GREEN, |
| 635 | "blue": self.BLUE, |
| 636 | "yellow": self.YELLOW, |
| 637 | "none": "", |
| 638 | } |
| 639 | |
| 640 | def initialize_vt100_colors(self) -> bool: |
| 641 | """Return True if initialization was successful and we can use colors, False otherwise""" |
nothing calls this directly
no test coverage detected