Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
KotlinIsland committed Sep 8, 2024
1 parent 9d0cc1f commit 56f27c8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/basedtyping/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,9 @@ def eval_type_based(
*,
string_literals: bool,
) -> object:
"""
Like `typing._eval_type`, but lets older Python versions use newer typing features.
Specifically, this transforms `X | Y` into `typing.Union[X, Y]`
and `list[X]` into `typing.List[X]` etc. (for all the types made generic in PEP 585)
if the original syntax is not supported in the current Python version.
"""Like `typing._eval_type`, but supports based typing features.
Specifically, this transforms `1 | 2` into `typing.Union[Literal[1], Literal[2]]`
and `(int) -> str` into `typing.Callable[[int], str]` etc.
"""
tree: ast.AST
try:
Expand Down

0 comments on commit 56f27c8

Please sign in to comment.