Remove ANSI codes from rich tracebacks #3348
-
Hello! As in the title; when using from rich.traceback import install
install(show_locals=True)
from beartype.door import die_if_unbearable
from typing import Literal
die_if_unbearable(1, Literal[0]) I'm getting the following: ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <module>:1 │
│ ╭──────────────────────────────── locals ────────────────────────────────╮ │
│ │ die_if_unbearable = <function die_if_unbearable at 0x000001EF5F47CB80> │ │
│ │ install = <function install at 0x000001EF5CFC6A20> │ │
│ │ Literal = typing.Literal │ │
│ ╰────────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\jeetr\anaconda3\Lib\site-packages\beartype\door\_doorcheck.py:101 in die_if_unbearable │
│ │
│ 98 │ │
│ 99 │ # Either raise an exception or emit a warning only if the passed object │
│ 100 │ # violates this hint. │
│ ❱ 101 │ func_raiser(obj) # pyright: ignore[reportUnboundVariable] │
│ 102 │
│ 103 # ....................{ TESTERS }.................... │
│ 104 def is_subhint(subhint: object, superhint: object) -> bool: │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ conf = BeartypeConf() │ │
│ │ func_raiser = <function __beartype_tester_0 at 0x000001EF5F494E00> │ │
│ │ hint = typing.Literal[0] │ │
│ │ obj = 1 │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ in __beartype_tester_0:23 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
BeartypeDoorHintViolation: Object violates type hint [1m[34mtyping.Literal[0][0m, as [1m[31mint[0m [33m1[0m != 0. How can I remove the ANSI codes in the error message while keeping the color for default types? I seem to have lost the |
Beta Was this translation helpful? Give feedback.
Answered by
TomJGooding
Apr 29, 2024
Replies: 1 comment 3 replies
-
This doesn't directly answer the question, but in this case might it be simpler to configure |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not a
beartype
user, but from a quick search of their docs: https://beartype.readthedocs.io/en/latest/api_decor/#beartype.BeartypeConf.is_color