mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 14:54:47 +08:00
Fix one more os.path.join issue
This commit is contained in:
@@ -708,14 +708,18 @@ def _os_path_join(args_set, callback):
|
|||||||
if len(args_set) == 1:
|
if len(args_set) == 1:
|
||||||
string = u''
|
string = u''
|
||||||
sequence, = args_set
|
sequence, = args_set
|
||||||
|
is_first = True
|
||||||
for lazy_context in sequence.py__iter__():
|
for lazy_context in sequence.py__iter__():
|
||||||
string_contexts = lazy_context.infer()
|
string_contexts = lazy_context.infer()
|
||||||
if len(string_contexts) != 1:
|
if len(string_contexts) != 1:
|
||||||
break
|
break
|
||||||
s = get_str_or_none(next(iter(string_contexts)))
|
s = get_str_or_none(next(iter(string_contexts)))
|
||||||
if string is None:
|
if s is None:
|
||||||
break
|
break
|
||||||
string += os.path.sep + force_unicode(s)
|
if not is_first:
|
||||||
|
string += os.path.sep
|
||||||
|
string += force_unicode(s)
|
||||||
|
is_first = False
|
||||||
else:
|
else:
|
||||||
return ContextSet([compiled.create_simple_object(sequence.evaluator, string)])
|
return ContextSet([compiled.create_simple_object(sequence.evaluator, string)])
|
||||||
return callback()
|
return callback()
|
||||||
|
|||||||
@@ -210,6 +210,9 @@ os_path = 'from os.path import *\n'
|
|||||||
(f2, os_path + 'dirname(__file__) + "%stest_ca' % s, None, ['che.py']),
|
(f2, os_path + 'dirname(__file__) + "%stest_ca' % s, None, ['che.py']),
|
||||||
(f2, os_path + 'dirname(abspath(__file__)) + sep + "test_ca', None, ['che.py']),
|
(f2, os_path + 'dirname(abspath(__file__)) + sep + "test_ca', None, ['che.py']),
|
||||||
(f2, os_path + 'join(dirname(__file__), "completion") + sep + "basi', None, ['c.py']),
|
(f2, os_path + 'join(dirname(__file__), "completion") + sep + "basi', None, ['c.py']),
|
||||||
|
(f2, os_path + 'join("test", "completion") + sep + "basi', None, ['c.py']),
|
||||||
|
|
||||||
|
# inside join
|
||||||
(f2, os_path + 'join(dirname(__file__), "completion", "basi', None, ['c.py"']),
|
(f2, os_path + 'join(dirname(__file__), "completion", "basi', None, ['c.py"']),
|
||||||
(f2, os_path + 'join(dirname(__file__), "completion", "basi)', 43, ['c.py"']),
|
(f2, os_path + 'join(dirname(__file__), "completion", "basi)', 43, ['c.py"']),
|
||||||
(f2, os_path + 'join(dirname(__file__), "completion", "basi")', 43, ['c.py"']),
|
(f2, os_path + 'join(dirname(__file__), "completion", "basi")', 43, ['c.py"']),
|
||||||
|
|||||||
Reference in New Issue
Block a user