From 1fbe0d8d2e64aaaf065eb23b3cb24fbfe929a02e Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 2 Jul 2020 03:04:14 +0200 Subject: [PATCH] Remove python_version_match from publish_method --- jedi/inference/filters.py | 11 +++-------- jedi/inference/value/iterable.py | 4 ++-- jedi/plugins/stdlib.py | 4 ++-- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/jedi/inference/filters.py b/jedi/inference/filters.py index 7f085ee0..25d63e67 100644 --- a/jedi/inference/filters.py +++ b/jedi/inference/filters.py @@ -265,12 +265,7 @@ class SpecialMethodFilter(DictFilter): class SpecialMethodName(AbstractNameDefinition): api_type = u'function' - def __init__(self, parent_context, string_name, value, builtin_value): - callable_, python_version = value - if python_version is not None and \ - python_version != parent_context.inference_state.environment.version_info.major: - raise KeyError - + def __init__(self, parent_context, string_name, callable_, builtin_value): self.parent_context = parent_context self.string_name = string_name self._callable = callable_ @@ -344,9 +339,9 @@ class AttributeOverwrite(_AttributeOverwriteMixin, ValueWrapper, pass -def publish_method(method_name, python_version_match=None): +def publish_method(method_name): def decorator(func): dct = func.__dict__.setdefault('registered_overwritten_methods', {}) - dct[method_name] = func, python_version_match + dct[method_name] = func return func return decorator diff --git a/jedi/inference/value/iterable.py b/jedi/inference/value/iterable.py index 50a689a2..07c743bc 100644 --- a/jedi/inference/value/iterable.py +++ b/jedi/inference/value/iterable.py @@ -52,8 +52,8 @@ class GeneratorBase(LazyAttributeOverwrite, IterableMixin): return ValueSet([self]) @publish_method('send') - @publish_method('next', python_version_match=2) - @publish_method('__next__', python_version_match=3) + @publish_method('next') + @publish_method('__next__') def py__next__(self, arguments): return ValueSet.from_sets(lazy_value.infer() for lazy_value in self.py__iter__()) diff --git a/jedi/plugins/stdlib.py b/jedi/plugins/stdlib.py index a270c06c..a1484891 100644 --- a/jedi/plugins/stdlib.py +++ b/jedi/plugins/stdlib.py @@ -260,8 +260,8 @@ class ReversedObject(AttributeOverwrite): def py__iter__(self, contextualized_node): return self._iter_list - @publish_method('next', python_version_match=2) - @publish_method('__next__', python_version_match=3) + @publish_method('next') + @publish_method('__next__') def py__next__(self, arguments): return ValueSet.from_sets( lazy_value.infer() for lazy_value in self._iter_list