Remove is_package on contexts

This commit is contained in:
Dave Halter
2019-12-01 20:50:29 +01:00
parent 76e0e6a8c5
commit f43d144e23
4 changed files with 2 additions and 9 deletions

View File

@@ -284,7 +284,7 @@ def _create(inference_state, access_handle, parent_context, *args):
file_io=file_io, file_io=file_io,
string_names=string_names, string_names=string_names,
code_lines=code_lines, code_lines=code_lines,
is_package=compiled_object.is_package, is_package=compiled_object.is_package(),
).as_context() ).as_context()
if name is not None: if name is not None:
inference_state.module_cache.add(string_names, ValueSet([module_context])) inference_state.module_cache.add(string_names, ValueSet([module_context]))

View File

@@ -89,7 +89,6 @@ class CompiledObject(Value):
return None return None
return map(cast_path, paths) return map(cast_path, paths)
@property
def is_package(self): def is_package(self):
return self.py__path__() is not None return self.py__path__() is not None

View File

@@ -298,9 +298,6 @@ class ModuleContext(TreeContextMixin, ValueContext):
def py__file__(self): def py__file__(self):
return self._value.py__file__() return self._value.py__file__()
def is_package(self):
return self._value.is_package
def get_filters(self, until_position=None, origin_scope=None): def get_filters(self, until_position=None, origin_scope=None):
filters = self._value.get_filters(origin_scope) filters = self._value.get_filters(origin_scope)
# Skip the first filter and replace it. # Skip the first filter and replace it.
@@ -390,9 +387,6 @@ class CompiledModuleContext(CompiledContext):
def py__file__(self): def py__file__(self):
return self._value.py__file__() 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): def _get_global_filters_for_name(context, name_or_none, position):
# For functions and classes the defaults don't belong to the # For functions and classes the defaults don't belong to the

View File

@@ -93,7 +93,7 @@ class AbstractTreeName(AbstractNameDefinition):
# In case of level == 1, it works always, because it's like a submodule # In case of level == 1, it works always, because it's like a submodule
# lookup. # lookup.
if import_node is not None and not (import_node.level == 1 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. # TODO improve the situation for when level is present.
if include_module_names and not import_node.level: 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)) return tuple(n.value for n in import_node.get_path_for_name(self.tree_name))