From 94ea2c10964b23709f78ea0396976b02af678f24 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Mon, 8 Dec 2014 15:45:40 +0100 Subject: [PATCH] Issues with argument clinic parser. --- jedi/evaluate/param.py | 1 + jedi/evaluate/stdlib.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/jedi/evaluate/param.py b/jedi/evaluate/param.py index 280657e1..aed3444c 100644 --- a/jedi/evaluate/param.py +++ b/jedi/evaluate/param.py @@ -117,6 +117,7 @@ class Arguments(pr.Base): # For the stdlib we always want values. If we don't get them, # that's ok, maybe something is too hard to resolve, however, # we will not proceed with the evaluation of that function. + debug.warning('argument_clinic "%s" not resolvable.', name) raise ValueError yield values diff --git a/jedi/evaluate/stdlib.py b/jedi/evaluate/stdlib.py index 944efe26..de0c8da5 100644 --- a/jedi/evaluate/stdlib.py +++ b/jedi/evaluate/stdlib.py @@ -63,6 +63,7 @@ def argument_clinic(string, want_obj=False, want_scope=False): """ clinic_args = [] allow_kwargs = False + optional = False while string: # 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 @@ -73,9 +74,9 @@ def argument_clinic(string, want_obj=False, want_scope=False): if not match.group(2): # A slash -> allow named arguments allow_kwargs = True continue - optional = match.group(1) + optional = optional or bool(match.group(1)) word = match.group(2) - clinic_args.append((word, bool(optional), allow_kwargs)) + clinic_args.append((word, optional, allow_kwargs)) def f(func): def wrapper(evaluator, obj, arguments): @@ -121,7 +122,6 @@ def builtins_type(evaluator, objects, bases, dicts): return [] else: return [o.base for o in objects if isinstance(o, er.Instance)] - return [] class SuperInstance(er.Instance):