1
0
forked from VimPlug/jedi

Issues with argument clinic parser.

This commit is contained in:
Dave Halter
2014-12-08 15:45:40 +01:00
parent 01b9361b33
commit 94ea2c1096
2 changed files with 4 additions and 3 deletions
+1
View File
@@ -117,6 +117,7 @@ class Arguments(pr.Base):
# For the stdlib we always want values. If we don't get them, # For the stdlib we always want values. If we don't get them,
# that's ok, maybe something is too hard to resolve, however, # that's ok, maybe something is too hard to resolve, however,
# we will not proceed with the evaluation of that function. # we will not proceed with the evaluation of that function.
debug.warning('argument_clinic "%s" not resolvable.', name)
raise ValueError raise ValueError
yield values yield values
+3 -3
View File
@@ -63,6 +63,7 @@ def argument_clinic(string, want_obj=False, want_scope=False):
""" """
clinic_args = [] clinic_args = []
allow_kwargs = False allow_kwargs = False
optional = False
while string: while string:
# Optional arguments have to begin with a bracket. And should always be # Optional arguments have to begin with a bracket. And should always be
# at the end of the arguments. This is therefore not a proper argument # at the end of the arguments. This is therefore not a proper argument
@@ -73,9 +74,9 @@ def argument_clinic(string, want_obj=False, want_scope=False):
if not match.group(2): # A slash -> allow named arguments if not match.group(2): # A slash -> allow named arguments
allow_kwargs = True allow_kwargs = True
continue continue
optional = match.group(1) optional = optional or bool(match.group(1))
word = match.group(2) word = match.group(2)
clinic_args.append((word, bool(optional), allow_kwargs)) clinic_args.append((word, optional, allow_kwargs))
def f(func): def f(func):
def wrapper(evaluator, obj, arguments): def wrapper(evaluator, obj, arguments):
@@ -121,7 +122,6 @@ def builtins_type(evaluator, objects, bases, dicts):
return [] return []
else: else:
return [o.base for o in objects if isinstance(o, er.Instance)] return [o.base for o in objects if isinstance(o, er.Instance)]
return []
class SuperInstance(er.Instance): class SuperInstance(er.Instance):