forked from VimPlug/jedi
Merge branch 'dev' of github.com:davidhalter/jedi into dev
This commit is contained in:
@@ -19,9 +19,11 @@ class BaseOutput(object):
|
|||||||
'_io': 'io'
|
'_io': 'io'
|
||||||
}
|
}
|
||||||
|
|
||||||
_tuple_mapping = {
|
_tuple_mapping = dict((tuple(k.split('.')), v) for (k, v) in {
|
||||||
('argparse', '_ActionsContainer'): 'argparse._ActionsContainer'
|
'argparse._ActionsContainer': 'argparse.ArgumentParser',
|
||||||
}
|
'_sre.SRE_Match': 're.MatchObject',
|
||||||
|
'_sre.SRE_Pattern': 're.RegexObject',
|
||||||
|
}.items())
|
||||||
|
|
||||||
def __init__(self, definition, start_pos):
|
def __init__(self, definition, start_pos):
|
||||||
self.start_pos = start_pos
|
self.start_pos = start_pos
|
||||||
@@ -97,7 +99,7 @@ class BaseOutput(object):
|
|||||||
pass
|
pass
|
||||||
for key, repl in self._tuple_mapping.items():
|
for key, repl in self._tuple_mapping.items():
|
||||||
if tuple(path[:len(key)]) == key:
|
if tuple(path[:len(key)]) == key:
|
||||||
path = [repl] + path[len(key)]
|
path = [repl] + path[len(key):]
|
||||||
|
|
||||||
return '.'.join(path)
|
return '.'.join(path)
|
||||||
|
|
||||||
|
|||||||
@@ -234,6 +234,16 @@ class TestFeature(Base):
|
|||||||
assert self.complete('import os; os.path.join')[0].full_name \
|
assert self.complete('import os; os.path.join')[0].full_name \
|
||||||
== 'os.path.join'
|
== 'os.path.join'
|
||||||
|
|
||||||
|
def test_full_name_tuple_mapping(self):
|
||||||
|
s = """
|
||||||
|
import re
|
||||||
|
any_re = re.compile('.*')
|
||||||
|
any_re"""
|
||||||
|
lines = s.splitlines()
|
||||||
|
defs = self.get_def(s, (len(lines), len(lines[-1])))
|
||||||
|
self.assertEqual(defs[0].full_name,
|
||||||
|
're.RegexObject')
|
||||||
|
|
||||||
|
|
||||||
class TestSpeed(Base):
|
class TestSpeed(Base):
|
||||||
def _check_speed(time_per_run, number=4, run_warm=True):
|
def _check_speed(time_per_run, number=4, run_warm=True):
|
||||||
|
|||||||
Reference in New Issue
Block a user