1
0
mirror of synced 2024-11-23 22:10:59 +01:00

Fix sets not being compatible with random selections in Python 3.12.

This commit is contained in:
Jennifer Taylor 2024-09-01 20:42:20 +00:00
parent 2e8b85ab98
commit 3ee40f1162
7 changed files with 14 additions and 12 deletions

View File

@ -360,9 +360,9 @@ class JubeatBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
normalindex = 2
premiumindex = 1
if normalemblems:
normalindex = random.sample(normalemblems, 1)[0]
normalindex = random.sample(list(normalemblems), 1)[0]
if premiumemblems:
premiumindex = random.sample(premiumemblems, 1)[0]
premiumindex = random.sample(list(premiumemblems), 1)[0]
return normalindex, premiumindex

View File

@ -95,10 +95,12 @@ class JubeatClan(
# range, but it will be a different ID depending on the prefecture set in settings. This means its not safe to send
# these song IDs, so we explicitly exclude them.
start_time, end_time = data.local.network.get_schedule_duration("daily")
all_songs = set(
song.id
for song in data.local.music.get_all_songs(cls.game, cls.version)
if song.id not in cls.FIVE_PLAYS_UNLOCK_EVENT_SONG_IDS
all_songs = list(
set(
song.id
for song in data.local.music.get_all_songs(cls.game, cls.version)
if song.id not in cls.FIVE_PLAYS_UNLOCK_EVENT_SONG_IDS
)
)
if len(all_songs) >= 2:
daily_songs = random.sample(all_songs, 2)

View File

@ -151,7 +151,7 @@ class JubeatFesto(
if data.local.network.should_schedule(cls.game, cls.version, "fc_challenge", "daily"):
# Generate a new list of two FC challenge songs.
start_time, end_time = data.local.network.get_schedule_duration("daily")
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version))
all_songs = list(set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version)))
if len(all_songs) >= 2:
daily_songs = random.sample(all_songs, 2)
data.local.game.put_time_sensitive_settings(

View File

@ -335,7 +335,7 @@ class JubeatProp(
if data.local.network.should_schedule(cls.game, cls.version, "league_course", "weekly"):
# Generate a new league course list, save it to the DB.
start_time, end_time = data.local.network.get_schedule_duration("weekly")
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version))
all_songs = list(set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version)))
if len(all_songs) >= 3:
league_songs = random.sample(all_songs, 3)
data.local.game.put_time_sensitive_settings(
@ -382,7 +382,7 @@ class JubeatProp(
if data.local.network.should_schedule(cls.game, cls.version, "fc_challenge", "daily"):
# Generate a new list of two FC challenge songs.
start_time, end_time = data.local.network.get_schedule_duration("daily")
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version))
all_songs = list(set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version)))
if len(all_songs) >= 2:
daily_songs = random.sample(all_songs, 2)
data.local.game.put_time_sensitive_settings(

View File

@ -64,7 +64,7 @@ class JubeatQubell(
if data.local.network.should_schedule(cls.game, cls.version, "fc_challenge", "daily"):
# Generate a new list of two FC challenge songs.
start_time, end_time = data.local.network.get_schedule_duration("daily")
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version))
all_songs = list(set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version)))
if len(all_songs) >= 2:
daily_songs = random.sample(all_songs, 2)
data.local.game.put_time_sensitive_settings(

View File

@ -42,7 +42,7 @@ class JubeatSaucer(
if data.local.network.should_schedule(cls.game, cls.version, "fc_challenge", "daily"):
# Generate a new list of two FC challenge songs.
start_time, end_time = data.local.network.get_schedule_duration("daily")
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version))
all_songs = list(set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version)))
if all_songs:
today_song = random.sample(all_songs, 1)[0]
data.local.game.put_time_sensitive_settings(

View File

@ -54,7 +54,7 @@ class JubeatSaucerFulfill(
if data.local.network.should_schedule(cls.game, cls.version, "fc_challenge", "daily"):
# Generate a new list of two FC challenge songs.
start_time, end_time = data.local.network.get_schedule_duration("daily")
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version))
all_songs = list(set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version)))
if len(all_songs) >= 2:
daily_songs = random.sample(all_songs, 2)
data.local.game.put_time_sensitive_settings(