mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
Support for typing.Tuple[type, ...]
This commit is contained in:
@@ -35,6 +35,11 @@ def factory(typing_name, indextypes):
|
|||||||
|
|
||||||
class Tuple(Sequence, tuple):
|
class Tuple(Sequence, tuple):
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
|
if indextypes[1] == ...:
|
||||||
|
# https://www.python.org/dev/peps/pep-0484/#the-typing-module
|
||||||
|
# Tuple[int, ...] means a tuple of ints of indetermined length
|
||||||
|
return indextypes[0]()
|
||||||
|
else:
|
||||||
return indextypes[index]()
|
return indextypes[index]()
|
||||||
|
|
||||||
class AbstractSet(Iterable, abc.Set):
|
class AbstractSet(Iterable, abc.Set):
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ def tuple(
|
|||||||
q[2]
|
q[2]
|
||||||
#? B()
|
#? B()
|
||||||
r[0]
|
r[0]
|
||||||
##? B() --- TODO fix support for arbitrary length
|
#? B()
|
||||||
r[1]
|
r[1]
|
||||||
#? B()
|
#? B()
|
||||||
r[2]
|
r[2]
|
||||||
|
|||||||
Reference in New Issue
Block a user