mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 05:54:25 +08:00
Fix itemgetter for tuples
This commit is contained in:
@@ -26,7 +26,8 @@ from jedi.evaluate.context import ClassContext, ModuleContext, \
|
|||||||
FunctionExecutionContext
|
FunctionExecutionContext
|
||||||
from jedi.evaluate.context.klass import py__mro__
|
from jedi.evaluate.context.klass import py__mro__
|
||||||
from jedi.evaluate.context import iterable
|
from jedi.evaluate.context import iterable
|
||||||
from jedi.evaluate.lazy_context import LazyTreeContext, LazyKnownContext
|
from jedi.evaluate.lazy_context import LazyTreeContext, LazyKnownContext, \
|
||||||
|
LazyKnownContexts
|
||||||
from jedi.evaluate.syntax_tree import is_string
|
from jedi.evaluate.syntax_tree import is_string
|
||||||
|
|
||||||
# Now this is all part of fake tuples in Jedi. However super doesn't work on
|
# Now this is all part of fake tuples in Jedi. However super doesn't work on
|
||||||
@@ -475,8 +476,14 @@ class ItemGetterCallable(object):
|
|||||||
# TODO we need to add the contextualized context.
|
# TODO we need to add the contextualized context.
|
||||||
context_set |= item_context_set.get_item(lazy_contexts[0].infer(), None)
|
context_set |= item_context_set.get_item(lazy_contexts[0].infer(), None)
|
||||||
else:
|
else:
|
||||||
return NO_CONTEXTS
|
context_set |= ContextSet([iterable.FakeSequence(
|
||||||
raise NotImplementedError
|
self.evaluator,
|
||||||
|
'list',
|
||||||
|
[
|
||||||
|
LazyKnownContexts(item_context_set.get_item(lazy_context.infer(), None))
|
||||||
|
for lazy_context in lazy_contexts
|
||||||
|
],
|
||||||
|
)])
|
||||||
return context_set
|
return context_set
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ g = operator.itemgetter(1, 2)
|
|||||||
x1, x2 = g([1, 1.0, ''])
|
x1, x2 = g([1, 1.0, ''])
|
||||||
#? float()
|
#? float()
|
||||||
x1
|
x1
|
||||||
#? float()
|
#? str()
|
||||||
x2
|
x2
|
||||||
|
|
||||||
x1, x2 = g([1, ''])
|
x1, x2 = g([1, ''])
|
||||||
|
|||||||
Reference in New Issue
Block a user