mirror of https://github.com/Textualize/rich.git
fix mypy
This commit is contained in:
parent
18cccde154
commit
ca7d0e695c
|
@ -1078,6 +1078,9 @@ class Text(JupyterMixin):
|
|||
break
|
||||
start_line_no = (lower_bound + upper_bound) // 2
|
||||
|
||||
if span_end < line_end:
|
||||
end_line_no = start_line_no
|
||||
else:
|
||||
end_line_no = lower_bound = start_line_no
|
||||
upper_bound = line_count
|
||||
|
||||
|
|
|
@ -138,12 +138,12 @@ def install(
|
|||
# if wihin ipython, use customized traceback
|
||||
ip = get_ipython() # type: ignore
|
||||
ipy_excepthook_closure(ip)
|
||||
return sys.excepthook # type: ignore # more strict signature that mypy can't interpret
|
||||
return sys.excepthook
|
||||
except Exception:
|
||||
# otherwise use default system hook
|
||||
old_excepthook = sys.excepthook
|
||||
sys.excepthook = excepthook
|
||||
return old_excepthook # type: ignore # more strict signature that mypy can't interpret
|
||||
return old_excepthook
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -246,6 +246,9 @@ class Traceback:
|
|||
self.suppress: Sequence[str] = []
|
||||
for suppress_entity in suppress:
|
||||
if not isinstance(suppress_entity, str):
|
||||
assert (
|
||||
suppress_entity.__file__ is not None
|
||||
), f"{suppress_entity!r} must be a module with '__file__' attribute"
|
||||
path = os.path.dirname(suppress_entity.__file__)
|
||||
else:
|
||||
path = suppress_entity
|
||||
|
|
Loading…
Reference in New Issue