forked from VimPlug/jedi
Fixing more py27 stuff
This commit is contained in:
@@ -171,6 +171,7 @@ class CompiledObject(Context):
|
|||||||
from jedi.evaluate.compiled import builtin_from_name
|
from jedi.evaluate.compiled import builtin_from_name
|
||||||
if self.api_type != 'function':
|
if self.api_type != 'function':
|
||||||
return
|
return
|
||||||
|
|
||||||
for name in self._parse_function_doc()[1].split():
|
for name in self._parse_function_doc()[1].split():
|
||||||
try:
|
try:
|
||||||
# TODO wtf is this? this is exactly the same as the thing
|
# TODO wtf is this? this is exactly the same as the thing
|
||||||
@@ -353,11 +354,11 @@ class CompiledObjectFilter(AbstractFilter):
|
|||||||
|
|
||||||
|
|
||||||
docstr_defaults = {
|
docstr_defaults = {
|
||||||
'floating point number': 'float',
|
'floating point number': u'float',
|
||||||
'character': 'str',
|
'character': u'str',
|
||||||
'integer': 'int',
|
'integer': u'int',
|
||||||
'dictionary': 'dict',
|
'dictionary': u'dict',
|
||||||
'string': 'str',
|
'string': u'str',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -369,6 +370,7 @@ def _parse_function_doc(doc):
|
|||||||
TODO docstrings like utime(path, (atime, mtime)) and a(b [, b]) -> None
|
TODO docstrings like utime(path, (atime, mtime)) and a(b [, b]) -> None
|
||||||
TODO docstrings like 'tuple of integers'
|
TODO docstrings like 'tuple of integers'
|
||||||
"""
|
"""
|
||||||
|
doc = force_unicode(doc)
|
||||||
# parse round parentheses: def func(a, (b,c))
|
# parse round parentheses: def func(a, (b,c))
|
||||||
try:
|
try:
|
||||||
count = 0
|
count = 0
|
||||||
@@ -387,7 +389,7 @@ def _parse_function_doc(doc):
|
|||||||
# UnboundLocalError for undefined end in last line
|
# UnboundLocalError for undefined end in last line
|
||||||
debug.dbg('no brackets found - no param')
|
debug.dbg('no brackets found - no param')
|
||||||
end = 0
|
end = 0
|
||||||
param_str = ''
|
param_str = u''
|
||||||
else:
|
else:
|
||||||
# remove square brackets, that show an optional param ( = None)
|
# remove square brackets, that show an optional param ( = None)
|
||||||
def change_options(m):
|
def change_options(m):
|
||||||
@@ -405,9 +407,9 @@ def _parse_function_doc(doc):
|
|||||||
param_str = param_str.replace('-', '_') # see: isinstance.__doc__
|
param_str = param_str.replace('-', '_') # see: isinstance.__doc__
|
||||||
|
|
||||||
# parse return value
|
# parse return value
|
||||||
r = re.search('-[>-]* ', doc[end:end + 7])
|
r = re.search(u'-[>-]* ', doc[end:end + 7])
|
||||||
if r is None:
|
if r is None:
|
||||||
ret = ''
|
ret = u''
|
||||||
else:
|
else:
|
||||||
index = end + r.end()
|
index = end + r.end()
|
||||||
# get result type, which can contain newlines
|
# get result type, which can contain newlines
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ def builtins_isinstance(evaluator, objects, types, arguments):
|
|||||||
analysis.add(lazy_context._context, 'type-error-isinstance', node, message)
|
analysis.add(lazy_context._context, 'type-error-isinstance', node, message)
|
||||||
|
|
||||||
return ContextSet.from_iterable(
|
return ContextSet.from_iterable(
|
||||||
compiled.builtin_from_name(evaluator, str(b))
|
compiled.builtin_from_name(evaluator, force_unicode(str(b)))
|
||||||
for b in bool_results
|
for b in bool_results
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user