From f43d144e2332fae7d462c5f5141e8d493c60a4ab Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sun, 1 Dec 2019 20:50:29 +0100 Subject: [PATCH] Remove is_package on contexts --- jedi/inference/compiled/mixed.py | 2 +- jedi/inference/compiled/value.py | 1 - jedi/inference/context.py | 6 ------ jedi/inference/names.py | 2 +- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/jedi/inference/compiled/mixed.py b/jedi/inference/compiled/mixed.py index 9a760586..4682bff1 100644 --- a/jedi/inference/compiled/mixed.py +++ b/jedi/inference/compiled/mixed.py @@ -284,7 +284,7 @@ def _create(inference_state, access_handle, parent_context, *args): file_io=file_io, string_names=string_names, code_lines=code_lines, - is_package=compiled_object.is_package, + is_package=compiled_object.is_package(), ).as_context() if name is not None: inference_state.module_cache.add(string_names, ValueSet([module_context])) diff --git a/jedi/inference/compiled/value.py b/jedi/inference/compiled/value.py index c33d89b3..e493750f 100644 --- a/jedi/inference/compiled/value.py +++ b/jedi/inference/compiled/value.py @@ -89,7 +89,6 @@ class CompiledObject(Value): return None return map(cast_path, paths) - @property def is_package(self): return self.py__path__() is not None diff --git a/jedi/inference/context.py b/jedi/inference/context.py index ce4bdf7a..b60c2967 100644 --- a/jedi/inference/context.py +++ b/jedi/inference/context.py @@ -298,9 +298,6 @@ class ModuleContext(TreeContextMixin, ValueContext): def py__file__(self): return self._value.py__file__() - def is_package(self): - return self._value.is_package - def get_filters(self, until_position=None, origin_scope=None): filters = self._value.get_filters(origin_scope) # Skip the first filter and replace it. @@ -390,9 +387,6 @@ class CompiledModuleContext(CompiledContext): def py__file__(self): return self._value.py__file__() - def is_package(self): - return self._value.is_package() - def _get_global_filters_for_name(context, name_or_none, position): # For functions and classes the defaults don't belong to the diff --git a/jedi/inference/names.py b/jedi/inference/names.py index e336b922..67826be2 100644 --- a/jedi/inference/names.py +++ b/jedi/inference/names.py @@ -93,7 +93,7 @@ class AbstractTreeName(AbstractNameDefinition): # In case of level == 1, it works always, because it's like a submodule # lookup. if import_node is not None and not (import_node.level == 1 - and self.get_root_context().is_package()): + and self.get_root_context().get_value().is_package()): # TODO improve the situation for when level is present. if include_module_names and not import_node.level: return tuple(n.value for n in import_node.get_path_for_name(self.tree_name))