-
-
Notifications
You must be signed in to change notification settings - Fork 66
Closed
Description
Discussed in #402
Originally posted by Moosems June 30, 2024
I want to have beartype print out the proper type annotation for a variable because I can't seem to do it right myself. Example:
from beartype.typing import Callable
from pygments.lexers import PythonLexer
from pygments.lexer import RegexLexer
from pygments.token import _TokenType
lexer: RegexLexer = PythonLexer()
root_tokens: list[str] | list[tuple[str, _TokenType | Callable, str]] = (
lexer.tokens["root"]
)
print(root_tokens)Now try using beartype_this_package with that. I could just use type list and call it a day but that just feels wrong. The thing is this list can be different depending on what Lexer I use and theres so many possible subtle variations possible and I don't have the time to write that all out when the logic I use to deal with that list works anyway.
leycec
Metadata
Metadata
Assignees
Labels
No labels