From 5e6e4356fc23db4f219d7a546e961d460c1b0d8d Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Tue, 27 Nov 2018 01:17:12 +0100 Subject: [PATCH] Start using gather_annotation_classes --- jedi/evaluate/context/typing.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/jedi/evaluate/context/typing.py b/jedi/evaluate/context/typing.py index 5c2df354..8c4b30ab 100644 --- a/jedi/evaluate/context/typing.py +++ b/jedi/evaluate/context/typing.py @@ -145,11 +145,6 @@ class _WithIndexBase(_BaseTypingContext): self._index_context, ) - def _execute_annotations_for_all_indexes(self): - return ContextSet.from_sets( - _iter_over_arguments(self._index_context, self._context_of_index) - ).execute_annotation() - class TypingContextWithIndex(_WithIndexBase): def execute_annotation(self): @@ -158,11 +153,11 @@ class TypingContextWithIndex(_WithIndexBase): if string_name == 'Union': # This is kind of a special case, because we have Unions (in Jedi # ContextSets). - return self._execute_annotations_for_all_indexes() + return self.gather_annotation_classes().execute_annotation() elif string_name == 'Optional': # Optional is basically just saying it's either None or the actual # type. - return self._execute_annotations_for_all_indexes() \ + return self.gather_annotation_classes().execute_annotation() \ | ContextSet([builtin_from_name(self.evaluator, u'None')]) elif string_name == 'Type': # The type is actually already given in the index_context @@ -326,7 +321,9 @@ class Tuple(_ContainerBase): if self._is_homogenous(): return self._get_getitem_contexts(0).execute_annotation() - return self._execute_annotations_for_all_indexes() + return ContextSet.from_sets( + _iter_over_arguments(self._index_context, self._context_of_index) + ).execute_annotation() class Generic(_ContainerBase):