mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
Add handling of nested generic tuples
This commit is contained in:
@@ -6,6 +6,7 @@ from typing import (
|
||||
Iterable,
|
||||
List,
|
||||
Mapping,
|
||||
Tuple,
|
||||
Type,
|
||||
TypeVar,
|
||||
Union,
|
||||
@@ -59,6 +60,28 @@ for b in list_type_t_to_list_t(list_of_int_type):
|
||||
b
|
||||
|
||||
|
||||
def list_tuple_t_to_tuple_list_t(the_list: List[Tuple[T]]) -> Tuple[List[T], ...]:
|
||||
return tuple(list(x) for x in the_list)
|
||||
|
||||
|
||||
list_of_int_tuples = [(x,) for x in list_of_ints] # type: List[Tuple[int]]
|
||||
|
||||
for b in list_tuple_t_to_tuple_list_t(list_of_int_tuples):
|
||||
#? int()
|
||||
b[0]
|
||||
|
||||
|
||||
def list_tuple_t_elipsis_to_tuple_list_t(the_list: List[Tuple[T, ...]]) -> Tuple[List[T], ...]:
|
||||
return tuple(list(x) for x in the_list)
|
||||
|
||||
|
||||
list_of_int_tuples = [tuple(list_of_ints)] # type: List[Tuple[int, ...]]
|
||||
|
||||
for b in list_tuple_t_elipsis_to_tuple_list_t(list_of_int_tuples):
|
||||
#? int()
|
||||
b[0]
|
||||
|
||||
|
||||
def foo(x: T) -> T:
|
||||
return x
|
||||
|
||||
|
||||
Reference in New Issue
Block a user