mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 14:54:47 +08:00
Small issue with relative imports that don't contain a path after from.
This commit is contained in:
@@ -345,6 +345,9 @@ class FakeImport(pr.Import):
|
|||||||
self._level = level
|
self._level = level
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
|
def aliases(self):
|
||||||
|
return {}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def level(self):
|
def level(self):
|
||||||
return self._level
|
return self._level
|
||||||
|
|||||||
@@ -1145,9 +1145,11 @@ class ImportFrom(Import):
|
|||||||
for n in self.children[1:]:
|
for n in self.children[1:]:
|
||||||
if n not in ('.', '...'):
|
if n not in ('.', '...'):
|
||||||
break
|
break
|
||||||
if is_node(n, 'dotted_name'):
|
if is_node(n, 'dotted_name'): # from x.y import
|
||||||
dotted = n.children[::2]
|
dotted = n.children[::2]
|
||||||
else:
|
elif n == 'import': # from . import
|
||||||
|
dotted = []
|
||||||
|
else: # from x import
|
||||||
dotted = [n]
|
dotted = [n]
|
||||||
return [dotted + [name] for name, alias in self._as_name_tuples()]
|
return [dotted + [name] for name, alias in self._as_name_tuples()]
|
||||||
|
|
||||||
|
|||||||
@@ -211,9 +211,6 @@ from . import datetime as mod1
|
|||||||
#? []
|
#? []
|
||||||
mod1.
|
mod1.
|
||||||
|
|
||||||
#? str()
|
|
||||||
imp_tree.a
|
|
||||||
|
|
||||||
# self import
|
# self import
|
||||||
# this can cause recursions
|
# this can cause recursions
|
||||||
from imports import *
|
from imports import *
|
||||||
|
|||||||
Reference in New Issue
Block a user