mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
Fix the MixedContext and also use MixedModuleContext
This commit is contained in:
@@ -21,7 +21,8 @@ from jedi.inference.compiled.access import compiled_objects_cache, \
|
|||||||
ALLOWED_GETITEM_TYPES, get_api_type
|
ALLOWED_GETITEM_TYPES, get_api_type
|
||||||
from jedi.inference.compiled.value import create_cached_compiled_object
|
from jedi.inference.compiled.value import create_cached_compiled_object
|
||||||
from jedi.inference.gradual.conversion import to_stub
|
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()
|
_sentinel = object()
|
||||||
|
|
||||||
@@ -72,6 +73,8 @@ class MixedObject(ValueWrapper):
|
|||||||
raise SimpleGetItemNotFound
|
raise SimpleGetItemNotFound
|
||||||
|
|
||||||
def _as_context(self):
|
def _as_context(self):
|
||||||
|
if self.parent_context is None:
|
||||||
|
return MixedModuleContext(self)
|
||||||
return MixedContext(self)
|
return MixedContext(self)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
@@ -87,6 +90,10 @@ class MixedContext(CompiledContext, TreeContextMixin):
|
|||||||
return self._value.compiled_object
|
return self._value.compiled_object
|
||||||
|
|
||||||
|
|
||||||
|
class MixedModuleContext(CompiledModuleContext, MixedContext):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MixedName(compiled.CompiledName):
|
class MixedName(compiled.CompiledName):
|
||||||
"""
|
"""
|
||||||
The ``CompiledName._compiled_object`` is our MixedObject.
|
The ``CompiledName._compiled_object`` is our MixedObject.
|
||||||
|
|||||||
Reference in New Issue
Block a user