From ac6b7ff14e6b1a24effb5f711e3b6aa8dc767adf Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 30 Aug 2018 01:23:28 +0200 Subject: [PATCH] Fix type var completions so that there's at least no error --- jedi/evaluate/context/typing.py | 5 ++++- test/completion/pep0484_typing.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/jedi/evaluate/context/typing.py b/jedi/evaluate/context/typing.py index 34f515e2..4cf94aff 100644 --- a/jedi/evaluate/context/typing.py +++ b/jedi/evaluate/context/typing.py @@ -322,7 +322,7 @@ class Protocol(_ContainerBase): class Any(_BaseTypingContext): def execute_annotation(self): - debug.warning('Used Any, which is not implemented, yet.') + debug.warning('Used Any - returned no results') return NO_CONTEXTS @@ -390,6 +390,9 @@ class TypeVar(Context): else: debug.warning('Invalid TypeVar param name %s', key) + def get_filters(self, *args, **kwargs): + return iter([]) + def execute_annotation(self): if self._bound_lazy_context is not None: return self._bound_lazy_context.infer().execute_annotation() diff --git a/test/completion/pep0484_typing.py b/test/completion/pep0484_typing.py index 26658ef6..815cba90 100644 --- a/test/completion/pep0484_typing.py +++ b/test/completion/pep0484_typing.py @@ -308,7 +308,9 @@ def union4(x: U[int, str]): TYPE_VAR = typing.TypeVar('TYPE_VAR') - +# TODO there should at least be some results. +#? [] +TYPE_VAR. class WithTypeVar(typing.Generic[TYPE_VAR]): def lala(self) -> TYPE_VAR: