From 2eefd8b3f7fc134633656e0c6191c02d94ab59b5 Mon Sep 17 00:00:00 2001 From: Georg Krause Date: Wed, 12 Oct 2022 10:03:52 +0200 Subject: [PATCH] feat(python): Add support for python 3.11rc and testing --- .gitlab-ci.yml | 2 +- api/funkwhale_api/radios/radios.py | 5 +++-- changes/changelog.d/python3.11.enhancement | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 changes/changelog.d/python3.11.enhancement diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2db201f86..e01acd612 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -204,7 +204,7 @@ test_api: path: api/coverage.xml parallel: matrix: - - PY_VER: ["3.7", "3.8", "3.9", "3.10"] + - PY_VER: ["3.7", "3.8", "3.9", "3.10", "3.11-rc"] image: $CI_REGISTRY/funkwhale/backend-test-docker:$PY_VER test_front: diff --git a/api/funkwhale_api/radios/radios.py b/api/funkwhale_api/radios/radios.py index 126dac672..4b333b966 100644 --- a/api/funkwhale_api/radios/radios.py +++ b/api/funkwhale_api/radios/radios.py @@ -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) diff --git a/changes/changelog.d/python3.11.enhancement b/changes/changelog.d/python3.11.enhancement new file mode 100644 index 000000000..3ac1eaf2c --- /dev/null +++ b/changes/changelog.d/python3.11.enhancement @@ -0,0 +1 @@ +Add support for python 3.11