From 1eeb7cb6aa65306c2c668340f06b2b5532c56987 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Wed, 14 Mar 2018 21:51:06 +0100 Subject: [PATCH] And now remove a pep0484 function that is no longer needed --- jedi/evaluate/pep0484.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/jedi/evaluate/pep0484.py b/jedi/evaluate/pep0484.py index 36fd0f96..e4b80e61 100644 --- a/jedi/evaluate/pep0484.py +++ b/jedi/evaluate/pep0484.py @@ -43,17 +43,7 @@ def _evaluate_for_annotation(context, annotation, index=None): and we're interested in that index """ context_set = context.eval_node(_fix_forward_reference(context, annotation)) - return _check_index(context_set, index).execute_evaluated() - - -def _check_index(context_set, index): - if index is None: - return context_set - - return context_set.filter( - lambda context: context.array_type == u'tuple' - and len(list(context.py__iter__())) >= index - ).py__getitem__(index) + return context_set.execute_evaluated() def _evaluate_annotation_string(context, string, index=None): @@ -62,7 +52,12 @@ def _evaluate_annotation_string(context, string, index=None): return NO_CONTEXTS context_set = context.eval_node(node) - return _check_index(context_set, index).execute_evaluated() + if index is not None: + context_set = context_set.filter( + lambda context: context.array_type == u'tuple' + and len(list(context.py__iter__())) >= index + ).py__getitem__(index) + return context_set.execute_evaluated() def _fix_forward_reference(context, node):