diff --git a/rich/control.py b/rich/control.py index 5f40c18d..0a13b8ac 100644 --- a/rich/control.py +++ b/rich/control.py @@ -157,7 +157,9 @@ class Control: yield self.segment -def strip_control_codes(text: str, _translate_table: Any = _CONTROL_TRANSLATE) -> str: +def strip_control_codes( + text: str, _translate_table: Dict[int, None] = _CONTROL_TRANSLATE +) -> str: """Remove control codes from text. Args: diff --git a/rich/markdown.py b/rich/markdown.py index 97aa8f0e..ec365692 100644 --- a/rich/markdown.py +++ b/rich/markdown.py @@ -108,7 +108,7 @@ class Paragraph(TextElement): justify: JustifyMethod @classmethod - def create(cls, markdown: "Markdown", node: Any) -> "Paragraph": + def create(cls, markdown: "Markdown", node: MarkdownElement) -> "Paragraph": return cls(justify=markdown.justify or "left") def __init__(self, justify: JustifyMethod) -> None: diff --git a/rich/traceback.py b/rich/traceback.py index 829eea02..4861ac0e 100644 --- a/rich/traceback.py +++ b/rich/traceback.py @@ -47,7 +47,7 @@ def install( word_wrap: bool = False, show_locals: bool = False, indent_guides: bool = True, -) -> Callable[..., Any]: +) -> Callable[[Type[BaseException], BaseException, Optional[TracebackType]], Any]: """Install a rich traceback handler. Once installed, any tracebacks will be printed with syntax highlighting and rich formatting. @@ -133,12 +133,12 @@ def install( # if wihin ipython, use customized traceback ip = get_ipython() # type: ignore ipy_excepthook_closure(ip) - return sys.excepthook + return sys.excepthook # type: ignore # more strict signature that mypy cant interpret except Exception: # otherwise use default system hook old_excepthook = sys.excepthook sys.excepthook = excepthook - return old_excepthook + return old_excepthook # type: ignore # more strict signature that mypy cant interpret @dataclass