forked from VimPlug/jedi
Refactor Jedi so we use stub modules as much as possible
This commit is contained in:
@@ -7,8 +7,12 @@ from jedi.evaluate.helpers import execute_evaluated
|
||||
|
||||
|
||||
def builtin_from_name(evaluator, string):
|
||||
builtins = evaluator.builtins_module
|
||||
filter_ = next(builtins.get_filters())
|
||||
typing_builtins_module = evaluator.builtins_module
|
||||
if string in ('None', 'True', 'False'):
|
||||
builtins, = typing_builtins_module.non_stub_context_set
|
||||
filter_ = next(builtins.get_filters())
|
||||
else:
|
||||
filter_ = next(typing_builtins_module.get_filters())
|
||||
name, = filter_.get(string)
|
||||
context, = name.infer()
|
||||
return context
|
||||
|
||||
@@ -82,6 +82,14 @@ class CompiledObject(Context):
|
||||
def py__path__(self):
|
||||
return self.access_handle.py__path__()
|
||||
|
||||
@property
|
||||
def string_names(self):
|
||||
# For modules
|
||||
return tuple(self.py__name__().split('.'))
|
||||
|
||||
def get_qualified_names(self):
|
||||
return self.string_names
|
||||
|
||||
def py__bool__(self):
|
||||
return self.access_handle.py__bool__()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user