mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Remove is_package on contexts
This commit is contained in:
@@ -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]))
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user