mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 05:54:25 +08:00
Compare commits
2 Commits
cf0b2a734d
...
29a41c013b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29a41c013b | ||
|
|
be6df62434 |
@@ -455,6 +455,7 @@ class Completion:
|
||||
- Having some doctest code that starts with `>>>`
|
||||
- Having backticks that doesn't have whitespace inside it
|
||||
"""
|
||||
|
||||
def iter_relevant_lines(lines):
|
||||
include_next_line = False
|
||||
for l in code_lines:
|
||||
@@ -683,8 +684,11 @@ def extract_imported_names(node):
|
||||
imported_names = []
|
||||
|
||||
if node.type in ['import_as_names', 'dotted_as_names', 'import_as_name']:
|
||||
for child in node.children:
|
||||
for index, child in enumerate(node.children):
|
||||
if child.type == 'name':
|
||||
if (index > 0 and node.children[index - 1].type == "keyword"
|
||||
and node.children[index - 1].value == "as"):
|
||||
continue
|
||||
imported_names.append(child.value)
|
||||
elif child.type == 'import_as_name':
|
||||
imported_names.extend(extract_imported_names(child))
|
||||
|
||||
@@ -325,6 +325,9 @@ def test_duplicated_import(Script):
|
||||
s = 'from os import path as pp, p'
|
||||
assert 'path' not in import_names(s)
|
||||
|
||||
s = 'from os import chdir as path, p'
|
||||
assert 'path' in import_names(s)
|
||||
|
||||
|
||||
def test_path_issues(Script):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user