Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
KotlinIsland committed Sep 5, 2024
1 parent aeef2fc commit 61b6665
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
25 changes: 24 additions & 1 deletion src/basedtyping/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,30 @@ def __init__(self, arg: str, *, is_argument=True, module: object = None, is_clas
self.__forward_is_class__ = is_class
self.__forward_module__ = module

if sys.version_info >= (3, 9):
if sys.version_info >= (3, 13):
@typing.overload
def _evaluate(
self, globalns: dict[str, object] | None, localns: dict[str, object] | None, *, recursive_guard: frozenset[str]
) -> object | None: ...
@typing.overload
def _evaluate(
self,
globalns: dict[str, object] | None,
localns: dict[str, object] | None,
type_params: tuple[TypeVar | typing.ParamSpec | typing.TypeVarTuple, ...],
*,
recursive_guard: frozenset[str],
) -> object | None: ...
elif sys.version_info >= (3, 12):
def _evaluate(
self,
globalns: dict[str, object] | None,
localns: dict[str, object] | None,
type_params: tuple[TypeVar | typing.ParamSpec | typing.TypeVarTuple, ...] | None = None,
*,
recursive_guard: frozenset[str],
) -> object | None: ...
elif sys.version_info >= (3, 9):
def _evaluate(
self, globalns: dict[str, object] | None, localns: dict[str, object] | None, recursive_guard: frozenset[str]
) -> object | None:
Expand Down
9 changes: 3 additions & 6 deletions src/basedtyping/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,9 @@ def visit_Subscript(self, node: ast.Subscript) -> ast.AST:
else:
slice_ = node.slice
if isinstance(slice_, ast.Tuple):
if sys.version_info < (3, 12):
temp = self.visit(slice_.elts[0])
assert isinstance(temp, ast.expr)
slice_.elts[0] = temp
else:
slice_.elts[0] = self.visit(slice_.elts[0])
temp = self.visit(slice_.elts[0])
assert isinstance(temp, ast.expr)
slice_.elts[0] = temp
else:
temp = self.visit(slice_)
assert isinstance(temp, ast.expr)
Expand Down

0 comments on commit 61b6665

Please sign in to comment.