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

Method __init__

mypy/util.py:612–638  ·  view source on GitHub ↗
(
        self, f_out: IO[str], f_err: IO[str], hide_error_codes: bool, hide_success: bool = False
    )

Source from the content-addressed store, hash-verified

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"""

Callers

nothing calls this directly

Calls 5

initialize_win_colorsMethod · 0.95
should_force_colorFunction · 0.85
isattyMethod · 0.80

Tested by

no test coverage detected