add last remaining tweaks

This commit is contained in:
Nathan Page 2021-05-09 15:30:23 -07:00
parent fe87227c55
commit 04f835723f
3 changed files with 7 additions and 5 deletions

View File

@ -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:

View File

@ -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:

View File

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