feat(python): Add support for python 3.11rc and testing

This commit is contained in:
Georg Krause 2022-10-12 10:03:52 +02:00 committed by Georg Krause
commit 2eefd8b3f7
3 changed files with 5 additions and 3 deletions

View file

@ -26,10 +26,11 @@ class SimpleRadio(object):
return
def pick(self, choices, previous_choices=[]):
return random.sample(set(choices).difference(previous_choices), 1)[0]
possible_choices = [x for x in choices if x not in previous_choices]
return random.sample(possible_choices, 1)[0]
def pick_many(self, choices, quantity):
return random.sample(set(choices), quantity)
return random.sample(list(choices), quantity)
def weighted_pick(self, choices, previous_choices=[]):
total = sum(weight for c, weight in choices)