diff --git a/jedi/common/context.py b/jedi/common/context.py index f41de240..b4c7d9a5 100644 --- a/jedi/common/context.py +++ b/jedi/common/context.py @@ -31,7 +31,6 @@ class BaseContextSet(object): Used to work with an iterable of set. """ aggregated = set() - sets = list(sets) for set_ in sets: if isinstance(set_, BaseContextSet): aggregated |= set_._set diff --git a/jedi/plugins/stdlib.py b/jedi/plugins/stdlib.py index 8cd6691f..23c590c7 100644 --- a/jedi/plugins/stdlib.py +++ b/jedi/plugins/stdlib.py @@ -344,6 +344,15 @@ def _return_first_param(evaluator, firsts): return firsts +@argument_clinic('seq') +def _random_choice(evaluator, sequences): + return ContextSet.from_sets( + lazy_context.infer() + for sequence in sequences + for lazy_context in sequence.py__iter__() + ) + + _implemented = { 'builtins': { 'getattr': builtins_getattr, @@ -365,6 +374,13 @@ _implemented = { }, 'functools': { 'partial': functools_partial, + 'wraps': _return_first_param, + }, + '_weakref': { + 'proxy': _return_first_param, + }, + 'random': { + 'choice': _random_choice, }, 'abc': { # Not sure if this is necessary, but it's used a lot in typeshed and