From 5784e23b4e2efa88a41ef472d0771e9a04bbfcc7 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Wed, 2 Apr 2014 21:17:57 +0200 Subject: [PATCH] tuples are also a possiblity in docstring type annotations --- jedi/evaluate/docstrings.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/jedi/evaluate/docstrings.py b/jedi/evaluate/docstrings.py index f2d8a299..9a789a5d 100644 --- a/jedi/evaluate/docstrings.py +++ b/jedi/evaluate/docstrings.py @@ -116,8 +116,14 @@ def _evaluate_for_statement_string(evaluator, string, module): # call. In that case it's the module of the function call. # stuffed with content from a function call. pseudo_cls.parent = module - return chain.from_iterable(evaluator.execute(defn) - for defn in evaluator.eval_statement(stmt)) + definitions = evaluator.eval_statement(stmt) + it = (evaluator.execute(d) for d in definitions) + # TODO Executing tuples does not make sense, people tend to say + # `(str, int)` in a type annotation, which means that it returns a tuple + # with both types. + # At this point we just return the classes if executing wasn't possible, + # i.e. is a tuple. + return list(chain.from_iterable(it)) or definitions @memoize_default(None, evaluator_is_first_arg=True)