mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Some more minor adaptions
This commit is contained in:
@@ -65,10 +65,12 @@ class BaseDefinition(object):
|
||||
|
||||
# generate a path to the definition
|
||||
self._module = name.get_root_context()
|
||||
if self.in_builtin_module():
|
||||
try:
|
||||
py__file__ = self._module.py__file__
|
||||
except AttributeError:
|
||||
self.module_path = None
|
||||
else:
|
||||
self.module_path = self._module.py__file__()
|
||||
self.module_path = py__file__()
|
||||
"""Shows the file path of a module. e.g. ``/usr/lib/python2.7/os.py``"""
|
||||
|
||||
@property
|
||||
|
||||
@@ -260,11 +260,16 @@ class StubParserTreeFilter(ParserTreeFilter):
|
||||
|
||||
non_stub_filters = []
|
||||
for f in self._non_stub_filters:
|
||||
# TODO this is really ugly. accessing some random _used_names and
|
||||
# _filters. Please change.
|
||||
if isinstance(f, MergedFilter):
|
||||
non_stub_filters += f._filters
|
||||
else:
|
||||
non_stub_filters.append(f)
|
||||
|
||||
for non_stub_filter in non_stub_filters:
|
||||
if not hasattr(non_stub_filter, '_used_names'):
|
||||
continue
|
||||
for key_name in non_stub_filter._used_names:
|
||||
if key_name not in used_stub_names:
|
||||
result_names += non_stub_filter.get(key_name)
|
||||
@@ -377,28 +382,25 @@ class StubOnlyModuleContext(ModuleContext):
|
||||
|
||||
def _get_first_non_stub_filters(self):
|
||||
for context in self.non_stub_context_set:
|
||||
if not isinstance(context, CompiledObject):
|
||||
yield next(context.get_filters(search_global=False))
|
||||
yield next(context.get_filters(search_global=False))
|
||||
|
||||
def get_filters(self, search_global, until_position=None,
|
||||
origin_scope=None, **kwargs):
|
||||
filters = super(StubOnlyModuleContext, self).get_filters(
|
||||
search_global, until_position, origin_scope, **kwargs
|
||||
)
|
||||
first_non_stub_filters = list(self._get_first_non_stub_filters())
|
||||
next(filters) # Ignore the first filter and replace it with our own
|
||||
|
||||
if first_non_stub_filters:
|
||||
next(filters) # Ignore the first filter and replace it with our own
|
||||
# Here we remap the names from stubs to the actual module. This is
|
||||
# important if type inferences is needed in that module.
|
||||
yield StubParserTreeFilter(
|
||||
list(self._get_first_non_stub_filters()),
|
||||
self.evaluator,
|
||||
context=self,
|
||||
until_position=until_position,
|
||||
origin_scope=origin_scope,
|
||||
search_global=search_global,
|
||||
)
|
||||
# Here we remap the names from stubs to the actual module. This is
|
||||
# important if type inferences is needed in that module.
|
||||
yield StubParserTreeFilter(
|
||||
list(self._get_first_non_stub_filters()),
|
||||
self.evaluator,
|
||||
context=self,
|
||||
until_position=until_position,
|
||||
origin_scope=origin_scope,
|
||||
search_global=search_global,
|
||||
)
|
||||
for f in filters:
|
||||
yield f
|
||||
|
||||
|
||||
@@ -144,7 +144,6 @@ Check for `isinstance` and other information to infer a type.
|
||||
"""
|
||||
|
||||
auto_import_modules = [
|
||||
'hashlib', # hashlib is mostly using setattr, which jedi doesn't understand
|
||||
'gi', # This third-party repository (GTK stuff) doesn't really work with jedi
|
||||
]
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user