diff --git a/jedi/inference/value/klass.py b/jedi/inference/value/klass.py index 6ff1698c..d4074f36 100644 --- a/jedi/inference/value/klass.py +++ b/jedi/inference/value/klass.py @@ -120,21 +120,6 @@ class ClassFilter(ParserTreeFilter): return False def _access_possible(self, name): - # Filter for ClassVar variables - # TODO this is not properly done, yet. It just checks for the string - # ClassVar in the annotation, which can be quite imprecise. If we - # wanted to do this correct, we would have to infer the ClassVar. - if not self._is_instance: - expr_stmt = name.get_definition() - if expr_stmt is not None and expr_stmt.type == 'expr_stmt': - annassign = expr_stmt.children[1] - if annassign.type == 'annassign': - # If there is an =, the variable is obviously also - # defined on the class. - if 'ClassVar' not in annassign.children[1].get_code() \ - and '=' not in annassign.children: - return False - # Filter for name mangling of private variables like __foo return not name.value.startswith('__') or name.value.endswith('__') \ or self._equals_origin_scope() diff --git a/test/completion/pep0526_variables.py b/test/completion/pep0526_variables.py index 59085118..1a77f383 100644 --- a/test/completion/pep0526_variables.py +++ b/test/completion/pep0526_variables.py @@ -44,7 +44,7 @@ class Foo(): baz: typing.ClassVar[str] -#? +#? int() Foo.bar #? int() Foo().bar @@ -81,11 +81,11 @@ class VarClass2(VarClass): #? int() self.var_class3 -#? ['var_class1', 'var_class2', 'var_instance1', 'var_class3'] +#? ['var_class1', 'var_class2', 'var_instance1', 'var_class3', 'var_instance2'] VarClass.var_ #? int() VarClass.var_instance1 -#? +#? float() VarClass.var_instance2 #? str() VarClass.var_class1