forked from VimPlug/jedi
Use "namespace" as a Name.type
This commit is contained in:
@@ -627,7 +627,7 @@ def search_in_module(inference_state, module_context, names, wanted_names,
|
||||
new_names = []
|
||||
for n in names:
|
||||
if s == n.string_name:
|
||||
if n.tree_name is not None and n.api_type == 'module' \
|
||||
if n.tree_name is not None and n.api_type in ('module', 'namespace') \
|
||||
and ignore_imports:
|
||||
continue
|
||||
new_names += complete_trailer(
|
||||
|
||||
@@ -439,5 +439,5 @@ def get_default_project(path=None):
|
||||
def _remove_imports(names):
|
||||
return [
|
||||
n for n in names
|
||||
if n.tree_name is None or n.api_type != 'module'
|
||||
if n.tree_name is None or n.api_type not in ('module', 'namespace')
|
||||
]
|
||||
|
||||
@@ -156,8 +156,8 @@ def rename(inference_state, definitions, new_name):
|
||||
def inline(inference_state, names):
|
||||
if not names:
|
||||
raise RefactoringError("There is no name under the cursor")
|
||||
if any(n.api_type == 'module' for n in names):
|
||||
raise RefactoringError("Cannot inline imports or modules")
|
||||
if any(n.api_type in ('module', 'namespace') for n in names):
|
||||
raise RefactoringError("Cannot inline imports, modules or namespaces")
|
||||
if any(n.tree_name is None for n in names):
|
||||
raise RefactoringError("Cannot inline builtins/extensions")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user