1
0
forked from VimPlug/jedi

Implement random.choice

This commit is contained in:
Dave Halter
2018-09-03 01:35:30 +02:00
parent 5302032b63
commit 3351b06603
2 changed files with 16 additions and 1 deletions

View File

@@ -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