mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
Get basic completions working with TypedDict
This commit is contained in:
@@ -5,8 +5,9 @@ values.
|
|||||||
|
|
||||||
This file deals with all the typing.py cases.
|
This file deals with all the typing.py cases.
|
||||||
"""
|
"""
|
||||||
|
import itertools
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi.inference.compiled import builtin_from_name
|
from jedi.inference.compiled import builtin_from_name, create_simple_object
|
||||||
from jedi.inference.base_value import ValueSet, NO_VALUES, Value, \
|
from jedi.inference.base_value import ValueSet, NO_VALUES, Value, \
|
||||||
LazyValueWrapper
|
LazyValueWrapper
|
||||||
from jedi.inference.lazy_value import LazyKnownValues
|
from jedi.inference.lazy_value import LazyKnownValues
|
||||||
@@ -398,8 +399,14 @@ class TypedDict(LazyValueWrapper):
|
|||||||
return NO_VALUES
|
return NO_VALUES
|
||||||
|
|
||||||
def get_key_values(self):
|
def get_key_values(self):
|
||||||
from jedi.inference.compiled import create_simple_object
|
filtered_values = itertools.chain.from_iterable((
|
||||||
return ValueSet({create_simple_object(self.inference_state, 'baz')})
|
f.values(from_instance=True)
|
||||||
|
for f in self._definition_class.get_filters(is_instance=True)
|
||||||
|
))
|
||||||
|
return ValueSet({
|
||||||
|
create_simple_object(self.inference_state, v.string_name)
|
||||||
|
for v in filtered_values
|
||||||
|
})
|
||||||
|
|
||||||
def _get_wrapped_value(self):
|
def _get_wrapped_value(self):
|
||||||
d, = self.inference_state.builtins_module.py__getattribute__('dict')
|
d, = self.inference_state.builtins_module.py__getattribute__('dict')
|
||||||
|
|||||||
Reference in New Issue
Block a user