Fix the MixedContext and also use MixedModuleContext

This commit is contained in:
Dave Halter
2019-12-01 17:22:36 +01:00
parent 5c79472024
commit 582df2f76d

View File

@@ -21,7 +21,8 @@ from jedi.inference.compiled.access import compiled_objects_cache, \
ALLOWED_GETITEM_TYPES, get_api_type
from jedi.inference.compiled.value import create_cached_compiled_object
from jedi.inference.gradual.conversion import to_stub
from jedi.inference.context import CompiledContext, TreeContextMixin
from jedi.inference.context import CompiledContext, CompiledModuleContext, \
TreeContextMixin
_sentinel = object()
@@ -72,6 +73,8 @@ class MixedObject(ValueWrapper):
raise SimpleGetItemNotFound
def _as_context(self):
if self.parent_context is None:
return MixedModuleContext(self)
return MixedContext(self)
def __repr__(self):
@@ -87,6 +90,10 @@ class MixedContext(CompiledContext, TreeContextMixin):
return self._value.compiled_object
class MixedModuleContext(CompiledModuleContext, MixedContext):
pass
class MixedName(compiled.CompiledName):
"""
The ``CompiledName._compiled_object`` is our MixedObject.