1
0
mirror of synced 2025-01-18 14:14:03 +01:00

Convert most of the format() string calls to f-strings using libcst.

Exact commands run were:

  python3 -m libcst.tool codemod convert_format_to_fstring.ConvertFormatStringCommand . --no-format
  python3 setup.py build_ext --inplace
This commit is contained in:
Jennifer Taylor 2020-01-07 21:29:07 +00:00
parent 8434950f67
commit 509cb4f0d9
127 changed files with 862 additions and 1343 deletions

View File

@ -8,7 +8,8 @@ Things that I have not gotten around to doing.
- Make the frontend work better on mobile. It works well enough, but it could be a much better experience.
- Support for DanEvo. I meant to do this but my DanEvo ended up in storage before I could tackle it, so the only thing that exists at the moment is a rudimentary music DB parser.
- Figure out phase/unlock/etc bits for some older IIDX and Pop'n Music versions and hook them up to the Arcade panel to allow switching events.
- Auto-prune events in the event log after some configured date. Currently it grows indefinitely which is fine for small hobby setups but could be a problem with lots of events.
General maintenance that I have not yet performed.
- Upgrade legacy uses of .format() to use f-strings instead.
- Upgrade legacy uses of .format() to use f-strings instead (partially done).

View File

@ -301,7 +301,7 @@ def lookup(protoversion: str, requestgame: str, requestversion: str) -> Dict[str
inst = handler(g.data, game, version, omnimix)
try:
fetchmethod = getattr(inst, 'fetch_{}'.format(protoversion))
fetchmethod = getattr(inst, f'fetch_{protoversion}')
except AttributeError:
# Don't know how to handle this object for this version
abort(501)

View File

@ -22,11 +22,7 @@ class CoreHandler(Base):
node.set_attribute('url', url)
return node
url = '{}://{}:{}/'.format(
'https' if self.config['server']['https'] else 'http',
self.config['server']['address'],
self.config['server']['port'],
)
url = f'{"https" if self.config["server"]["https"] else "http"}://{self.config["server"]["address"]}:{self.config["server"]["port"]}/'
root = Node.void('services')
root.set_attribute('expire', '600')
# This can be set to 'operation', 'debug', 'test', and 'factory'.
@ -58,13 +54,7 @@ class CoreHandler(Base):
keepalive = socket.gethostbyname(keepalive)
root.add_child(item(
'keepalive',
'http://{}/core/keepalive?pa={}&ia={}&ga={}&ma={}&t1=2&t2=10'.format(
keepalive,
keepalive,
keepalive,
keepalive,
keepalive,
),
f'http://{keepalive}/core/keepalive?pa={keepalive}&ia={keepalive}&ga={keepalive}&ma={keepalive}&t1=2&t2=10',
))
return root

View File

@ -215,7 +215,7 @@ class DDRBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
self.CHART_DOUBLE_EXPERT,
self.CHART_DOUBLE_CHALLENGE,
]:
raise Exception('Invalid chart {}'.format(chart))
raise Exception(f'Invalid chart {chart}')
if halo not in [
self.HALO_NONE,
self.HALO_GOOD_FULL_COMBO,
@ -223,7 +223,7 @@ class DDRBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
self.HALO_PERFECT_FULL_COMBO,
self.HALO_MARVELOUS_FULL_COMBO,
]:
raise Exception('Invalid halo {}'.format(halo))
raise Exception(f'Invalid halo {halo}')
if rank not in [
self.RANK_E,
self.RANK_D,
@ -242,7 +242,7 @@ class DDRBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
self.RANK_AA_PLUS,
self.RANK_AAA,
]:
raise Exception('Invalid rank {}'.format(rank))
raise Exception(f'Invalid rank {rank}')
if userid is not None:
oldscore = self.data.local.music.get_score(

View File

@ -187,7 +187,7 @@ class DDRGameScoreHandler(DDRBase):
# Return the most recent five scores
game = Node.void('game')
for i in range(len(recentscores)):
game.set_attribute('sc{}'.format(i + 1), str(recentscores[i]))
game.set_attribute(f'sc{i + 1}', str(recentscores[i]))
return game
@ -396,14 +396,14 @@ class DDRGameFriendHandler(DDRBase):
game.add_child(gr_s)
index = 1
for entry in friend.get_int_array('gr_s', 5):
gr_s.set_attribute('gr{}'.format(index), str(entry))
gr_s.set_attribute(f'gr{index}', str(entry))
index = index + 1
gr_d = Node.void('gr_d')
game.add_child(gr_d)
index = 1
for entry in friend.get_int_array('gr_d', 5):
gr_d.set_attribute('gr{}'.format(index), str(entry))
gr_d.set_attribute(f'gr{index}', str(entry))
index = index + 1
return game

View File

@ -376,7 +376,7 @@ class DDR2013(
root.add_child(result_star)
result_stars = profile.get_int_array('result_stars', 9)
for i in range(9):
result_star.set_attribute('slot{}'.format(i + 1), str(result_stars[i]))
result_star.set_attribute(f'slot{i + 1}', str(result_stars[i]))
# Target stuff
target = Node.void('target')
@ -389,14 +389,14 @@ class DDR2013(
root.add_child(gr_s)
index = 1
for entry in profile.get_int_array('gr_s', 5):
gr_s.set_attribute('gr{}'.format(index), str(entry))
gr_s.set_attribute(f'gr{index}', str(entry))
index = index + 1
gr_d = Node.void('gr_d')
root.add_child(gr_d)
index = 1
for entry in profile.get_int_array('gr_d', 5):
gr_d.set_attribute('gr{}'.format(index), str(entry))
gr_d.set_attribute(f'gr{index}', str(entry))
index = index + 1
# Options in menus
@ -458,14 +458,14 @@ class DDR2013(
friendnode.add_child(gr_s)
index = 1
for entry in friend.get_int_array('gr_s', 5):
gr_s.set_attribute('gr{}'.format(index), str(entry))
gr_s.set_attribute(f'gr{index}', str(entry))
index = index + 1
gr_d = Node.void('gr_d')
friendnode.add_child(gr_d)
index = 1
for entry in friend.get_int_array('gr_d', 5):
gr_d.set_attribute('gr{}'.format(index), str(entry))
gr_d.set_attribute(f'gr{index}', str(entry))
index = index + 1
# Play area
@ -473,7 +473,7 @@ class DDR2013(
play_area = Node.void('play_area')
root.add_child(play_area)
for i in range(len(areas)):
play_area.set_attribute('play_cnt{}'.format(i), str(areas[i]))
play_area.set_attribute(f'play_cnt{i}', str(areas[i]))
return root
@ -538,7 +538,7 @@ class DDR2013(
if title_gr is not None:
title_grdict.replace_int('s', title.value)
newprofile.replace_dict('title_gr', title_grdict)
play_stats.increment_int('cnt_m{}'.format(mode))
play_stats.increment_int(f'cnt_m{mode}')
# Result stars
result_star = request.child('result_star')
@ -695,7 +695,7 @@ class DDR2013(
self.game,
self.version,
userid,
'friend_{}'.format(i),
f'friend_{i}',
oldfriends[i],
)
elif oldfriends[i] is None:
@ -704,7 +704,7 @@ class DDR2013(
self.game,
self.version,
userid,
'friend_{}'.format(i),
f'friend_{i}',
newfriends[i],
{},
)
@ -714,14 +714,14 @@ class DDR2013(
self.game,
self.version,
userid,
'friend_{}'.format(i),
f'friend_{i}',
oldfriends[i],
)
self.data.local.user.put_link(
self.game,
self.version,
userid,
'friend_{}'.format(i),
f'friend_{i}',
newfriends[i],
{},
)

View File

@ -431,21 +431,21 @@ class DDR2014(
root.add_child(result_star)
result_stars = profile.get_int_array('result_stars', 9)
for i in range(9):
result_star.set_attribute('slot{}'.format(i + 1), str(result_stars[i]))
result_star.set_attribute(f'slot{i + 1}', str(result_stars[i]))
# Groove gauge level-ups
gr_s = Node.void('gr_s')
root.add_child(gr_s)
index = 1
for entry in profile.get_int_array('gr_s', 5):
gr_s.set_attribute('gr{}'.format(index), str(entry))
gr_s.set_attribute(f'gr{index}', str(entry))
index = index + 1
gr_d = Node.void('gr_d')
root.add_child(gr_d)
index = 1
for entry in profile.get_int_array('gr_d', 5):
gr_d.set_attribute('gr{}'.format(index), str(entry))
gr_d.set_attribute(f'gr{index}', str(entry))
index = index + 1
# Options in menus
@ -513,14 +513,14 @@ class DDR2014(
friendnode.add_child(gr_s)
index = 1
for entry in friend.get_int_array('gr_s', 5):
gr_s.set_attribute('gr{}'.format(index), str(entry))
gr_s.set_attribute(f'gr{index}', str(entry))
index = index + 1
gr_d = Node.void('gr_d')
friendnode.add_child(gr_d)
index = 1
for entry in friend.get_int_array('gr_d', 5):
gr_d.set_attribute('gr{}'.format(index), str(entry))
gr_d.set_attribute(f'gr{index}', str(entry))
index = index + 1
# Target stuff
@ -534,7 +534,7 @@ class DDR2014(
play_area = Node.void('play_area')
root.add_child(play_area)
for i in range(len(areas)):
play_area.set_attribute('play_cnt{}'.format(i), str(areas[i]))
play_area.set_attribute(f'play_cnt{i}', str(areas[i]))
return root
@ -599,7 +599,7 @@ class DDR2014(
if title_gr is not None:
title_grdict.replace_int('s', title.value)
newprofile.replace_dict('title_gr', title_grdict)
play_stats.increment_int('cnt_m{}'.format(mode))
play_stats.increment_int(f'cnt_m{mode}')
# Result stars
result_star = request.child('result_star')
@ -756,7 +756,7 @@ class DDR2014(
self.game,
self.version,
userid,
'friend_{}'.format(i),
f'friend_{i}',
oldfriends[i],
)
elif oldfriends[i] is None:
@ -765,7 +765,7 @@ class DDR2014(
self.game,
self.version,
userid,
'friend_{}'.format(i),
f'friend_{i}',
newfriends[i],
{},
)
@ -775,14 +775,14 @@ class DDR2014(
self.game,
self.version,
userid,
'friend_{}'.format(i),
f'friend_{i}',
oldfriends[i],
)
self.data.local.user.put_link(
self.game,
self.version,
userid,
'friend_{}'.format(i),
f'friend_{i}',
newfriends[i],
{},
)

View File

@ -539,7 +539,7 @@ class DDRAce(
for userid, score in scores:
if profiles_by_userid.get(userid) is None:
raise Exception('Logic error, couldn\'t find any profile for {}'.format(userid))
raise Exception(f'Logic error, couldn\'t find any profile for {userid}')
profiledata = profiles_by_userid[userid]
record = Node.void('record')
@ -756,7 +756,7 @@ class DDRAce(
3: self.GAME_RIVAL_SLOT_3_ACTIVE_OFFSET,
}[rivalno]
whichfriend = lastdict.get_int('rival{}'.format(rivalno)) - 1
whichfriend = lastdict.get_int(f'rival{rivalno}') - 1
if whichfriend < 0:
# This rival isn't active
rival[activeslot] = b'0'

View File

@ -435,14 +435,14 @@ class DDRX2(
root.add_child(gr_s)
index = 1
for entry in profile.get_int_array('gr_s', 5):
gr_s.set_attribute('gr{}'.format(index), str(entry))
gr_s.set_attribute(f'gr{index}', str(entry))
index = index + 1
gr_d = Node.void('gr_d')
root.add_child(gr_d)
index = 1
for entry in profile.get_int_array('gr_d', 5):
gr_d.set_attribute('gr{}'.format(index), str(entry))
gr_d.set_attribute(f'gr{index}', str(entry))
index = index + 1
# Options in menus
@ -504,14 +504,14 @@ class DDRX2(
friendnode.add_child(gr_s)
index = 1
for entry in friend.get_int_array('gr_s', 5):
gr_s.set_attribute('gr{}'.format(index), str(entry))
gr_s.set_attribute(f'gr{index}', str(entry))
index = index + 1
gr_d = Node.void('gr_d')
friendnode.add_child(gr_d)
index = 1
for entry in friend.get_int_array('gr_d', 5):
gr_d.set_attribute('gr{}'.format(index), str(entry))
gr_d.set_attribute(f'gr{index}', str(entry))
index = index + 1
return root
@ -577,7 +577,7 @@ class DDRX2(
if title_gr is not None:
title_grdict.replace_int('s', title.value)
newprofile.replace_dict('title_gr', title_grdict)
play_stats.increment_int('cnt_m{}'.format(mode))
play_stats.increment_int(f'cnt_m{mode}')
# Update last attributes
lastdict.replace_int('fri', intish(last.attribute('fri')))
@ -744,7 +744,7 @@ class DDRX2(
self.game,
self.version,
userid,
'friend_{}'.format(i),
f'friend_{i}',
oldfriends[i],
)
elif oldfriends[i] is None:
@ -753,7 +753,7 @@ class DDRX2(
self.game,
self.version,
userid,
'friend_{}'.format(i),
f'friend_{i}',
newfriends[i],
{},
)
@ -763,14 +763,14 @@ class DDRX2(
self.game,
self.version,
userid,
'friend_{}'.format(i),
f'friend_{i}',
oldfriends[i],
)
self.data.local.user.put_link(
self.game,
self.version,
userid,
'friend_{}'.format(i),
f'friend_{i}',
newfriends[i],
{},
)

View File

@ -451,7 +451,7 @@ class DDRX3(
root.add_child(result_star)
result_stars = profile.get_int_array('result_stars', 9)
for i in range(9):
result_star.set_attribute('slot{}'.format(i + 1), str(result_stars[i]))
result_star.set_attribute(f'slot{i + 1}', str(result_stars[i]))
# Target stuff
target = Node.void('target')
@ -464,14 +464,14 @@ class DDRX3(
root.add_child(gr_s)
index = 1
for entry in profile.get_int_array('gr_s', 5):
gr_s.set_attribute('gr{}'.format(index), str(entry))
gr_s.set_attribute(f'gr{index}', str(entry))
index = index + 1
gr_d = Node.void('gr_d')
root.add_child(gr_d)
index = 1
for entry in profile.get_int_array('gr_d', 5):
gr_d.set_attribute('gr{}'.format(index), str(entry))
gr_d.set_attribute(f'gr{index}', str(entry))
index = index + 1
# Options in menus
@ -533,14 +533,14 @@ class DDRX3(
friendnode.add_child(gr_s)
index = 1
for entry in friend.get_int_array('gr_s', 5):
gr_s.set_attribute('gr{}'.format(index), str(entry))
gr_s.set_attribute(f'gr{index}', str(entry))
index = index + 1
gr_d = Node.void('gr_d')
friendnode.add_child(gr_d)
index = 1
for entry in friend.get_int_array('gr_d', 5):
gr_d.set_attribute('gr{}'.format(index), str(entry))
gr_d.set_attribute(f'gr{index}', str(entry))
index = index + 1
# Play area
@ -548,7 +548,7 @@ class DDRX3(
play_area = Node.void('play_area')
root.add_child(play_area)
for i in range(len(areas)):
play_area.set_attribute('play_cnt{}'.format(i), str(areas[i]))
play_area.set_attribute(f'play_cnt{i}', str(areas[i]))
return root
@ -613,7 +613,7 @@ class DDRX3(
if title_gr is not None:
title_grdict.replace_int('s', title.value)
newprofile.replace_dict('title_gr', title_grdict)
play_stats.increment_int('cnt_m{}'.format(mode))
play_stats.increment_int(f'cnt_m{mode}')
# Result stars
result_star = request.child('result_star')
@ -770,7 +770,7 @@ class DDRX3(
self.game,
self.version,
userid,
'friend_{}'.format(i),
f'friend_{i}',
oldfriends[i],
)
elif oldfriends[i] is None:
@ -779,7 +779,7 @@ class DDRX3(
self.game,
self.version,
userid,
'friend_{}'.format(i),
f'friend_{i}',
newfriends[i],
{},
)
@ -789,14 +789,14 @@ class DDRX3(
self.game,
self.version,
userid,
'friend_{}'.format(i),
f'friend_{i}',
oldfriends[i],
)
self.data.local.user.put_link(
self.game,
self.version,
userid,
'friend_{}'.format(i),
f'friend_{i}',
newfriends[i],
{},
)

View File

@ -141,7 +141,7 @@ class Dispatch:
# First, try to handle with specific service/method function
try:
handler = getattr(game, 'handle_{}_{}_request'.format(request.name, method))
handler = getattr(game, f'handle_{request.name}_{method}_request')
except AttributeError:
handler = None
if handler is not None:
@ -150,7 +150,7 @@ class Dispatch:
if response is None:
# Now, try to pass it off to a generic service handler
try:
handler = getattr(game, 'handle_{}_request'.format(request.name))
handler = getattr(game, f'handle_{request.name}_request')
except AttributeError:
handler = None
if handler is not None:
@ -158,7 +158,7 @@ class Dispatch:
if response is None:
# Unrecognized handler
self.log("Unrecognized service {} method {}".format(request.name, method))
self.log(f"Unrecognized service {request.name} method {method}")
return None
# Make sure we have a status value if one wasn't provided

View File

@ -314,7 +314,7 @@ class IIDXBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
self.CLEAR_STATUS_EX_HARD_CLEAR,
self.CLEAR_STATUS_FULL_COMBO,
]:
raise Exception("Invalid clear status value {}".format(clear_status))
raise Exception(f"Invalid clear status value {clear_status}")
# Calculate ex score
ex_score = (2 * pgreats) + greats
@ -419,7 +419,7 @@ class IIDXBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
self.DAN_RANKING_SINGLE,
self.DAN_RANKING_DOUBLE,
]:
raise Exception("Invalid dan rank type value {}".format(dantype))
raise Exception(f"Invalid dan rank type value {dantype}")
# Range check rank
if rank not in [
@ -443,7 +443,7 @@ class IIDXBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
self.DAN_RANK_CHUDEN,
self.DAN_RANK_KAIDEN,
]:
raise Exception("Invalid dan rank {}".format(rank))
raise Exception(f"Invalid dan rank {rank}")
if cleared:
# Update profile if needed

View File

@ -522,7 +522,7 @@ class IIDXCopula(IIDXCourse, IIDXBase):
if rivalid == -1:
attr = 'iidxid'
else:
attr = 'iidxid{}'.format(rivalid)
attr = f'iidxid{rivalid}'
try:
extid = int(request.attribute(attr))

View File

@ -31,7 +31,7 @@ class IIDXCourse(IIDXBase):
self.COURSE_TYPE_INTERNET_RANKING,
self.COURSE_TYPE_CLASSIC,
]:
raise Exception("Invalid course type value {}".format(coursetype))
raise Exception(f"Invalid course type value {coursetype}")
# Range check medals
if clear_status not in [
@ -44,7 +44,7 @@ class IIDXCourse(IIDXBase):
self.CLEAR_STATUS_EX_HARD_CLEAR,
self.CLEAR_STATUS_FULL_COMBO,
]:
raise Exception("Invalid clear status value {}".format(clear_status))
raise Exception(f"Invalid clear status value {clear_status}")
# Update achievement to track course statistics
course_score = self.data.local.user.get_achievement(

View File

@ -505,7 +505,7 @@ class IIDXPendual(IIDXCourse, IIDXBase):
if rivalid == -1:
attr = 'iidxid'
else:
attr = 'iidxid{}'.format(rivalid)
attr = f'iidxid{rivalid}'
try:
extid = int(request.attribute(attr))

View File

@ -551,7 +551,7 @@ class IIDXSinobuz(IIDXCourse, IIDXBase):
if rivalid == -1:
attr = 'iidxid'
else:
attr = 'iidxid{}'.format(rivalid)
attr = f'iidxid{rivalid}'
try:
extid = int(request.attribute(attr))

View File

@ -454,7 +454,7 @@ class IIDXSpada(IIDXBase):
if rivalid == -1:
attr = 'iidxid'
else:
attr = 'iidxid{}'.format(rivalid)
attr = f'iidxid{rivalid}'
try:
extid = int(request.attribute(attr))

View File

@ -453,7 +453,7 @@ class IIDXTricoro(IIDXBase):
if rivalid == -1:
attr = 'iidxid'
else:
attr = 'iidxid{}'.format(rivalid)
attr = f'iidxid{rivalid}'
try:
extid = int(request.attribute(attr))

View File

@ -171,7 +171,7 @@ class JubeatBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
self.PLAY_MEDAL_NEARLY_EXCELLENT,
self.PLAY_MEDAL_EXCELLENT,
]:
raise Exception("Invalid medal value {}".format(medal))
raise Exception(f"Invalid medal value {medal}")
oldscore = self.data.local.music.get_score(
self.game,

View File

@ -1499,7 +1499,7 @@ class JubeatClan(
item = Node.void('item')
item_list.add_child(item)
item.set_attribute('id', str(itemid))
item.add_child(Node.s32('num', dropdata.get_int('item_{}'.format(itemid))))
item.add_child(Node.s32('num', dropdata.get_int(f'item_{itemid}')))
# Fill in category
fill_in_category = Node.void('fill_in_category')
@ -1663,7 +1663,7 @@ class JubeatClan(
olddrop.replace_int('exp', exp)
olddrop.replace_int('flag', flag)
for itemid, num in items.items():
olddrop.replace_int('item_{}'.format(itemid), num)
olddrop.replace_int(f'item_{itemid}', num)
# Save it as an achievement
self.data.local.user.put_achievement(

View File

@ -294,7 +294,7 @@ class JubeatProp(
elif direction == 'demote':
new_class, new_subclass = cls.__decrement_class(cur_class, cur_subclass)
else:
raise Exception('Logic error, unknown direction {}!'.format(direction))
raise Exception(f'Logic error, unknown direction {direction}!')
if new_class != cur_class or new_subclass != cur_subclass:
# If they've checked last time, set up the new old class.

View File

@ -195,7 +195,7 @@ class MusecaBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
self.CLEAR_TYPE_CLEARED,
self.CLEAR_TYPE_FULL_COMBO,
]:
raise Exception("Invalid clear type value {}".format(clear_type))
raise Exception(f"Invalid clear type value {clear_type}")
# Range check grade
if grade not in [
@ -209,7 +209,7 @@ class MusecaBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
self.GRADE_MASTERPIECE,
self.GRADE_PERFECT,
]:
raise Exception("Invalid grade value {}".format(grade))
raise Exception(f"Invalid grade value {grade}")
if userid is not None:
oldscore = self.data.local.music.get_score(

View File

@ -340,7 +340,7 @@ class Museca1(
self.version,
userid,
item_id,
'item_{}'.format(item_type),
f'item_{item_type}',
paramvals,
)

View File

@ -381,7 +381,7 @@ class Museca1Plus(
self.version,
userid,
item_id,
'item_{}'.format(item_type),
f'item_{item_type}',
paramvals,
)

View File

@ -191,7 +191,7 @@ class PopnMusicBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
self.PLAY_MEDAL_STAR_FULL_COMBO,
self.PLAY_MEDAL_PERFECT,
]:
raise Exception("Invalid medal value {}".format(medal))
raise Exception(f"Invalid medal value {medal}")
oldscore = self.data.local.music.get_score(
self.game,

View File

@ -246,7 +246,7 @@ class PopnMusicEclale(PopnMusicBase):
self.version,
userid,
itemid,
'item_{}'.format(itemtype),
f'item_{itemtype}',
{
'param': itemparam,
'is_new': True,
@ -688,7 +688,7 @@ class PopnMusicEclale(PopnMusicBase):
self.version,
userid,
itemid,
'item_{}'.format(itemtype),
f'item_{itemtype}',
{
'param': param,
'is_new': is_new,

View File

@ -201,7 +201,7 @@ class PopnMusicFantasia(PopnMusicBase):
netvs.add_child(Node.s8_array('jewelry', [0] * 15))
for dialog in [0, 1, 2, 3, 4, 5]:
# TODO: Configure this, maybe?
netvs.add_child(Node.string('dialog', 'dialog#{}'.format(dialog)))
netvs.add_child(Node.string('dialog', f'dialog#{dialog}'))
sp_data = Node.void('sp_data')
root.add_child(sp_data)

View File

@ -335,7 +335,7 @@ class PopnMusicLapistoria(PopnMusicBase):
netvs.add_child(Node.u32('netvs_play_cnt', 0))
for dialog in [0, 1, 2, 3, 4, 5]:
# TODO: Configure this, maybe?
netvs.add_child(Node.string('dialog', 'dialog#{}'.format(dialog)))
netvs.add_child(Node.string('dialog', f'dialog#{dialog}'))
# Set up config
config = Node.void('config')

View File

@ -210,7 +210,7 @@ class PopnMusicSunnyPark(PopnMusicBase):
netvs.add_child(Node.u8('netvs_play_cnt', 0))
for dialog in [0, 1, 2, 3, 4, 5]:
# TODO: Configure this, maybe?
netvs.add_child(Node.string('dialog', 'dialog#{}'.format(dialog)))
netvs.add_child(Node.string('dialog', f'dialog#{dialog}'))
sp_data = Node.void('sp_data')
root.add_child(sp_data)

View File

@ -363,7 +363,7 @@ class PopnMusicUsaNeko(PopnMusicBase):
achievements.append(
Achievement(
itemid,
'item_{}'.format(itemtype),
f'item_{itemtype}',
0,
{
'param': param,
@ -622,7 +622,7 @@ class PopnMusicUsaNeko(PopnMusicBase):
self.version,
userid,
itemid,
'item_{}'.format(itemtype),
f'item_{itemtype}',
{
'param': itemparam,
'is_new': True,
@ -1124,7 +1124,7 @@ class PopnMusicUsaNeko(PopnMusicBase):
self.version,
userid,
itemid,
'item_{}'.format(itemtype),
f'item_{itemtype}',
{
'param': param,
'is_new': is_new,

View File

@ -143,7 +143,7 @@ class ReflecBeatBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
self.CLEAR_TYPE_HARD_CLEARED,
self.CLEAR_TYPE_S_HARD_CLEARED,
]:
raise Exception("Invalid clear_type value {}".format(clear_type))
raise Exception(f"Invalid clear_type value {clear_type}")
# Range check combo type
if combo_type not in [
@ -152,7 +152,7 @@ class ReflecBeatBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
self.COMBO_TYPE_FULL_COMBO,
self.COMBO_TYPE_FULL_COMBO_ALL_JUST,
]:
raise Exception("Invalid combo_type value {}".format(combo_type))
raise Exception(f"Invalid combo_type value {combo_type}")
oldscore = self.data.local.music.get_score(
self.game,

View File

@ -60,8 +60,8 @@ class ReflecBeatColette(ReflecBeatBase):
self.COMBO_TYPE_FULL_COMBO_ALL_JUST,
]:
return self.GAME_CLEAR_TYPE_FULL_COMBO
raise Exception('Invalid db_combo_type {}'.format(db_combo_type))
raise Exception('Invalid db_clear_type {}'.format(db_clear_type))
raise Exception(f'Invalid db_combo_type {db_combo_type}')
raise Exception(f'Invalid db_clear_type {db_clear_type}')
def __game_to_db_clear_type(self, game_clear_type: int) -> Tuple[int, int]:
if game_clear_type == self.GAME_CLEAR_TYPE_NO_PLAY:
@ -75,7 +75,7 @@ class ReflecBeatColette(ReflecBeatBase):
if game_clear_type == self.GAME_CLEAR_TYPE_FULL_COMBO:
return (self.CLEAR_TYPE_CLEARED, self.COMBO_TYPE_FULL_COMBO)
raise Exception('Invalid game_clear_type {}'.format(game_clear_type))
raise Exception(f'Invalid game_clear_type {game_clear_type}')
def handle_pcb_error_request(self, request: Node) -> Node:
return Node.void('pcb')
@ -1068,7 +1068,7 @@ class ReflecBeatColette(ReflecBeatBase):
self.version,
userid,
item_id,
'item_{}'.format(item_type),
f'item_{item_type}',
{
'param': param,
},
@ -1170,7 +1170,7 @@ class ReflecBeatColette(ReflecBeatBase):
self.version,
userid,
eqpexp_id,
'eqpexp_{}'.format(eqpexp_stype),
f'eqpexp_{eqpexp_stype}',
) or ValidatedDict()
self.data.local.user.put_achievement(
@ -1178,7 +1178,7 @@ class ReflecBeatColette(ReflecBeatBase):
self.version,
userid,
eqpexp_id,
'eqpexp_{}'.format(eqpexp_stype),
f'eqpexp_{eqpexp_stype}',
{
'exp': data.get_int('exp') + eqpexp_exp,
},

View File

@ -90,7 +90,7 @@ class ReflecBeatGroovin(ReflecBeatBase):
return self.COMBO_TYPE_FULL_COMBO
if game_combo == self.GAME_COMBO_TYPE_FULL_COMBO_ALL_JUST:
return self.COMBO_TYPE_FULL_COMBO_ALL_JUST
raise Exception('Invalid game_combo value {}'.format(game_combo))
raise Exception(f'Invalid game_combo value {game_combo}')
def handle_pcb_rb4error_request(self, request: Node) -> Node:
return Node.void('pcb')
@ -1360,7 +1360,7 @@ class ReflecBeatGroovin(ReflecBeatBase):
self.version,
userid,
bank,
'player_param_{}'.format(item_type),
f'player_param_{item_type}',
{
'data': paramdata,
},
@ -1376,7 +1376,7 @@ class ReflecBeatGroovin(ReflecBeatBase):
# I assume this is copypasta, but I want to be sure
extid = child.child_value('user_id')
if extid != newprofile.get_int('extid'):
raise Exception('Unexpected user ID, got {} expecting {}'.format(extid, newprofile.get_int('extid')))
raise Exception(f'Unexpected user ID, got {extid} expecting {newprofile.get_int("extid")}')
episode_type = child.child_value('type')
episode_value0 = child.child_value('value0')
@ -1416,7 +1416,7 @@ class ReflecBeatGroovin(ReflecBeatBase):
self.version,
userid,
item_id,
'item_{}'.format(item_type),
f'item_{item_type}',
{
'param': param,
},
@ -1438,7 +1438,7 @@ class ReflecBeatGroovin(ReflecBeatBase):
self.version,
userid,
announce_id,
'announcement_{}'.format(announce_type),
f'announcement_{announce_type}',
{
'param': param,
'need': need,

View File

@ -61,8 +61,8 @@ class ReflecBeatLimelight(ReflecBeatBase):
]:
return self.GAME_CLEAR_TYPE_FULL_COMBO
raise Exception('Invalid db_combo_type {}'.format(db_combo_type))
raise Exception('Invalid db_clear_type {}'.format(db_clear_type))
raise Exception(f'Invalid db_combo_type {db_combo_type}')
raise Exception(f'Invalid db_clear_type {db_clear_type}')
def __game_to_db_clear_type(self, game_clear_type: int) -> Tuple[int, int]:
if game_clear_type == self.GAME_CLEAR_TYPE_NO_PLAY:
@ -74,7 +74,7 @@ class ReflecBeatLimelight(ReflecBeatBase):
if game_clear_type == self.GAME_CLEAR_TYPE_FULL_COMBO:
return (self.CLEAR_TYPE_CLEARED, self.COMBO_TYPE_FULL_COMBO)
raise Exception('Invalid game_clear_type {}'.format(game_clear_type))
raise Exception(f'Invalid game_clear_type {game_clear_type}')
def handle_log_exception_request(self, request: Node) -> Node:
return Node.void('log')
@ -812,7 +812,7 @@ class ReflecBeatLimelight(ReflecBeatBase):
self.version,
userid,
item_id,
'item_{}'.format(item_type),
f'item_{item_type}',
{
'param': param,
},

View File

@ -56,8 +56,8 @@ class ReflecBeat(ReflecBeatBase):
]:
return self.GAME_CLEAR_TYPE_FULL_COMBO
raise Exception('Invalid db_combo_type {}'.format(db_combo_type))
raise Exception('Invalid db_clear_type {}'.format(db_clear_type))
raise Exception(f'Invalid db_combo_type {db_combo_type}')
raise Exception(f'Invalid db_clear_type {db_clear_type}')
def __game_to_db_clear_type(self, game_clear_type: int, game_achievement_rate: int) -> Tuple[int, int]:
if game_clear_type == self.GAME_CLEAR_TYPE_NO_PLAY:
@ -70,7 +70,7 @@ class ReflecBeat(ReflecBeatBase):
if game_clear_type == self.GAME_CLEAR_TYPE_FULL_COMBO:
return (self.CLEAR_TYPE_CLEARED, self.COMBO_TYPE_FULL_COMBO)
raise Exception('Invalid game_clear_type {}'.format(game_clear_type))
raise Exception(f'Invalid game_clear_type {game_clear_type}')
def handle_log_pcb_status_request(self, request: Node) -> Node:
return Node.void('log')
@ -450,7 +450,7 @@ class ReflecBeat(ReflecBeatBase):
self.version,
userid,
item_id,
'item_{}'.format(item_type),
f'item_{item_type}',
{},
)

View File

@ -637,7 +637,7 @@ class ReflecBeatVolzza(ReflecBeatVolzzaBase):
self.version,
userid,
bank,
'player_param_{}'.format(item_type),
f'player_param_{item_type}',
{
'data': data,
},
@ -653,7 +653,7 @@ class ReflecBeatVolzza(ReflecBeatVolzzaBase):
# I assume this is copypasta, but I want to be sure
extid = child.child_value('user_id')
if extid != newprofile.get_int('extid'):
raise Exception('Unexpected user ID, got {} expecting {}'.format(extid, newprofile.get_int('extid')))
raise Exception(f'Unexpected user ID, got {extid} expecting {newprofile.get_int("extid")}')
episode_type = child.child_value('type')
episode_value0 = child.child_value('value0')
@ -693,7 +693,7 @@ class ReflecBeatVolzza(ReflecBeatVolzzaBase):
self.version,
userid,
item_id,
'item_{}'.format(item_type),
f'item_{item_type}',
{
'param': param,
},
@ -715,7 +715,7 @@ class ReflecBeatVolzza(ReflecBeatVolzzaBase):
self.version,
userid,
announce_id,
'announcement_{}'.format(announce_type),
f'announcement_{announce_type}',
{
'param': param,
'need': need,

View File

@ -753,7 +753,7 @@ class ReflecBeatVolzza2(ReflecBeatVolzzaBase):
self.version,
userid,
bank,
'player_param_{}'.format(item_type),
f'player_param_{item_type}',
{
'data': data,
},
@ -769,7 +769,7 @@ class ReflecBeatVolzza2(ReflecBeatVolzzaBase):
# I assume this is copypasta, but I want to be sure
extid = child.child_value('user_id')
if extid != newprofile.get_int('extid'):
raise Exception('Unexpected user ID, got {} expecting {}'.format(extid, newprofile.get_int('extid')))
raise Exception(f'Unexpected user ID, got {extid} expecting {newprofile.get_int("extid")}')
episode_type = child.child_value('type')
episode_value0 = child.child_value('value0')
@ -810,7 +810,7 @@ class ReflecBeatVolzza2(ReflecBeatVolzzaBase):
self.version,
userid,
item_id,
'item_{}'.format(item_type),
f'item_{item_type}',
{
'param': param,
'time': time,
@ -833,7 +833,7 @@ class ReflecBeatVolzza2(ReflecBeatVolzzaBase):
self.version,
userid,
announce_id,
'announcement_{}'.format(announce_type),
f'announcement_{announce_type}',
{
'param': param,
'need': need,

View File

@ -65,7 +65,7 @@ class ReflecBeatVolzzaBase(ReflecBeatBase):
return self.COMBO_TYPE_FULL_COMBO
if game_combo == self.GAME_COMBO_TYPE_FULL_COMBO_ALL_JUST:
return self.COMBO_TYPE_FULL_COMBO_ALL_JUST
raise Exception('Invalid game_combo value {}'.format(game_combo))
raise Exception(f'Invalid game_combo value {game_combo}')
def _add_event_info(self, root: Node) -> None:
# Overridden in subclasses

View File

@ -198,7 +198,7 @@ class SoundVoltexBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
self.CLEAR_TYPE_ULTIMATE_CHAIN,
self.CLEAR_TYPE_PERFECT_ULTIMATE_CHAIN,
]:
raise Exception("Invalid clear type value {}".format(clear_type))
raise Exception(f"Invalid clear type value {clear_type}")
# Range check grade
if grade not in [
@ -214,7 +214,7 @@ class SoundVoltexBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
self.GRADE_AAA_PLUS,
self.GRADE_S,
]:
raise Exception("Invalid clear type value {}".format(grade))
raise Exception(f"Invalid clear type value {grade}")
if userid is not None:
oldscore = self.data.local.music.get_score(

View File

@ -338,7 +338,7 @@ class SoundVoltexGravityWars(
self.version,
userid,
item_id[i],
'item_{}'.format(item_type[i]),
f'item_{item_type[i]}',
{
'param': param[i],
},

View File

@ -3318,7 +3318,7 @@ class SoundVoltexGravityWarsSeason1(
self.version,
userid,
item_id,
'item_{}'.format(item_type),
f'item_{item_type}',
{
'param': param,
},

View File

@ -4180,7 +4180,7 @@ class SoundVoltexGravityWarsSeason2(
self.version,
userid,
item_id,
'item_{}'.format(item_type),
f'item_{item_type}',
{
'param': param,
},
@ -4225,7 +4225,7 @@ class SoundVoltexGravityWarsSeason2(
self.version,
userid,
param_id,
'param_{}'.format(param_type),
f'param_{param_type}',
{
'param': param_param,
},

View File

@ -2271,7 +2271,7 @@ class SoundVoltexInfiniteInfection(
self.version,
userid,
item_id,
'item_{}'.format(item_type),
f'item_{item_type}',
{
'param': param,
},
@ -2476,7 +2476,7 @@ class SoundVoltexInfiniteInfection(
self.version,
userid,
item_id,
'item_{}'.format(item_type),
f'item_{item_type}',
{
'param': param,
},

View File

@ -41,12 +41,7 @@ class BaseClient:
method = tree.children[0].attribute('method')
return self.__proto.exchange(
'{}?model={}&module={}&method={}'.format(
path,
self.config['model'],
module,
method,
),
f'{path}?model={self.config["model"]}&module={module}&method={method}',
tree,
)
@ -92,7 +87,7 @@ class BaseClient:
"""
if not self.__assert_path(root, path):
raise Exception('Path \'{}\' not found in root node:\n{}'.format(path, root))
raise Exception(f'Path \'{path}\' not found in root node:\n{root}')
def verify_services_get(self, expected_services: List[str]=[]) -> None:
call = self.call_node()
@ -126,7 +121,7 @@ class BaseClient:
for service in expected_services:
if service not in returned_services:
raise Exception('Service \'{}\' expected but not returned'.format(service))
raise Exception(f'Service \'{service}\' expected but not returned')
def verify_pcbtracker_alive(self, ecflag: int = 1) -> bool:
call = self.call_node()
@ -262,7 +257,7 @@ class BaseClient:
# Verify that we weren't found
status = int(resp.child('cardmng').attribute('status'))
if status != self.CARD_NEW:
raise Exception('Card \'{}\' returned invalid status \'{}\''.format(card_id, status))
raise Exception(f'Card \'{card_id}\' returned invalid status \'{status}\'')
# Nothing to return
return None
@ -278,11 +273,11 @@ class BaseClient:
ecflag = int(resp.child('cardmng').attribute('ecflag'))
if binded != 0:
raise Exception('Card \'{}\' returned invalid binded value \'{}\''.format(card_id, binded))
raise Exception(f'Card \'{card_id}\' returned invalid binded value \'{binded}\'')
if newflag != 1:
raise Exception('Card \'{}\' returned invalid newflag value \'{}\''.format(card_id, newflag))
raise Exception(f'Card \'{card_id}\' returned invalid newflag value \'{newflag}\'')
if ecflag != (1 if paseli_enabled else 0):
raise Exception('Card \'{}\' returned invalid ecflag value \'{}\''.format(card_id, newflag))
raise Exception(f'Card \'{card_id}\' returned invalid ecflag value \'{newflag}\'')
# Return the refid
return resp.child('cardmng').attribute('refid')
@ -298,16 +293,16 @@ class BaseClient:
ecflag = int(resp.child('cardmng').attribute('ecflag'))
if binded != 1:
raise Exception('Card \'{}\' returned invalid binded value \'{}\''.format(card_id, binded))
raise Exception(f'Card \'{card_id}\' returned invalid binded value \'{binded}\'')
if newflag != 1:
raise Exception('Card \'{}\' returned invalid newflag value \'{}\''.format(card_id, newflag))
raise Exception(f'Card \'{card_id}\' returned invalid newflag value \'{newflag}\'')
if ecflag != (1 if paseli_enabled else 0):
raise Exception('Card \'{}\' returned invalid ecflag value \'{}\''.format(card_id, newflag))
raise Exception(f'Card \'{card_id}\' returned invalid ecflag value \'{newflag}\'')
# Return the refid
return resp.child('cardmng').attribute('refid')
else:
raise Exception('Unrecognized message type \'{}\''.format(msg_type))
raise Exception(f'Unrecognized message type \'{msg_type}\'')
def verify_cardmng_getrefid(self, card_id: str) -> str:
call = self.call_node()
@ -347,7 +342,7 @@ class BaseClient:
status = int(resp.child('cardmng').attribute('status'))
if status != (self.CARD_OK if correct else self.CARD_BAD_PIN):
raise Exception('Ref ID \'{}\' returned invalid status \'{}\''.format(ref_id, status))
raise Exception(f'Ref ID \'{ref_id}\' returned invalid status \'{status}\'')
def verify_eacoin_checkin(self, card_id: str) -> Tuple[str, int]:
call = self.call_node()
@ -392,7 +387,7 @@ class BaseClient:
newbalance = resp.child('eacoin').child_value('balance')
if balance - amount != newbalance:
raise Exception("Expected to get back balance {} but got {}".format(balance - amount, newbalance))
raise Exception(f"Expected to get back balance {balance - amount} but got {newbalance}")
def verify_eacoin_checkout(self, session: str) -> None:
call = self.call_node()

View File

@ -187,15 +187,15 @@ class TheStarBishiBashiClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Bishi doesn't read a new profile, it just writes out CSV for a blank one
self.verify_usergamedata_send(ref_id, msg_type='new')
else:
@ -206,7 +206,7 @@ class TheStarBishiBashiClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
if cardid is None:
# Verify profile saving

View File

@ -338,7 +338,7 @@ class DDR2013Client(BaseClient):
self.assert_path(resp, "response/game/flag")
self.assert_path(resp, "response/game/rank")
for i in range(55):
self.assert_path(resp, "response/game/play_area/@play_cnt{}".format(i))
self.assert_path(resp, f"response/game/play_area/@play_cnt{i}")
gr_s = resp.child('game/gr_s')
gr_d = resp.child('game/gr_d')
@ -537,15 +537,15 @@ class DDR2013Client(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Bishi doesn't read a new profile, it just writes out CSV for a blank one
self.verify_game_load(ref_id, msg_type='new')
self.verify_game_new(ref_id)
@ -557,7 +557,7 @@ class DDR2013Client(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify locking and unlocking profile ability
self.verify_game_lock(ref_id, 1)
@ -698,7 +698,7 @@ class DDR2013Client(BaseClient):
for score in dummyscores:
data = scores.get(score['id'], {}).get(score['chart'], None)
if data is None:
raise Exception('Expected to get score back for song {} chart {}!'.format(score['id'], score['chart']))
raise Exception(f'Expected to get score back for song {score["id"]} chart {score["chart"]}!')
# Verify the attributes of the score
expected_score = score.get('expected_score', score['score'])
@ -706,22 +706,16 @@ class DDR2013Client(BaseClient):
expected_halo = score.get('expected_halo', score['halo'])
if data['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], data['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{data["score"]}\'')
if data['rank'] != expected_rank:
raise Exception('Expected a rank of \'{}\' for song \'{}\' chart \'{}\' but got rank \'{}\''.format(
expected_rank, score['id'], score['chart'], data['rank'],
))
raise Exception(f'Expected a rank of \'{expected_rank}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got rank \'{data["rank"]}\'')
if data['halo'] != expected_halo:
raise Exception('Expected a halo of \'{}\' for song \'{}\' chart \'{}\' but got halo \'{}\''.format(
expected_halo, score['id'], score['chart'], data['halo'],
))
raise Exception(f'Expected a halo of \'{expected_halo}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got halo \'{data["halo"]}\'')
# Verify that the last score is our score
last_five = self.verify_game_score(ref_id, score['id'], score['chart'])
if last_five[0] != score['score']:
raise Exception('Invalid score returned for last five scores on song {} chart {}!'.format(score['id'], score['chart']))
raise Exception(f'Invalid score returned for last five scores on song {score["id"]} chart {score["chart"]}!')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -343,7 +343,7 @@ class DDR2014Client(BaseClient):
self.assert_path(resp, "response/game/target/@flag")
self.assert_path(resp, "response/game/target/@setnum")
for i in range(55):
self.assert_path(resp, "response/game/play_area/@play_cnt{}".format(i))
self.assert_path(resp, f"response/game/play_area/@play_cnt{i}")
gr_s = resp.child('game/gr_s')
gr_d = resp.child('game/gr_d')
@ -539,15 +539,15 @@ class DDR2014Client(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Bishi doesn't read a new profile, it just writes out CSV for a blank one
self.verify_game_load(ref_id, msg_type='new')
self.verify_game_new(ref_id)
@ -559,7 +559,7 @@ class DDR2014Client(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify locking and unlocking profile ability
self.verify_game_lock(ref_id, 1)
@ -695,7 +695,7 @@ class DDR2014Client(BaseClient):
for score in dummyscores:
data = scores.get(score['id'], {}).get(score['chart'], None)
if data is None:
raise Exception('Expected to get score back for song {} chart {}!'.format(score['id'], score['chart']))
raise Exception(f'Expected to get score back for song {score["id"]} chart {score["chart"]}!')
# Verify the attributes of the score
expected_score = score.get('expected_score', score['score'])
@ -703,17 +703,11 @@ class DDR2014Client(BaseClient):
expected_halo = score.get('expected_halo', score['halo'])
if data['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], data['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{data["score"]}\'')
if data['rank'] != expected_rank:
raise Exception('Expected a rank of \'{}\' for song \'{}\' chart \'{}\' but got rank \'{}\''.format(
expected_rank, score['id'], score['chart'], data['rank'],
))
raise Exception(f'Expected a rank of \'{expected_rank}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got rank \'{data["rank"]}\'')
if data['halo'] != expected_halo:
raise Exception('Expected a halo of \'{}\' for song \'{}\' chart \'{}\' but got halo \'{}\''.format(
expected_halo, score['id'], score['chart'], data['halo'],
))
raise Exception(f'Expected a halo of \'{expected_halo}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got halo \'{data["halo"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -595,7 +595,7 @@ class DDRAceClient(BaseClient):
profiledata['COMMON'][25] = self.NAME.encode('shift-jis')
else:
raise Exception('Unknown message type {}!'.format(msg_type))
raise Exception(f'Unknown message type {msg_type}!')
if send_only_common:
profiledata = {'COMMON': profiledata['COMMON']}
@ -707,16 +707,16 @@ class DDRAceClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
self.verify_system_convcardnumber(card)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
extid = self.verify_playerdata_usergamedata_advanced_usernew(ref_id)
self.verify_usergamedata_send(ref_id, extid, 'new')
self.verify_playerdata_usergamedata_advanced_inheritance(ref_id, location)
@ -735,7 +735,7 @@ class DDRAceClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
if cardid is None:
is_new, music = self.verify_playerdata_usergamedata_advanced_userload(ref_id)
@ -836,7 +836,7 @@ class DDRAceClient(BaseClient):
break
if actual is None:
raise Exception("Didn't find song {} chart {} in response!".format(expected['id'], expected['chart']))
raise Exception(f"Didn't find song {expected['id']} chart {expected['chart']} in response!")
if 'expected_score' in expected:
expected_score = expected['expected_score']
@ -852,17 +852,11 @@ class DDRAceClient(BaseClient):
expected_halo = expected['halo']
if actual['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, expected['id'], expected['chart'], actual['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got score \'{actual["score"]}\'')
if actual['rank'] != expected_rank:
raise Exception('Expected a rank of \'{}\' for song \'{}\' chart \'{}\' but got rank \'{}\''.format(
expected_rank, expected['id'], expected['chart'], actual['rank'],
))
raise Exception(f'Expected a rank of \'{expected_rank}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got rank \'{actual["rank"]}\'')
if actual['halo'] != expected_halo:
raise Exception('Expected a halo of \'{}\' for song \'{}\' chart \'{}\' but got halo \'{}\''.format(
expected_halo, expected['id'], expected['chart'], actual['halo'],
))
raise Exception(f'Expected a halo of \'{expected_halo}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got halo \'{actual["halo"]}\'')
# Now verify that the ghost for this score is what we saved
ghost = self.verify_playerdata_usergamedata_advanced_ghostload(ref_id, received['ghostid'])
@ -872,21 +866,13 @@ class DDRAceClient(BaseClient):
expected_ghost = expected['ghost']
if ghost['id'] != received['id']:
raise Exception('Wrong song ID \'{}\' returned for ghost, expected ID \'{}\''.format(
ghost['id'], received['id'],
))
raise Exception(f'Wrong song ID \'{ghost["id"]}\' returned for ghost, expected ID \'{received["id"]}\'')
if ghost['chart'] != received['chart']:
raise Exception('Wrong song chart \'{}\' returned for ghost, expected chart \'{}\''.format(
ghost['chart'], received['chart'],
))
raise Exception(f'Wrong song chart \'{ghost["chart"]}\' returned for ghost, expected chart \'{received["chart"]}\'')
if ghost['ghost'] != expected_ghost:
raise Exception('Wrong ghost data \'{}\' returned for ghost, expected \'{}\''.format(
ghost['ghost'], expected_ghost,
))
raise Exception(f'Wrong ghost data \'{ghost["ghost"]}\' returned for ghost, expected \'{expected_ghost}\'')
if ghost['extid'] != extid:
raise Exception('Wrong extid \'{}\' returned for ghost, expected \'{}\''.format(
ghost['extid'], extid,
))
raise Exception(f'Wrong extid \'{ghost["extid"]}\' returned for ghost, expected \'{extid}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -497,15 +497,15 @@ class DDRX2Client(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Bishi doesn't read a new profile, it just writes out CSV for a blank one
self.verify_game_load(ref_id, msg_type='new')
self.verify_game_new(ref_id)
@ -517,7 +517,7 @@ class DDRX2Client(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify locking and unlocking profile ability
self.verify_game_lock(ref_id, 1)
@ -652,7 +652,7 @@ class DDRX2Client(BaseClient):
for score in dummyscores:
data = scores.get(score['id'], {}).get(score['chart'], None)
if data is None:
raise Exception('Expected to get score back for song {} chart {}!'.format(score['id'], score['chart']))
raise Exception(f'Expected to get score back for song {score["id"]} chart {score["chart"]}!')
# Verify the attributes of the score
expected_score = score.get('expected_score', score['score'])
@ -660,22 +660,16 @@ class DDRX2Client(BaseClient):
expected_halo = score.get('expected_halo', score['halo'])
if data['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], data['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{data["score"]}\'')
if data['rank'] != expected_rank:
raise Exception('Expected a rank of \'{}\' for song \'{}\' chart \'{}\' but got rank \'{}\''.format(
expected_rank, score['id'], score['chart'], data['rank'],
))
raise Exception(f'Expected a rank of \'{expected_rank}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got rank \'{data["rank"]}\'')
if data['halo'] != expected_halo:
raise Exception('Expected a halo of \'{}\' for song \'{}\' chart \'{}\' but got halo \'{}\''.format(
expected_halo, score['id'], score['chart'], data['halo'],
))
raise Exception(f'Expected a halo of \'{expected_halo}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got halo \'{data["halo"]}\'')
# Verify that the last score is our score
last_five = self.verify_game_score(ref_id, score['id'], score['chart'])
if last_five[0] != score['score']:
raise Exception('Invalid score returned for last five scores on song {} chart {}!'.format(score['id'], score['chart']))
raise Exception(f'Invalid score returned for last five scores on song {score["id"]} chart {score["chart"]}!')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)
@ -739,7 +733,7 @@ class DDRX2Client(BaseClient):
for course in dummycourses:
data = courses.get(course['id'], {}).get(course['chart'], None)
if data is None:
raise Exception('Expected to get course back for course {} chart {}!'.format(course['id'], course['chart']))
raise Exception(f'Expected to get course back for course {course["id"]} chart {course["chart"]}!')
expected_score = course.get('expected_score', course['score'])
expected_combo = course.get('expected_combo', course['combo'])
@ -748,25 +742,15 @@ class DDRX2Client(BaseClient):
expected_combo_type = course.get('expected_combo_type', course['combo_type'])
if data['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for course \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, course['id'], course['chart'], data['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for course \'{course["id"]}\' chart \'{course["chart"]}\' but got score \'{data["score"]}\'')
if data['combo'] != expected_combo:
raise Exception('Expected a combo of \'{}\' for course \'{}\' chart \'{}\' but got combo \'{}\''.format(
expected_combo, course['id'], course['chart'], data['combo'],
))
raise Exception(f'Expected a combo of \'{expected_combo}\' for course \'{course["id"]}\' chart \'{course["chart"]}\' but got combo \'{data["combo"]}\'')
if data['rank'] != expected_rank:
raise Exception('Expected a rank of \'{}\' for course \'{}\' chart \'{}\' but got rank \'{}\''.format(
expected_rank, course['id'], course['chart'], data['rank'],
))
raise Exception(f'Expected a rank of \'{expected_rank}\' for course \'{course["id"]}\' chart \'{course["chart"]}\' but got rank \'{data["rank"]}\'')
if data['stage'] != expected_stage:
raise Exception('Expected a stage of \'{}\' for course \'{}\' chart \'{}\' but got stage \'{}\''.format(
expected_stage, course['id'], course['chart'], data['stage'],
))
raise Exception(f'Expected a stage of \'{expected_stage}\' for course \'{course["id"]}\' chart \'{course["chart"]}\' but got stage \'{data["stage"]}\'')
if data['combo_type'] != expected_combo_type:
raise Exception('Expected a combo_type of \'{}\' for course \'{}\' chart \'{}\' but got combo_type \'{}\''.format(
expected_combo_type, course['id'], course['chart'], data['combo_type'],
))
raise Exception(f'Expected a combo_type of \'{expected_combo_type}\' for course \'{course["id"]}\' chart \'{course["chart"]}\' but got combo_type \'{data["combo_type"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -312,7 +312,7 @@ class DDRX3Client(BaseClient):
self.assert_path(resp, "response/game/flag")
self.assert_path(resp, "response/game/rank")
for i in range(55):
self.assert_path(resp, "response/game/play_area/@play_cnt{}".format(i))
self.assert_path(resp, f"response/game/play_area/@play_cnt{i}")
gr_s = resp.child('game/gr_s')
gr_d = resp.child('game/gr_d')
@ -574,15 +574,15 @@ class DDRX3Client(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Bishi doesn't read a new profile, it just writes out CSV for a blank one
self.verify_game_load(ref_id, msg_type='new')
self.verify_game_new(ref_id)
@ -594,7 +594,7 @@ class DDRX3Client(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify locking and unlocking profile ability
self.verify_game_lock(ref_id, 1)
@ -775,7 +775,7 @@ class DDRX3Client(BaseClient):
for score in dummyscores:
data = scores.get(score['id'], {}).get(score['chart'], None)
if data is None:
raise Exception('Expected to get score back for song {} chart {}!'.format(score['id'], score['chart']))
raise Exception(f'Expected to get score back for song {score["id"]} chart {score["chart"]}!')
# Verify the attributes of the score
expected_score = score.get('expected_score', score['score'])
@ -786,31 +786,21 @@ class DDRX3Client(BaseClient):
if score['score'] != 0:
if data['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], data['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{data["score"]}\'')
if data['rank'] != expected_rank:
raise Exception('Expected a rank of \'{}\' for song \'{}\' chart \'{}\' but got rank \'{}\''.format(
expected_rank, score['id'], score['chart'], data['rank'],
))
raise Exception(f'Expected a rank of \'{expected_rank}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got rank \'{data["rank"]}\'')
if data['halo'] != expected_halo:
raise Exception('Expected a halo of \'{}\' for song \'{}\' chart \'{}\' but got halo \'{}\''.format(
expected_halo, score['id'], score['chart'], data['halo'],
))
raise Exception(f'Expected a halo of \'{expected_halo}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got halo \'{data["halo"]}\'')
# Verify that the last score is our score
last_five = self.verify_game_score(ref_id, score['id'], score['chart'])
if last_five[0] != score['score']:
raise Exception('Invalid score returned for last five scores on song {} chart {}!'.format(score['id'], score['chart']))
raise Exception(f'Invalid score returned for last five scores on song {score["id"]} chart {score["chart"]}!')
if score['score_2nd'] != 0:
if data['score_2nd'] != expected_score_2nd:
raise Exception('Expected a score_2nd of \'{}\' for song \'{}\' chart \'{}\' but got score_2nd \'{}\''.format(
expected_score_2nd, score['id'], score['chart'], data['score_2nd'],
))
raise Exception(f'Expected a score_2nd of \'{expected_score_2nd}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score_2nd \'{data["score_2nd"]}\'')
if data['rank_2nd'] != expected_rank_2nd:
raise Exception('Expected a rank_2nd of \'{}\' for song \'{}\' chart \'{}\' but got rank_2nd \'{}\''.format(
expected_rank_2nd, score['id'], score['chart'], data['rank_2nd'],
))
raise Exception(f'Expected a rank_2nd of \'{expected_rank_2nd}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got rank_2nd \'{data["rank_2nd"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)
@ -874,7 +864,7 @@ class DDRX3Client(BaseClient):
for course in dummycourses:
data = courses.get(course['id'], {}).get(course['chart'], None)
if data is None:
raise Exception('Expected to get course back for course {} chart {}!'.format(course['id'], course['chart']))
raise Exception(f'Expected to get course back for course {course["id"]} chart {course["chart"]}!')
expected_score = course.get('expected_score', course['score'])
expected_combo = course.get('expected_combo', course['combo'])
@ -883,25 +873,15 @@ class DDRX3Client(BaseClient):
expected_combo_type = course.get('expected_combo_type', course['combo_type'])
if data['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for course \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, course['id'], course['chart'], data['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for course \'{course["id"]}\' chart \'{course["chart"]}\' but got score \'{data["score"]}\'')
if data['combo'] != expected_combo:
raise Exception('Expected a combo of \'{}\' for course \'{}\' chart \'{}\' but got combo \'{}\''.format(
expected_combo, course['id'], course['chart'], data['combo'],
))
raise Exception(f'Expected a combo of \'{expected_combo}\' for course \'{course["id"]}\' chart \'{course["chart"]}\' but got combo \'{data["combo"]}\'')
if data['rank'] != expected_rank:
raise Exception('Expected a rank of \'{}\' for course \'{}\' chart \'{}\' but got rank \'{}\''.format(
expected_rank, course['id'], course['chart'], data['rank'],
))
raise Exception(f'Expected a rank of \'{expected_rank}\' for course \'{course["id"]}\' chart \'{course["chart"]}\' but got rank \'{data["rank"]}\'')
if data['stage'] != expected_stage:
raise Exception('Expected a stage of \'{}\' for course \'{}\' chart \'{}\' but got stage \'{}\''.format(
expected_stage, course['id'], course['chart'], data['stage'],
))
raise Exception(f'Expected a stage of \'{expected_stage}\' for course \'{course["id"]}\' chart \'{course["chart"]}\' but got stage \'{data["stage"]}\'')
if data['combo_type'] != expected_combo_type:
raise Exception('Expected a combo_type of \'{}\' for course \'{}\' chart \'{}\' but got combo_type \'{}\''.format(
expected_combo_type, course['id'], course['chart'], data['combo_type'],
))
raise Exception(f'Expected a combo_type of \'{expected_combo_type}\' for course \'{course["id"]}\' chart \'{course["chart"]}\' but got combo_type \'{data["combo_type"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -85,12 +85,12 @@ class IIDXCopulaClient(BaseClient):
self.assert_path(resp, "response/IIDX23music")
for child in resp.child("IIDX23music").children:
if child.name != 'c':
raise Exception('Invalid node {} in clear rate response!'.format(child))
raise Exception(f'Invalid node {child} in clear rate response!')
if len(child.value) != 12:
raise Exception('Invalid node data {} in clear rate response!'.format(child))
raise Exception(f'Invalid node data {child} in clear rate response!')
for v in child.value:
if v < 0 or v > 101:
raise Exception('Invalid clear percent {} in clear rate response!'.format(child))
raise Exception(f'Invalid clear percent {child} in clear rate response!')
def verify_iidx23shop_getconvention(self, lid: str) -> None:
call = self.call_node()
@ -209,7 +209,7 @@ class IIDXCopulaClient(BaseClient):
name = resp.child('IIDX23pc/pcdata').attribute('name')
if name != self.NAME:
raise Exception('Invalid name \'{}\' returned for Ref ID \'{}\''.format(name, ref_id))
raise Exception(f'Invalid name \'{name}\' returned for Ref ID \'{ref_id}\'')
# Extract and return account data
ir_data: Dict[int, Dict[int, Dict[str, int]]] = {}
@ -657,15 +657,15 @@ class IIDXCopulaClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
self.verify_iidx23pc_reg(ref_id, card, lid)
self.verify_iidx23pc_get(ref_id, card, lid)
else:
@ -676,7 +676,7 @@ class IIDXCopulaClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
if cardid is None:
# Verify score handling
@ -770,7 +770,7 @@ class IIDXCopulaClient(BaseClient):
for score in dummyscores:
data = scores.get(score['id'], {}).get(score['chart'], None)
if data is None:
raise Exception('Expected to get score back for song {} chart {}!'.format(score['id'], score['chart']))
raise Exception(f'Expected to get score back for song {score["id"]} chart {score["chart"]}!')
if 'expected_ex_score' in score:
expected_score = score['expected_ex_score']
@ -786,30 +786,22 @@ class IIDXCopulaClient(BaseClient):
expected_miss_count = score['mnum']
if data['ex_score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], data['ex_score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{data["ex_score"]}\'')
if data['clear_status'] != expected_clear_status:
raise Exception('Expected a clear status of \'{}\' for song \'{}\' chart \'{}\' but got clear status \'{}\''.format(
expected_clear_status, score['id'], score['chart'], data['clear_status'],
))
raise Exception(f'Expected a clear status of \'{expected_clear_status}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got clear status \'{data["clear_status"]}\'')
if data['miss_count'] != expected_miss_count:
raise Exception('Expected a miss count of \'{}\' for song \'{}\' chart \'{}\' but got miss count \'{}\''.format(
expected_miss_count, score['id'], score['chart'], data['miss_count'],
))
raise Exception(f'Expected a miss count of \'{expected_miss_count}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got miss count \'{data["miss_count"]}\'')
# Verify we can fetch our own ghost
ex_score, ghost = self.verify_iidx23music_appoint(profile['extid'], score['id'], score['chart'])
if ex_score != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], data['ex_score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{data["ex_score"]}\'')
if len(ghost) != 64:
raise Exception('Wrong ghost length {} for ghost!'.format(len(ghost)))
raise Exception(f'Wrong ghost length {len(ghost)} for ghost!')
for g in ghost:
if g != 0x01:
raise Exception('Got back wrong ghost data for song \'{}\' chart \'{}\''.format(score['id'], score['chart']))
raise Exception(f'Got back wrong ghost data for song \'{score["id"]}\' chart \'{score["chart"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)
@ -866,9 +858,9 @@ class IIDXCopulaClient(BaseClient):
})
scores = self.verify_iidx23music_getrank(profile['extid'])
if 1000 not in scores:
raise Exception('Didn\'t get expected scores back for song {} beginner chart!'.format(1000))
raise Exception(f'Didn\'t get expected scores back for song {1000} beginner chart!')
if 6 not in scores[1000]:
raise Exception('Didn\'t get beginner score back for song {}!'.format(1000))
raise Exception(f'Didn\'t get beginner score back for song {1000}!')
if scores[1000][6] != {'clear_status': 4, 'ex_score': -1, 'miss_count': -1}:
raise Exception('Didn\'t get correct status back from beginner save!')
@ -887,7 +879,7 @@ class IIDXCopulaClient(BaseClient):
profile = self.verify_iidx23pc_get(ref_id, card, lid)
for ptype in ['ir_data', 'secret_course_data']:
if profile[ptype] != {2: {1: {'clear_status': 4, 'pgnum': 1771, 'gnum': 967}}}:
raise Exception('Invalid data {} returned on profile load for {}!'.format(profile[ptype], ptype))
raise Exception(f'Invalid data {profile[ptype]} returned on profile load for {ptype}!')
else:
print("Skipping score checks for existing card")

View File

@ -85,12 +85,12 @@ class IIDXPendualClient(BaseClient):
self.assert_path(resp, "response/IIDX22music")
for child in resp.child("IIDX22music").children:
if child.name != 'c':
raise Exception('Invalid node {} in clear rate response!'.format(child))
raise Exception(f'Invalid node {child} in clear rate response!')
if len(child.value) != 12:
raise Exception('Invalid node data {} in clear rate response!'.format(child))
raise Exception(f'Invalid node data {child} in clear rate response!')
for v in child.value:
if v < 0 or v > 101:
raise Exception('Invalid clear percent {} in clear rate response!'.format(child))
raise Exception(f'Invalid clear percent {child} in clear rate response!')
def verify_iidx22shop_getconvention(self, lid: str) -> None:
call = self.call_node()
@ -210,7 +210,7 @@ class IIDXPendualClient(BaseClient):
name = resp.child('IIDX22pc/pcdata').attribute('name')
if name != self.NAME:
raise Exception('Invalid name \'{}\' returned for Ref ID \'{}\''.format(name, ref_id))
raise Exception(f'Invalid name \'{name}\' returned for Ref ID \'{ref_id}\'')
# Extract and return account data
ir_data: Dict[int, Dict[int, Dict[str, int]]] = {}
@ -658,15 +658,15 @@ class IIDXPendualClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
self.verify_iidx22pc_reg(ref_id, card, lid)
self.verify_iidx22pc_get(ref_id, card, lid)
else:
@ -677,7 +677,7 @@ class IIDXPendualClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
if cardid is None:
# Verify score handling
@ -771,7 +771,7 @@ class IIDXPendualClient(BaseClient):
for score in dummyscores:
data = scores.get(score['id'], {}).get(score['chart'], None)
if data is None:
raise Exception('Expected to get score back for song {} chart {}!'.format(score['id'], score['chart']))
raise Exception(f'Expected to get score back for song {score["id"]} chart {score["chart"]}!')
if 'expected_ex_score' in score:
expected_score = score['expected_ex_score']
@ -787,30 +787,22 @@ class IIDXPendualClient(BaseClient):
expected_miss_count = score['mnum']
if data['ex_score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], data['ex_score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{data["ex_score"]}\'')
if data['clear_status'] != expected_clear_status:
raise Exception('Expected a clear status of \'{}\' for song \'{}\' chart \'{}\' but got clear status \'{}\''.format(
expected_clear_status, score['id'], score['chart'], data['clear_status'],
))
raise Exception(f'Expected a clear status of \'{expected_clear_status}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got clear status \'{data["clear_status"]}\'')
if data['miss_count'] != expected_miss_count:
raise Exception('Expected a miss count of \'{}\' for song \'{}\' chart \'{}\' but got miss count \'{}\''.format(
expected_miss_count, score['id'], score['chart'], data['miss_count'],
))
raise Exception(f'Expected a miss count of \'{expected_miss_count}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got miss count \'{data["miss_count"]}\'')
# Verify we can fetch our own ghost
ex_score, ghost = self.verify_iidx22music_appoint(profile['extid'], score['id'], score['chart'])
if ex_score != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], data['ex_score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{data["ex_score"]}\'')
if len(ghost) != 64:
raise Exception('Wrong ghost length {} for ghost!'.format(len(ghost)))
raise Exception(f'Wrong ghost length {len(ghost)} for ghost!')
for g in ghost:
if g != 0x01:
raise Exception('Got back wrong ghost data for song \'{}\' chart \'{}\''.format(score['id'], score['chart']))
raise Exception(f'Got back wrong ghost data for song \'{score["id"]}\' chart \'{score["chart"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)
@ -867,9 +859,9 @@ class IIDXPendualClient(BaseClient):
})
scores = self.verify_iidx22music_getrank(profile['extid'])
if 1000 not in scores:
raise Exception('Didn\'t get expected scores back for song {} beginner chart!'.format(1000))
raise Exception(f'Didn\'t get expected scores back for song {1000} beginner chart!')
if 6 not in scores[1000]:
raise Exception('Didn\'t get beginner score back for song {}!'.format(1000))
raise Exception(f'Didn\'t get beginner score back for song {1000}!')
if scores[1000][6] != {'clear_status': 4, 'ex_score': -1, 'miss_count': -1}:
raise Exception('Didn\'t get correct status back from beginner save!')
@ -888,7 +880,7 @@ class IIDXPendualClient(BaseClient):
profile = self.verify_iidx22pc_get(ref_id, card, lid)
for ptype in ['ir_data', 'secret_course_data']:
if profile[ptype] != {2: {1: {'clear_status': 4, 'pgnum': 1771, 'gnum': 967}}}:
raise Exception('Invalid data {} returned on profile load for {}!'.format(profile[ptype], ptype))
raise Exception(f'Invalid data {profile[ptype]} returned on profile load for {ptype}!')
else:
print("Skipping score checks for existing card")

View File

@ -87,12 +87,12 @@ class IIDXSinobuzClient(BaseClient):
self.assert_path(resp, "response/IIDX24music")
for child in resp.child("IIDX24music").children:
if child.name != 'c':
raise Exception('Invalid node {} in clear rate response!'.format(child))
raise Exception(f'Invalid node {child} in clear rate response!')
if len(child.value) != 12:
raise Exception('Invalid node data {} in clear rate response!'.format(child))
raise Exception(f'Invalid node data {child} in clear rate response!')
for v in child.value:
if v < 0 or v > 1001:
raise Exception('Invalid clear percent {} in clear rate response!'.format(child))
raise Exception(f'Invalid clear percent {child} in clear rate response!')
def verify_iidx24shop_getconvention(self, lid: str) -> None:
call = self.call_node()
@ -220,7 +220,7 @@ class IIDXSinobuzClient(BaseClient):
name = resp.child('IIDX24pc/pcdata').attribute('name')
if name != self.NAME:
raise Exception('Invalid name \'{}\' returned for Ref ID \'{}\''.format(name, ref_id))
raise Exception(f'Invalid name \'{name}\' returned for Ref ID \'{ref_id}\'')
# Extract and return account data
ir_data: Dict[int, Dict[int, Dict[str, int]]] = {}
@ -705,15 +705,15 @@ class IIDXSinobuzClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
self.verify_iidx24pc_reg(ref_id, card, lid)
self.verify_iidx24pc_get(ref_id, card, lid)
else:
@ -724,7 +724,7 @@ class IIDXSinobuzClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
if cardid is None:
# Verify score handling
@ -818,7 +818,7 @@ class IIDXSinobuzClient(BaseClient):
for score in dummyscores:
data = scores.get(score['id'], {}).get(score['chart'], None)
if data is None:
raise Exception('Expected to get score back for song {} chart {}!'.format(score['id'], score['chart']))
raise Exception(f'Expected to get score back for song {score["id"]} chart {score["chart"]}!')
if 'expected_ex_score' in score:
expected_score = score['expected_ex_score']
@ -834,30 +834,22 @@ class IIDXSinobuzClient(BaseClient):
expected_miss_count = score['mnum']
if data['ex_score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], data['ex_score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{data["ex_score"]}\'')
if data['clear_status'] != expected_clear_status:
raise Exception('Expected a clear status of \'{}\' for song \'{}\' chart \'{}\' but got clear status \'{}\''.format(
expected_clear_status, score['id'], score['chart'], data['clear_status'],
))
raise Exception(f'Expected a clear status of \'{expected_clear_status}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got clear status \'{data["clear_status"]}\'')
if data['miss_count'] != expected_miss_count:
raise Exception('Expected a miss count of \'{}\' for song \'{}\' chart \'{}\' but got miss count \'{}\''.format(
expected_miss_count, score['id'], score['chart'], data['miss_count'],
))
raise Exception(f'Expected a miss count of \'{expected_miss_count}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got miss count \'{data["miss_count"]}\'')
# Verify we can fetch our own ghost
ex_score, ghost = self.verify_iidx24music_appoint(profile['extid'], score['id'], score['chart'])
if ex_score != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], data['ex_score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{data["ex_score"]}\'')
if len(ghost) != 64:
raise Exception('Wrong ghost length {} for ghost!'.format(len(ghost)))
raise Exception(f'Wrong ghost length {len(ghost)} for ghost!')
for g in ghost:
if g != 0x01:
raise Exception('Got back wrong ghost data for song \'{}\' chart \'{}\''.format(score['id'], score['chart']))
raise Exception(f'Got back wrong ghost data for song \'{score["id"]}\' chart \'{score["chart"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)
@ -914,9 +906,9 @@ class IIDXSinobuzClient(BaseClient):
})
scores = self.verify_iidx24music_getrank(profile['extid'])
if 1000 not in scores:
raise Exception('Didn\'t get expected scores back for song {} beginner chart!'.format(1000))
raise Exception(f'Didn\'t get expected scores back for song {1000} beginner chart!')
if 6 not in scores[1000]:
raise Exception('Didn\'t get beginner score back for song {}!'.format(1000))
raise Exception(f'Didn\'t get beginner score back for song {1000}!')
if scores[1000][6] != {'clear_status': 4, 'ex_score': -1, 'miss_count': -1}:
raise Exception('Didn\'t get correct status back from beginner save!')
@ -936,7 +928,7 @@ class IIDXSinobuzClient(BaseClient):
profile = self.verify_iidx24pc_get(ref_id, card, lid)
for ptype in ['ir_data', 'secret_course_data', 'classic_course_data']:
if profile[ptype] != {2: {1: {'clear_status': 4, 'pgnum': 1771, 'gnum': 967}}}:
raise Exception('Invalid data {} returned on profile load for {}!'.format(profile[ptype], ptype))
raise Exception(f'Invalid data {profile[ptype]} returned on profile load for {ptype}!')
else:
print("Skipping score checks for existing card")

View File

@ -87,12 +87,12 @@ class IIDXSpadaClient(BaseClient):
self.assert_path(resp, "response/IIDX21music")
for child in resp.child("IIDX21music").children:
if child.name != 'c':
raise Exception('Invalid node {} in clear rate response!'.format(child))
raise Exception(f'Invalid node {child} in clear rate response!')
if len(child.value) != 12:
raise Exception('Invalid node data {} in clear rate response!'.format(child))
raise Exception(f'Invalid node data {child} in clear rate response!')
for v in child.value:
if v < 0 or v > 101:
raise Exception('Invalid clear percent {} in clear rate response!'.format(child))
raise Exception(f'Invalid clear percent {child} in clear rate response!')
def verify_iidx21shop_getconvention(self, lid: str) -> None:
call = self.call_node()
@ -210,7 +210,7 @@ class IIDXSpadaClient(BaseClient):
name = resp.child('IIDX21pc/pcdata').attribute('name')
if name != self.NAME:
raise Exception('Invalid name \'{}\' returned for Ref ID \'{}\''.format(name, ref_id))
raise Exception(f'Invalid name \'{name}\' returned for Ref ID \'{ref_id}\'')
return {
'extid': int(resp.child('IIDX21pc/pcdata').attribute('id')),
@ -575,15 +575,15 @@ class IIDXSpadaClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
self.verify_iidx21pc_reg(ref_id, card, lid)
self.verify_iidx21pc_get(ref_id, card, lid)
else:
@ -594,7 +594,7 @@ class IIDXSpadaClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
if cardid is None:
# Verify score handling
@ -682,7 +682,7 @@ class IIDXSpadaClient(BaseClient):
for score in dummyscores:
data = scores.get(score['id'], {}).get(score['chart'], None)
if data is None:
raise Exception('Expected to get score back for song {} chart {}!'.format(score['id'], score['chart']))
raise Exception(f'Expected to get score back for song {score["id"]} chart {score["chart"]}!')
if 'expected_ex_score' in score:
expected_score = score['expected_ex_score']
@ -698,30 +698,22 @@ class IIDXSpadaClient(BaseClient):
expected_miss_count = score['mnum']
if data['ex_score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], data['ex_score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{data["ex_score"]}\'')
if data['clear_status'] != expected_clear_status:
raise Exception('Expected a clear status of \'{}\' for song \'{}\' chart \'{}\' but got clear status \'{}\''.format(
expected_clear_status, score['id'], score['chart'], data['clear_status'],
))
raise Exception(f'Expected a clear status of \'{expected_clear_status}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got clear status \'{data["clear_status"]}\'')
if data['miss_count'] != expected_miss_count:
raise Exception('Expected a miss count of \'{}\' for song \'{}\' chart \'{}\' but got miss count \'{}\''.format(
expected_miss_count, score['id'], score['chart'], data['miss_count'],
))
raise Exception(f'Expected a miss count of \'{expected_miss_count}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got miss count \'{data["miss_count"]}\'')
# Verify we can fetch our own ghost
ex_score, ghost = self.verify_iidx21music_appoint(profile['extid'], score['id'], score['chart'])
if ex_score != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], data['ex_score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{data["ex_score"]}\'')
if len(ghost) != 64:
raise Exception('Wrong ghost length {} for ghost!'.format(len(ghost)))
raise Exception(f'Wrong ghost length {len(ghost)} for ghost!')
for g in ghost:
if g != 0x01:
raise Exception('Got back wrong ghost data for song \'{}\' chart \'{}\''.format(score['id'], score['chart']))
raise Exception(f'Got back wrong ghost data for song \'{score["id"]}\' chart \'{score["chart"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)
@ -756,9 +748,9 @@ class IIDXSpadaClient(BaseClient):
})
scores = self.verify_iidx21music_getrank(profile['extid'])
if 1000 not in scores:
raise Exception('Didn\'t get expected scores back for song {} beginner chart!'.format(1000))
raise Exception(f'Didn\'t get expected scores back for song {1000} beginner chart!')
if 6 not in scores[1000]:
raise Exception('Didn\'t get beginner score back for song {}!'.format(1000))
raise Exception(f'Didn\'t get beginner score back for song {1000}!')
if scores[1000][6] != {'clear_status': 4, 'ex_score': -1, 'miss_count': -1}:
raise Exception('Didn\'t get correct status back from beginner save!')

View File

@ -84,12 +84,12 @@ class IIDXTricoroClient(BaseClient):
self.assert_path(resp, "response/music")
for child in resp.child("music").children:
if child.name != 'c':
raise Exception('Invalid node {} in clear rate response!'.format(child))
raise Exception(f'Invalid node {child} in clear rate response!')
if len(child.value) != 12:
raise Exception('Invalid node data {} in clear rate response!'.format(child))
raise Exception(f'Invalid node data {child} in clear rate response!')
for v in child.value:
if v < 0 or v > 101:
raise Exception('Invalid clear percent {} in clear rate response!'.format(child))
raise Exception(f'Invalid clear percent {child} in clear rate response!')
def verify_shop_getconvention(self, lid: str) -> None:
call = self.call_node()
@ -205,7 +205,7 @@ class IIDXTricoroClient(BaseClient):
name = resp.child('pc/pcdata').attribute('name')
if name != self.NAME:
raise Exception('Invalid name \'{}\' returned for Ref ID \'{}\''.format(name, ref_id))
raise Exception(f'Invalid name \'{name}\' returned for Ref ID \'{ref_id}\'')
return {
'extid': int(resp.child('pc/pcdata').attribute('id')),
@ -545,15 +545,15 @@ class IIDXTricoroClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
self.verify_pc_reg(ref_id, card, lid)
self.verify_pc_get(ref_id, card, lid)
else:
@ -564,7 +564,7 @@ class IIDXTricoroClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
if cardid is None:
# Verify score handling
@ -652,7 +652,7 @@ class IIDXTricoroClient(BaseClient):
for score in dummyscores:
data = scores.get(score['id'], {}).get(score['chart'], None)
if data is None:
raise Exception('Expected to get score back for song {} chart {}!'.format(score['id'], score['chart']))
raise Exception(f'Expected to get score back for song {score["id"]} chart {score["chart"]}!')
if 'expected_ex_score' in score:
expected_score = score['expected_ex_score']
@ -668,30 +668,22 @@ class IIDXTricoroClient(BaseClient):
expected_miss_count = score['mnum']
if data['ex_score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], data['ex_score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{data["ex_score"]}\'')
if data['clear_status'] != expected_clear_status:
raise Exception('Expected a clear status of \'{}\' for song \'{}\' chart \'{}\' but got clear status \'{}\''.format(
expected_clear_status, score['id'], score['chart'], data['clear_status'],
))
raise Exception(f'Expected a clear status of \'{expected_clear_status}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got clear status \'{data["clear_status"]}\'')
if data['miss_count'] != expected_miss_count:
raise Exception('Expected a miss count of \'{}\' for song \'{}\' chart \'{}\' but got miss count \'{}\''.format(
expected_miss_count, score['id'], score['chart'], data['miss_count'],
))
raise Exception(f'Expected a miss count of \'{expected_miss_count}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got miss count \'{data["miss_count"]}\'')
# Verify we can fetch our own ghost
ex_score, ghost = self.verify_music_appoint(profile['extid'], score['id'], score['chart'])
if ex_score != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], data['ex_score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{data["ex_score"]}\'')
if len(ghost) != 64:
raise Exception('Wrong ghost length {} for ghost!'.format(len(ghost)))
raise Exception(f'Wrong ghost length {len(ghost)} for ghost!')
for g in ghost:
if g != 0x01:
raise Exception('Got back wrong ghost data for song \'{}\' chart \'{}\''.format(score['id'], score['chart']))
raise Exception(f'Got back wrong ghost data for song \'{score["id"]}\' chart \'{score["chart"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)
@ -726,9 +718,9 @@ class IIDXTricoroClient(BaseClient):
})
scores = self.verify_music_getrank(profile['extid'])
if 1000 not in scores:
raise Exception('Didn\'t get expected scores back for song {} beginner chart!'.format(1000))
raise Exception(f'Didn\'t get expected scores back for song {1000} beginner chart!')
if 6 not in scores[1000]:
raise Exception('Didn\'t get beginner score back for song {}!'.format(1000))
raise Exception(f'Didn\'t get beginner score back for song {1000}!')
if scores[1000][6] != {'clear_status': 4, 'ex_score': -1, 'miss_count': -1}:
raise Exception('Didn\'t get correct status back from beginner save!')

View File

@ -154,7 +154,7 @@ class JubeatClanClient(BaseClient):
'mtg_hold_cnt',
'mtg_result',
]:
self.assert_path(resp, "response/gametop/data/player/info/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/info/{item}")
for item in [
'music_list',
@ -169,7 +169,7 @@ class JubeatClanClient(BaseClient):
'new/theme_list',
'new/marker_list',
]:
self.assert_path(resp, "response/gametop/data/player/item/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/item/{item}")
for item in [
'play_time',
@ -181,7 +181,7 @@ class JubeatClanClient(BaseClient):
'category',
'expert_option',
]:
self.assert_path(resp, "response/gametop/data/player/last/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/last/{item}")
for item in [
'marker',
@ -195,7 +195,7 @@ class JubeatClanClient(BaseClient):
'hard',
'hazard',
]:
self.assert_path(resp, "response/gametop/data/player/last/settings/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/last/settings/{item}")
# Misc stuff
self.assert_path(resp, "response/gametop/data/player/session_id")
@ -580,15 +580,15 @@ class JubeatClanClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
self.verify_gametop_regist(card, ref_id)
else:
print("Skipping new card checks for existing card")
@ -598,7 +598,7 @@ class JubeatClanClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
if cardid is None:
# Verify score handling
@ -708,14 +708,10 @@ class JubeatClanClient(BaseClient):
expected_score = score['score']
if newscore['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], newscore['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{newscore["score"]}\'')
if newscore['medal'] != score['expected_medal']:
raise Exception('Expected a medal of \'{}\' for song \'{}\' chart \'{}\' but got medal \'{}\''.format(
score['expected_medal'], score['id'], score['chart'], newscore['medal'],
))
raise Exception(f'Expected a medal of \'{score["expected_medal"]}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got medal \'{newscore["medal"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -104,7 +104,7 @@ class JubeatPropClient(BaseClient):
'mtg_hold_cnt',
'mtg_result',
]:
self.assert_path(resp, "response/gametop/data/player/info/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/info/{item}")
for item in [
'music_list',
@ -118,7 +118,7 @@ class JubeatPropClient(BaseClient):
'new/theme_list',
'new/marker_list',
]:
self.assert_path(resp, "response/gametop/data/player/item/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/item/{item}")
for item in [
'play_time',
@ -130,7 +130,7 @@ class JubeatPropClient(BaseClient):
'music_id',
'seq_id',
]:
self.assert_path(resp, "response/gametop/data/player/last/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/last/{item}")
for item in [
'marker',
@ -144,7 +144,7 @@ class JubeatPropClient(BaseClient):
'hazard',
'hard',
]:
self.assert_path(resp, "response/gametop/data/player/last/settings/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/last/settings/{item}")
# Misc stuff
self.assert_path(resp, "response/gametop/data/player/session_id")
@ -411,7 +411,7 @@ class JubeatPropClient(BaseClient):
break
if playernode is None:
raise Exception("Didn't find any scores for ExtID {}".format(jid))
raise Exception(f"Didn't find any scores for ExtID {jid}")
ret = []
for result in playernode.child('result_list').children:
@ -458,7 +458,7 @@ class JubeatPropClient(BaseClient):
break
if playernode is None:
raise Exception("Didn't find any scores for ExtID {}".format(jid))
raise Exception(f"Didn't find any scores for ExtID {jid}")
result = playernode.child_value('result/score')
if result is not None:
@ -539,15 +539,15 @@ class JubeatPropClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
self.verify_gametop_regist(card, ref_id)
else:
print("Skipping new card checks for existing card")
@ -557,7 +557,7 @@ class JubeatPropClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
if cardid is None:
# Verify score handling
@ -677,14 +677,10 @@ class JubeatPropClient(BaseClient):
expected_score = score['score']
if newscore['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], newscore['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{newscore["score"]}\'')
if newscore['medal'] != score['expected_medal']:
raise Exception('Expected a medal of \'{}\' for song \'{}\' chart \'{}\' but got medal \'{}\''.format(
score['expected_medal'], score['id'], score['chart'], newscore['medal'],
))
raise Exception(f'Expected a medal of \'{score["expected_medal"]}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got medal \'{newscore["medal"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)
@ -730,7 +726,7 @@ class JubeatPropClient(BaseClient):
foundcourses = [c for c in courses if c['course_id'] == course['course_id']]
if len(foundcourses) == 0:
raise Exception("Didn't find course by ID {}".format(course['course_id']))
raise Exception(f"Didn't find course by ID {course['course_id']}")
foundcourse = foundcourses[0]
if 'expected_rating' in course:
@ -747,15 +743,11 @@ class JubeatPropClient(BaseClient):
raise Exception("Logic error!")
if foundcourse['rating'] != expected_rating:
raise Exception('Expected a rating of \'{}\' for course \'{}\' but got rating \'{}\''.format(
expected_rating, course['course_id'], foundcourse['rating'],
))
raise Exception(f'Expected a rating of \'{expected_rating}\' for course \'{course["course_id"]}\' but got rating \'{foundcourse["rating"]}\'')
for i in range(len(expected_scores)):
if foundcourse['scores'][i] != expected_scores[i]:
raise Exception('Expected a score of \'{}\' for course \'{}\' song number \'{}\' but got score \'{}\''.format(
expected_scores[i], course['course_id'], i, foundcourse['scores'][i],
))
raise Exception(f'Expected a score of \'{expected_scores[i]}\' for course \'{course["course_id"]}\' song number \'{i}\' but got score \'{foundcourse["scores"][i]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)
@ -766,11 +758,7 @@ class JubeatPropClient(BaseClient):
league = self.verify_gametop_get_league(jid)
if league[1][0] != 123456 or league[1][1] != 234567 or league[1][2] != 345678:
raise Exception('League score didn\t save! Got wrong values {}, {}, {} back!'.format(
league[1][0],
league[1][1],
league[1][2],
))
raise Exception(f'League score didn\t save! Got wrong values {league[1][0]}, {league[1][1]}, {league[1][2]} back!')
# Play a league course, do worse, make sure it doesn't overwrite
self.verify_gameend_regist(ref_id, jid, [], {}, (league[0], (12345, 23456, 34567)))
@ -778,11 +766,7 @@ class JubeatPropClient(BaseClient):
league = self.verify_gametop_get_league(jid)
if league[1][0] != 123456 or league[1][1] != 234567 or league[1][2] != 345678:
raise Exception('League score got overwritten! Got wrong values {}, {}, {} back!'.format(
league[1][0],
league[1][1],
league[1][2],
))
raise Exception(f'League score got overwritten! Got wrong values {league[1][0]}, {league[1][1]}, {league[1][2]} back!')
else:
print("Skipping score checks for existing card")

View File

@ -105,7 +105,7 @@ class JubeatQubellClient(BaseClient):
'mtg_hold_cnt',
'mtg_result',
]:
self.assert_path(resp, "response/gametop/data/player/info/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/info/{item}")
for item in [
'music_list',
@ -119,7 +119,7 @@ class JubeatQubellClient(BaseClient):
'new/theme_list',
'new/marker_list',
]:
self.assert_path(resp, "response/gametop/data/player/item/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/item/{item}")
for item in [
'play_time',
@ -131,7 +131,7 @@ class JubeatQubellClient(BaseClient):
'music_id',
'seq_id',
]:
self.assert_path(resp, "response/gametop/data/player/last/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/last/{item}")
for item in [
'marker',
@ -145,7 +145,7 @@ class JubeatQubellClient(BaseClient):
'hazard',
'hard',
]:
self.assert_path(resp, "response/gametop/data/player/last/settings/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/last/settings/{item}")
# Misc stuff
self.assert_path(resp, "response/gametop/data/player/session_id")
@ -440,15 +440,15 @@ class JubeatQubellClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
self.verify_gametop_regist(card, ref_id)
else:
print("Skipping new card checks for existing card")
@ -458,7 +458,7 @@ class JubeatQubellClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
if cardid is None:
# Verify score handling
@ -563,14 +563,10 @@ class JubeatQubellClient(BaseClient):
expected_score = score['score']
if newscore['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], newscore['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{newscore["score"]}\'')
if newscore['medal'] != score['expected_medal']:
raise Exception('Expected a medal of \'{}\' for song \'{}\' chart \'{}\' but got medal \'{}\''.format(
score['expected_medal'], score['id'], score['chart'], newscore['medal'],
))
raise Exception(f'Expected a medal of \'{score["expected_medal"]}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got medal \'{newscore["medal"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -76,7 +76,7 @@ class JubeatSaucerClient(BaseClient):
'mtg_hold_cnt',
'mtg_result',
]:
self.assert_path(resp, "response/gametop/data/player/info/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/info/{item}")
for item in [
'secret_list',
@ -89,7 +89,7 @@ class JubeatSaucerClient(BaseClient):
'new/theme_list',
'new/marker_list',
]:
self.assert_path(resp, "response/gametop/data/player/item/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/item/{item}")
for item in [
'music_id',
@ -106,7 +106,7 @@ class JubeatSaucerClient(BaseClient):
'shopname',
'areaname',
]:
self.assert_path(resp, "response/gametop/data/player/last/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/last/{item}")
# Misc stuff
self.assert_path(resp, "response/gametop/data/player/session_id")
@ -339,15 +339,15 @@ class JubeatSaucerClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
self.verify_gametop_regist(card, ref_id)
else:
print("Skipping new card checks for existing card")
@ -357,7 +357,7 @@ class JubeatSaucerClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
if cardid is None:
# Verify score handling
@ -460,14 +460,10 @@ class JubeatSaucerClient(BaseClient):
expected_score = score['score']
if newscore['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], newscore['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{newscore["score"]}\'')
if newscore['medal'] != score['expected_medal']:
raise Exception('Expected a medal of \'{}\' for song \'{}\' chart \'{}\' but got medal \'{}\''.format(
score['expected_medal'], score['id'], score['chart'], newscore['medal'],
))
raise Exception(f'Expected a medal of \'{score["expected_medal"]}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got medal \'{newscore["medal"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -81,7 +81,7 @@ class JubeatSaucerFulfillClient(BaseClient):
'mtg_hold_cnt',
'mtg_result',
]:
self.assert_path(resp, "response/gametop/data/player/info/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/info/{item}")
for item in [
'secret_list',
@ -94,7 +94,7 @@ class JubeatSaucerFulfillClient(BaseClient):
'new/theme_list',
'new/marker_list',
]:
self.assert_path(resp, "response/gametop/data/player/item/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/item/{item}")
for item in [
'music_id',
@ -115,7 +115,7 @@ class JubeatSaucerFulfillClient(BaseClient):
'shopname',
'areaname',
]:
self.assert_path(resp, "response/gametop/data/player/last/{}".format(item))
self.assert_path(resp, f"response/gametop/data/player/last/{item}")
# Misc stuff
self.assert_path(resp, "response/gametop/data/player/session_id")
@ -342,7 +342,7 @@ class JubeatSaucerFulfillClient(BaseClient):
break
if playernode is None:
raise Exception("Didn't find any scores for ExtID {}".format(jid))
raise Exception(f"Didn't find any scores for ExtID {jid}")
ret = []
for result in playernode.child('result_list').children:
@ -413,15 +413,15 @@ class JubeatSaucerFulfillClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
self.verify_gametop_regist(card, ref_id)
else:
print("Skipping new card checks for existing card")
@ -431,7 +431,7 @@ class JubeatSaucerFulfillClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
if cardid is None:
# Verify score handling
@ -543,14 +543,10 @@ class JubeatSaucerFulfillClient(BaseClient):
expected_score = score['score']
if newscore['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], newscore['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{newscore["score"]}\'')
if newscore['medal'] != score['expected_medal']:
raise Exception('Expected a medal of \'{}\' for song \'{}\' chart \'{}\' but got medal \'{}\''.format(
score['expected_medal'], score['id'], score['chart'], newscore['medal'],
))
raise Exception(f'Expected a medal of \'{score["expected_medal"]}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got medal \'{newscore["medal"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)
@ -596,7 +592,7 @@ class JubeatSaucerFulfillClient(BaseClient):
foundcourses = [c for c in courses if c['course_id'] == course['course_id']]
if len(foundcourses) == 0:
raise Exception("Didn't find course by ID {}".format(course['course_id']))
raise Exception(f"Didn't find course by ID {course['course_id']}")
foundcourse = foundcourses[0]
if 'expected_rating' in course:
@ -613,15 +609,11 @@ class JubeatSaucerFulfillClient(BaseClient):
raise Exception("Logic error!")
if foundcourse['rating'] != expected_rating:
raise Exception('Expected a rating of \'{}\' for course \'{}\' but got rating \'{}\''.format(
expected_rating, course['course_id'], foundcourse['rating'],
))
raise Exception(f'Expected a rating of \'{expected_rating}\' for course \'{course["course_id"]}\' but got rating \'{foundcourse["rating"]}\'')
for i in range(len(expected_scores)):
if foundcourse['scores'][i] != expected_scores[i]:
raise Exception('Expected a score of \'{}\' for course \'{}\' song number \'{}\' but got score \'{}\''.format(
expected_scores[i], course['course_id'], i, foundcourse['scores'][i],
))
raise Exception(f'Expected a score of \'{expected_scores[i]}\' for course \'{course["course_id"]}\' song number \'{i}\' but got score \'{foundcourse["scores"][i]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -279,7 +279,7 @@ class Museca1Client(BaseClient):
'items': items,
}
else:
raise Exception("Invalid game load type {}".format(msg_type))
raise Exception(f"Invalid game load type {msg_type}")
def verify_game_play_e(self, location: str, refid: str) -> None:
call = self.call_node()
@ -412,15 +412,15 @@ class Museca1Client(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Museca doesn't read the new profile, it asks for the profile itself after calling new
self.verify_game_load(card, ref_id, msg_type='new')
self.verify_game_new(location, ref_id)
@ -433,7 +433,7 @@ class Museca1Client(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify account freezing
self.verify_game_frozen(ref_id, 900)
@ -444,7 +444,7 @@ class Museca1Client(BaseClient):
# Verify profile loading and saving
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 0:
raise Exception('Profile has nonzero blocks associated with it!')
if profile['block'] != 0:
@ -455,7 +455,7 @@ class Museca1Client(BaseClient):
self.verify_game_save(location, ref_id, packet=123, block=234, blaster_energy=42)
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 123:
raise Exception('Profile has invalid blocks associated with it!')
if profile['block'] != 234:
@ -539,7 +539,7 @@ class Museca1Client(BaseClient):
break
if actual is None:
raise Exception("Didn't find song {} chart {} in response!".format(expected['id'], expected['chart']))
raise Exception(f"Didn't find song {expected['id']} chart {expected['chart']} in response!")
if 'expected_score' in expected:
expected_score = expected['expected_score']
@ -555,17 +555,11 @@ class Museca1Client(BaseClient):
expected_clear_type = expected['clear_type']
if actual['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, expected['id'], expected['chart'], actual['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got score \'{actual["score"]}\'')
if actual['grade'] != expected_grade:
raise Exception('Expected a grade of \'{}\' for song \'{}\' chart \'{}\' but got grade \'{}\''.format(
expected_grade, expected['id'], expected['chart'], actual['grade'],
))
raise Exception(f'Expected a grade of \'{expected_grade}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got grade \'{actual["grade"]}\'')
if actual['clear_type'] != expected_clear_type:
raise Exception('Expected a clear_type of \'{}\' for song \'{}\' chart \'{}\' but got clear_type \'{}\''.format(
expected_clear_type, expected['id'], expected['chart'], actual['clear_type'],
))
raise Exception(f'Expected a clear_type of \'{expected_clear_type}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got clear_type \'{actual["clear_type"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -280,7 +280,7 @@ class Museca1PlusClient(BaseClient):
'items': items,
}
else:
raise Exception("Invalid game load type {}".format(msg_type))
raise Exception(f"Invalid game load type {msg_type}")
def verify_game_play_e(self, location: str, refid: str) -> None:
call = self.call_node()
@ -427,15 +427,15 @@ class Museca1PlusClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Museca doesn't read the new profile, it asks for the profile itself after calling new
self.verify_game_load(card, ref_id, msg_type='new')
self.verify_game_new(location, ref_id)
@ -448,7 +448,7 @@ class Museca1PlusClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify account freezing
self.verify_game_frozen(ref_id, 900)
@ -462,7 +462,7 @@ class Museca1PlusClient(BaseClient):
# Verify profile loading and saving
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 0:
raise Exception('Profile has nonzero blocks associated with it!')
if profile['block'] != 0:
@ -473,7 +473,7 @@ class Museca1PlusClient(BaseClient):
self.verify_game_save(location, ref_id, packet=123, block=234, blaster_energy=42)
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 123:
raise Exception('Profile has invalid blocks associated with it!')
if profile['block'] != 234:
@ -557,7 +557,7 @@ class Museca1PlusClient(BaseClient):
break
if actual is None:
raise Exception("Didn't find song {} chart {} in response!".format(expected['id'], expected['chart']))
raise Exception(f"Didn't find song {expected['id']} chart {expected['chart']} in response!")
if 'expected_score' in expected:
expected_score = expected['expected_score']
@ -573,17 +573,11 @@ class Museca1PlusClient(BaseClient):
expected_clear_type = expected['clear_type']
if actual['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, expected['id'], expected['chart'], actual['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got score \'{actual["score"]}\'')
if actual['grade'] != expected_grade:
raise Exception('Expected a grade of \'{}\' for song \'{}\' chart \'{}\' but got grade \'{}\''.format(
expected_grade, expected['id'], expected['chart'], actual['grade'],
))
raise Exception(f'Expected a grade of \'{expected_grade}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got grade \'{actual["grade"]}\'')
if actual['clear_type'] != expected_clear_type:
raise Exception('Expected a clear_type of \'{}\' for song \'{}\' chart \'{}\' but got clear_type \'{}\''.format(
expected_clear_type, expected['id'], expected['chart'], actual['clear_type'],
))
raise Exception(f'Expected a clear_type of \'{expected_clear_type}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got clear_type \'{actual["clear_type"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -39,12 +39,12 @@ class PopnMusicEclaleClient(BaseClient):
self.assert_path(resp, "response/pcb23/@status")
def __verify_common(self, root: str, resp: Node) -> None:
self.assert_path(resp, "response/{}/phase/event_id".format(root))
self.assert_path(resp, "response/{}/phase/phase".format(root))
self.assert_path(resp, "response/{}/area/area_id".format(root))
self.assert_path(resp, "response/{}/area/end_date".format(root))
self.assert_path(resp, "response/{}/area/medal_id".format(root))
self.assert_path(resp, "response/{}/area/is_limit".format(root))
self.assert_path(resp, f"response/{root}/phase/event_id")
self.assert_path(resp, f"response/{root}/phase/phase")
self.assert_path(resp, f"response/{root}/area/area_id")
self.assert_path(resp, f"response/{root}/area/end_date")
self.assert_path(resp, f"response/{root}/area/medal_id")
self.assert_path(resp, f"response/{root}/area/is_limit")
def verify_info23_common(self, loc: str) -> None:
call = self.call_node()
@ -135,7 +135,7 @@ class PopnMusicEclaleClient(BaseClient):
self.assert_path(resp, "response/player23/result")
status = resp.child_value('player23/result')
if status != 2:
raise Exception('Reference ID \'{}\' returned invalid status \'{}\''.format(ref_id, status))
raise Exception(f'Reference ID \'{ref_id}\' returned invalid status \'{status}\'')
return {
'medals': {},
@ -150,10 +150,10 @@ class PopnMusicEclaleClient(BaseClient):
self.assert_path(resp, "response/player23/result")
status = resp.child_value('player23/result')
if status != 0:
raise Exception('Reference ID \'{}\' returned invalid status \'{}\''.format(ref_id, status))
raise Exception(f'Reference ID \'{ref_id}\' returned invalid status \'{status}\'')
name = resp.child_value('player23/account/name')
if name != self.NAME:
raise Exception('Invalid name \'{}\' returned for Ref ID \'{}\''.format(name, ref_id))
raise Exception(f'Invalid name \'{name}\' returned for Ref ID \'{ref_id}\'')
# Medals and items
items: Dict[int, Dict[str, int]] = {}
@ -182,7 +182,7 @@ class PopnMusicEclaleClient(BaseClient):
'lumina': {0: {'lumina': resp.child_value('player23/account/lumina')}},
}
else:
raise Exception('Unrecognized message type \'{}\''.format(msg_type))
raise Exception(f'Unrecognized message type \'{msg_type}\'')
def verify_player23_read_score(self, ref_id: str) -> Dict[str, Dict[int, Dict[int, int]]]:
call = self.call_node()
@ -405,15 +405,15 @@ class PopnMusicEclaleClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
self.verify_player23_read(ref_id, msg_type='new')
self.verify_player23_new(ref_id)
else:
@ -424,7 +424,7 @@ class PopnMusicEclaleClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify proper handling of basic stuff
self.verify_player23_read(ref_id, msg_type='query')
@ -478,7 +478,7 @@ class PopnMusicEclaleClient(BaseClient):
if unlocks['items'][6]['param'] != 8:
raise Exception('Expecting to see item ID 6 to have param 8 in items!')
if unlocks['lumina'][0]['lumina'] != 150:
raise Exception('Got wrong value for lumina {} after purchase!'.format(unlocks['lumina'][0]['lumina']))
raise Exception(f'Got wrong value for lumina {unlocks["lumina"][0]["lumina"]} after purchase!')
if cardid is None:
# Verify score handling
@ -568,13 +568,9 @@ class PopnMusicEclaleClient(BaseClient):
expected_medal = expected['medal']
if newscore != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, expected['id'], expected['chart'], newscore,
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got score \'{newscore}\'')
if newmedal != expected_medal:
raise Exception('Expected a medal of \'{}\' for song \'{}\' chart \'{}\' but got medal \'{}\''.format(
expected_medal, expected['id'], expected['chart'], newmedal,
))
raise Exception(f'Expected a medal of \'{expected_medal}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got medal \'{newmedal}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -93,9 +93,9 @@ class PopnMusicFantasiaClient(BaseClient):
node = resp.child('game').child(name)
if node is None:
raise Exception('Missing node \'{}\' in response!'.format(name))
raise Exception(f'Missing node \'{name}\' in response!')
if node.data_type != 's32':
raise Exception('Node \'{}\' has wrong data type!'.format(name))
raise Exception(f'Node \'{name}\' has wrong data type!')
sel_ranking = resp.child('game').child('sel_ranking')
up_ranking = resp.child('game').child('up_ranking')
@ -111,13 +111,13 @@ class PopnMusicFantasiaClient(BaseClient):
dtype = nodepair[2]
if node is None:
raise Exception('Missing node \'{}\' in response!'.format(name))
raise Exception(f'Missing node \'{name}\' in response!')
if node.data_type != dtype:
raise Exception('Node \'{}\' has wrong data type!'.format(name))
raise Exception(f'Node \'{name}\' has wrong data type!')
if not node.is_array:
raise Exception('Node \'{}\' is not array!'.format(name))
raise Exception(f'Node \'{name}\' is not array!')
if len(node.value) != 10:
raise Exception('Node \'{}\' is wrong array length!'.format(name))
raise Exception(f'Node \'{name}\' is wrong array length!')
def verify_playerdata_get(self, ref_id: str, msg_type: str) -> Optional[Dict[str, Any]]:
call = self.call_node()
@ -143,7 +143,7 @@ class PopnMusicFantasiaClient(BaseClient):
status = int(resp.child('playerdata').attribute('status'))
if status != 109:
raise Exception('Reference ID \'{}\' returned invalid status \'{}\''.format(ref_id, status))
raise Exception(f'Reference ID \'{ref_id}\' returned invalid status \'{status}\'')
# No score data
return None
@ -165,7 +165,7 @@ class PopnMusicFantasiaClient(BaseClient):
name = resp.child('playerdata').child('base').child('name').value
if name != self.NAME:
raise Exception('Invalid name \'{}\' returned for Ref ID \'{}\''.format(name, ref_id))
raise Exception(f'Invalid name \'{name}\' returned for Ref ID \'{ref_id}\'')
# Extract and return score data
self.assert_path(resp, "response/playerdata/base/clear_medal")
@ -198,7 +198,7 @@ class PopnMusicFantasiaClient(BaseClient):
return {'medals': medals, 'scores': scores}
else:
raise Exception('Unrecognized message type \'{}\''.format(msg_type))
raise Exception(f'Unrecognized message type \'{msg_type}\'')
def verify_playerdata_set(self, ref_id: str, scores: List[Dict[str, Any]]) -> None:
call = self.call_node()
@ -238,7 +238,7 @@ class PopnMusicFantasiaClient(BaseClient):
name = resp.child('playerdata').child('name').value
if name != self.NAME:
raise Exception('Invalid name \'{}\' returned for Ref ID \'{}\''.format(name, ref_id))
raise Exception(f'Invalid name \'{name}\' returned for Ref ID \'{ref_id}\'')
def verify_playerdata_new(self, ref_id: str) -> None:
call = self.call_node()
@ -304,15 +304,15 @@ class PopnMusicFantasiaClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
self.verify_playerdata_get(ref_id, msg_type='new')
self.verify_playerdata_new(ref_id)
else:
@ -323,7 +323,7 @@ class PopnMusicFantasiaClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
if cardid is None:
# Verify score handling
@ -418,13 +418,9 @@ class PopnMusicFantasiaClient(BaseClient):
expected_medal = score['medal']
if newscore != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], newscore,
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{newscore}\'')
if newmedal != expected_medal:
raise Exception('Expected a medal of \'{}\' for song \'{}\' chart \'{}\' but got medal \'{}\''.format(
expected_medal, score['id'], score['chart'], newmedal,
))
raise Exception(f'Expected a medal of \'{expected_medal}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got medal \'{newmedal}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -45,9 +45,9 @@ class PopnMusicLapistoriaClient(BaseClient):
node = resp.child('info22').child(name)
if node is None:
raise Exception('Missing node \'{}\' in response!'.format(name))
raise Exception(f'Missing node \'{name}\' in response!')
if node.data_type != 'void':
raise Exception('Node \'{}\' has wrong data type!'.format(name))
raise Exception(f'Node \'{name}\' has wrong data type!')
def verify_player22_read(self, ref_id: str, msg_type: str) -> Optional[Dict[str, Any]]:
call = self.call_node()
@ -70,7 +70,7 @@ class PopnMusicLapistoriaClient(BaseClient):
status = int(resp.child('player22').attribute('status'))
if status != 109:
raise Exception('Reference ID \'{}\' returned invalid status \'{}\''.format(ref_id, status))
raise Exception(f'Reference ID \'{ref_id}\' returned invalid status \'{status}\'')
# No score data
return None
@ -89,7 +89,7 @@ class PopnMusicLapistoriaClient(BaseClient):
name = resp.child('player22').child('account').child('name').value
if name != self.NAME:
raise Exception('Invalid name \'{}\' returned for Ref ID \'{}\''.format(name, ref_id))
raise Exception(f'Invalid name \'{name}\' returned for Ref ID \'{ref_id}\'')
# Extract and return score data
medals: Dict[int, List[int]] = {}
@ -111,7 +111,7 @@ class PopnMusicLapistoriaClient(BaseClient):
return {'medals': medals, 'scores': scores}
else:
raise Exception('Unrecognized message type \'{}\''.format(msg_type))
raise Exception(f'Unrecognized message type \'{msg_type}\'')
def verify_player22_write(self, ref_id: str, scores: List[Dict[str, Any]]) -> None:
call = self.call_node()
@ -216,15 +216,15 @@ class PopnMusicLapistoriaClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
self.verify_player22_read(ref_id, msg_type='new')
self.verify_player22_new(ref_id)
else:
@ -235,7 +235,7 @@ class PopnMusicLapistoriaClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
if cardid is None:
# Verify score handling
@ -332,13 +332,9 @@ class PopnMusicLapistoriaClient(BaseClient):
expected_medal = score['medal']
if newscore != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], newscore,
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{newscore}\'')
if newmedal != expected_medal:
raise Exception('Expected a medal of \'{}\' for song \'{}\' chart \'{}\' but got medal \'{}\''.format(
expected_medal, score['id'], score['chart'], newmedal,
))
raise Exception(f'Expected a medal of \'{expected_medal}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got medal \'{newmedal}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -60,9 +60,9 @@ class PopnMusicSunnyParkClient(BaseClient):
node = resp.child('game').child(name)
if node is None:
raise Exception('Missing node \'{}\' in response!'.format(name))
raise Exception(f'Missing node \'{name}\' in response!')
if node.data_type != 's32':
raise Exception('Node \'{}\' has wrong data type!'.format(name))
raise Exception(f'Node \'{name}\' has wrong data type!')
sel_ranking = resp.child('game').child('sel_ranking')
up_ranking = resp.child('game').child('up_ranking')
@ -72,13 +72,13 @@ class PopnMusicSunnyParkClient(BaseClient):
node = nodepair[1]
if node is None:
raise Exception('Missing node \'{}\' in response!'.format(name))
raise Exception(f'Missing node \'{name}\' in response!')
if node.data_type != 's16':
raise Exception('Node \'{}\' has wrong data type!'.format(name))
raise Exception(f'Node \'{name}\' has wrong data type!')
if not node.is_array:
raise Exception('Node \'{}\' is not array!'.format(name))
raise Exception(f'Node \'{name}\' is not array!')
if len(node.value) != 5:
raise Exception('Node \'{}\' is wrong array length!'.format(name))
raise Exception(f'Node \'{name}\' is wrong array length!')
def verify_playerdata_get(self, ref_id: str, msg_type: str) -> Optional[Dict[str, Any]]:
call = self.call_node()
@ -111,7 +111,7 @@ class PopnMusicSunnyParkClient(BaseClient):
status = int(resp.child('playerdata').attribute('status'))
if status != 109:
raise Exception('Reference ID \'{}\' returned invalid status \'{}\''.format(ref_id, status))
raise Exception(f'Reference ID \'{ref_id}\' returned invalid status \'{status}\'')
# No score data
return None
@ -129,7 +129,7 @@ class PopnMusicSunnyParkClient(BaseClient):
name = resp.child('playerdata').child('base').child('name').value
if name != self.NAME:
raise Exception('Invalid name \'{}\' returned for Ref ID \'{}\''.format(name, ref_id))
raise Exception(f'Invalid name \'{name}\' returned for Ref ID \'{ref_id}\'')
# Extract and return score data
self.assert_path(resp, "response/playerdata/base/clear_medal")
@ -162,7 +162,7 @@ class PopnMusicSunnyParkClient(BaseClient):
return {'medals': medals, 'scores': scores}
else:
raise Exception('Unrecognized message type \'{}\''.format(msg_type))
raise Exception(f'Unrecognized message type \'{msg_type}\'')
def verify_playerdata_set(self, ref_id: str, scores: List[Dict[str, Any]]) -> None:
call = self.call_node()
@ -194,7 +194,7 @@ class PopnMusicSunnyParkClient(BaseClient):
name = resp.child('playerdata').child('name').value
if name != self.NAME:
raise Exception('Invalid name \'{}\' returned for Ref ID \'{}\''.format(name, ref_id))
raise Exception(f'Invalid name \'{name}\' returned for Ref ID \'{ref_id}\'')
def verify_playerdata_new(self, ref_id: str) -> None:
call = self.call_node()
@ -253,15 +253,15 @@ class PopnMusicSunnyParkClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
self.verify_playerdata_get(ref_id, msg_type='new')
self.verify_playerdata_new(ref_id)
else:
@ -272,7 +272,7 @@ class PopnMusicSunnyParkClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
if cardid is None:
# Verify score handling
@ -367,13 +367,9 @@ class PopnMusicSunnyParkClient(BaseClient):
expected_medal = score['medal']
if newscore != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], newscore,
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{newscore}\'')
if newmedal != expected_medal:
raise Exception('Expected a medal of \'{}\' for song \'{}\' chart \'{}\' but got medal \'{}\''.format(
expected_medal, score['id'], score['chart'], newmedal,
))
raise Exception(f'Expected a medal of \'{expected_medal}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got medal \'{newmedal}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -55,7 +55,7 @@ class PopnMusicTuneStreetClient(BaseClient):
'psp_phase',
]:
if name not in resp.child('game').attributes:
raise Exception('Missing attribute \'{}\' in response!'.format(name))
raise Exception(f'Missing attribute \'{name}\' in response!')
def verify_playerdata_get(self, ref_id: str, msg_type: str) -> Optional[Dict[str, Any]]:
call = self.call_node()
@ -80,7 +80,7 @@ class PopnMusicTuneStreetClient(BaseClient):
status = int(resp.child('playerdata').attribute('status'))
if status != 109:
raise Exception('Reference ID \'{}\' returned invalid status \'{}\''.format(ref_id, status))
raise Exception(f'Reference ID \'{ref_id}\' returned invalid status \'{status}\'')
# No score data
return None
@ -92,7 +92,7 @@ class PopnMusicTuneStreetClient(BaseClient):
name = resp.child('playerdata').child('b').value[0:12].decode('SHIFT_JIS').replace("\x00", "")
if name != self.NAME:
raise Exception('Invalid name \'{}\' returned for Ref ID \'{}\''.format(name, ref_id))
raise Exception(f'Invalid name \'{name}\' returned for Ref ID \'{ref_id}\'')
medals = resp.child('playerdata').child('b').value[108:]
medals = [(medals[x] + (medals[x + 1] << 8)) for x in range(0, len(medals), 2)]
@ -137,7 +137,7 @@ class PopnMusicTuneStreetClient(BaseClient):
return {'medals': medals, 'scores': scores}
else:
raise Exception('Unrecognized message type \'{}\''.format(msg_type))
raise Exception(f'Unrecognized message type \'{msg_type}\'')
def verify_playerdata_set(self, ref_id: str, scores: List[Dict[str, Any]]) -> None:
call = self.call_node()
@ -241,15 +241,15 @@ class PopnMusicTuneStreetClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
self.verify_playerdata_get(ref_id, msg_type='new')
self.verify_playerdata_new(card, ref_id)
else:
@ -260,7 +260,7 @@ class PopnMusicTuneStreetClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
if cardid is None:
# Verify score handling
@ -355,13 +355,9 @@ class PopnMusicTuneStreetClient(BaseClient):
expected_medal = score['medal']
if newscore != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, score['id'], score['chart'], newscore,
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got score \'{newscore}\'')
if newmedal != expected_medal:
raise Exception('Expected a medal of \'{}\' for song \'{}\' chart \'{}\' but got medal \'{}\''.format(
expected_medal, score['id'], score['chart'], newmedal,
))
raise Exception(f'Expected a medal of \'{expected_medal}\' for song \'{score["id"]}\' chart \'{score["chart"]}\' but got medal \'{newmedal}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -39,18 +39,18 @@ class PopnMusicUsaNekoClient(BaseClient):
self.assert_path(resp, "response/pcb24/@status")
def __verify_common(self, root: str, resp: Node) -> None:
self.assert_path(resp, "response/{}/phase/event_id".format(root))
self.assert_path(resp, "response/{}/phase/phase".format(root))
self.assert_path(resp, "response/{}/area/area_id".format(root))
self.assert_path(resp, "response/{}/area/end_date".format(root))
self.assert_path(resp, "response/{}/area/medal_id".format(root))
self.assert_path(resp, "response/{}/area/is_limit".format(root))
self.assert_path(resp, "response/{}/choco/choco_id".format(root))
self.assert_path(resp, "response/{}/choco/param".format(root))
self.assert_path(resp, "response/{}/goods/item_id".format(root))
self.assert_path(resp, "response/{}/goods/item_type".format(root))
self.assert_path(resp, "response/{}/goods/price".format(root))
self.assert_path(resp, "response/{}/goods/goods_type".format(root))
self.assert_path(resp, f"response/{root}/phase/event_id")
self.assert_path(resp, f"response/{root}/phase/phase")
self.assert_path(resp, f"response/{root}/area/area_id")
self.assert_path(resp, f"response/{root}/area/end_date")
self.assert_path(resp, f"response/{root}/area/medal_id")
self.assert_path(resp, f"response/{root}/area/is_limit")
self.assert_path(resp, f"response/{root}/choco/choco_id")
self.assert_path(resp, f"response/{root}/choco/param")
self.assert_path(resp, f"response/{root}/goods/item_id")
self.assert_path(resp, f"response/{root}/goods/item_type")
self.assert_path(resp, f"response/{root}/goods/price")
self.assert_path(resp, f"response/{root}/goods/goods_type")
def verify_info24_common(self, loc: str) -> None:
call = self.call_node()
@ -152,7 +152,7 @@ class PopnMusicUsaNekoClient(BaseClient):
self.assert_path(resp, "response/player24/result")
status = resp.child_value('player24/result')
if status != 2:
raise Exception('Reference ID \'{}\' returned invalid status \'{}\''.format(ref_id, status))
raise Exception(f'Reference ID \'{ref_id}\' returned invalid status \'{status}\'')
return {
'items': {},
@ -166,10 +166,10 @@ class PopnMusicUsaNekoClient(BaseClient):
self.assert_path(resp, "response/player24/result")
status = resp.child_value('player24/result')
if status != 0:
raise Exception('Reference ID \'{}\' returned invalid status \'{}\''.format(ref_id, status))
raise Exception(f'Reference ID \'{ref_id}\' returned invalid status \'{status}\'')
name = resp.child_value('player24/account/name')
if name != self.NAME:
raise Exception('Invalid name \'{}\' returned for Ref ID \'{}\''.format(name, ref_id))
raise Exception(f'Invalid name \'{name}\' returned for Ref ID \'{ref_id}\'')
# Medals and items
items: Dict[int, Dict[str, int]] = {}
@ -201,7 +201,7 @@ class PopnMusicUsaNekoClient(BaseClient):
'points': {0: {'points': resp.child_value('player24/account/player_point')}},
}
else:
raise Exception('Unrecognized message type \'{}\''.format(msg_type))
raise Exception(f'Unrecognized message type \'{msg_type}\'')
def verify_player24_read_score(self, ref_id: str) -> Dict[str, Dict[int, Dict[int, int]]]:
call = self.call_node()
@ -452,15 +452,15 @@ class PopnMusicUsaNekoClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
self.verify_player24_read(ref_id, msg_type='new')
self.verify_player24_new(ref_id)
else:
@ -471,7 +471,7 @@ class PopnMusicUsaNekoClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify proper handling of basic stuff
self.verify_player24_read(ref_id, msg_type='query')
@ -520,7 +520,7 @@ class PopnMusicUsaNekoClient(BaseClient):
if unlocks['items'][6]['param'] != 8:
raise Exception('Expecting to see item ID 6 to have param 8 in items!')
if unlocks['points'][0]['points'] != 150:
raise Exception('Got wrong value for points {} after purchase!'.format(unlocks['points'][0]['points']))
raise Exception(f'Got wrong value for points {unlocks["points"][0]["points"]} after purchase!')
# Verify course handling
self.verify_player24_update_ranking(ref_id, location)
@ -643,17 +643,11 @@ class PopnMusicUsaNekoClient(BaseClient):
expected_rank = 8
if newscore != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, expected['id'], expected['chart'], newscore,
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got score \'{newscore}\'')
if newmedal != expected_medal:
raise Exception('Expected a medal of \'{}\' for song \'{}\' chart \'{}\' but got medal \'{}\''.format(
expected_medal, expected['id'], expected['chart'], newmedal,
))
raise Exception(f'Expected a medal of \'{expected_medal}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got medal \'{newmedal}\'')
if newrank != expected_rank:
raise Exception('Expected a rank of \'{}\' for song \'{}\' chart \'{}\' but got rank \'{}\''.format(
expected_rank, expected['id'], expected['chart'], newrank,
))
raise Exception(f'Expected a rank of \'{expected_rank}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got rank \'{newrank}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -25,14 +25,11 @@ class ClientProtocol:
elif packet_encoding == "binary":
_packet_encoding = EAmuseProtocol.BINARY
else:
raise Exception("Unknown packet encoding {}".format(packet_encoding))
raise Exception(f"Unknown packet encoding {packet_encoding}")
# Handle encryption
if self.__encryption:
encryption = '1-{}-{}'.format(
random_hex_string(8),
random_hex_string(4),
)
encryption = f'1-{random_hex_string(8)}-{random_hex_string(4)}'
headers['X-Eamuse-Info'] = encryption
else:
encryption = None
@ -56,11 +53,7 @@ class ClientProtocol:
# Send the request, get the response
r = requests.post(
'http://{}:{}/{}'.format(
self.__address,
self.__port,
uri,
),
f'http://{self.__address}:{self.__port}/{uri}',
headers=headers,
data=req,
)

View File

@ -182,7 +182,7 @@ class ReflecBeatColette(BaseClient):
self.assert_path(resp, "response/player/pdata/record")
if resp.child_value('player/pdata/base/name') != self.NAME:
raise Exception('Invalid name {} returned on profile read!'.format(resp.child_value('player/pdata/base/name')))
raise Exception(f'Invalid name {resp.child_value("player/pdata/base/name")} returned on profile read!')
scores = []
for child in resp.child('player/pdata/record').children:
@ -409,9 +409,9 @@ class ReflecBeatColette(BaseClient):
name = child.child_value('name')
comment = child.child_value('comment')
if name != self.NAME:
raise Exception('Invalid name \'{}\' returned for comment!'.format(name))
raise Exception(f'Invalid name \'{name}\' returned for comment!')
if comment != 'アメ〜〜!':
raise Exception('Invalid comment \'{}\' returned for comment!'.format(comment))
raise Exception(f'Invalid comment \'{comment}\' returned for comment!')
found = True
if not found:
@ -488,15 +488,15 @@ class ReflecBeatColette(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Always get a player start, regardless of new profile or not
self.verify_player_start(ref_id)
self.verify_player_delete(ref_id)
@ -522,7 +522,7 @@ class ReflecBeatColette(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify lobby functionality
self.verify_lobby_read(location, extid)
@ -621,7 +621,7 @@ class ReflecBeatColette(BaseClient):
break
if actual is None:
raise Exception("Didn't find song {} chart {} in response!".format(expected['id'], expected['chart']))
raise Exception(f"Didn't find song {expected['id']} chart {expected['chart']} in response!")
if 'expected_score' in expected:
expected_score = expected['expected_score']
@ -645,25 +645,15 @@ class ReflecBeatColette(BaseClient):
expected_miss_count = expected['miss_count']
if actual['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, expected['id'], expected['chart'], actual['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got score \'{actual["score"]}\'')
if actual['achievement_rate'] != expected_achievement_rate:
raise Exception('Expected an achievement rate of \'{}\' for song \'{}\' chart \'{}\' but got achievement rate \'{}\''.format(
expected_achievement_rate, expected['id'], expected['chart'], actual['achievement_rate'],
))
raise Exception(f'Expected an achievement rate of \'{expected_achievement_rate}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got achievement rate \'{actual["achievement_rate"]}\'')
if actual['clear_type'] != expected_clear_type:
raise Exception('Expected a clear_type of \'{}\' for song \'{}\' chart \'{}\' but got clear_type \'{}\''.format(
expected_clear_type, expected['id'], expected['chart'], actual['clear_type'],
))
raise Exception(f'Expected a clear_type of \'{expected_clear_type}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got clear_type \'{actual["clear_type"]}\'')
if actual['combo'] != expected_combo:
raise Exception('Expected a combo of \'{}\' for song \'{}\' chart \'{}\' but got combo \'{}\''.format(
expected_combo, expected['id'], expected['chart'], actual['combo'],
))
raise Exception(f'Expected a combo of \'{expected_combo}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got combo \'{actual["combo"]}\'')
if actual['miss_count'] != expected_miss_count:
raise Exception('Expected a miss count of \'{}\' for song \'{}\' chart \'{}\' but got miss count \'{}\''.format(
expected_miss_count, expected['id'], expected['chart'], actual['miss_count'],
))
raise Exception(f'Expected a miss count of \'{expected_miss_count}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got miss count \'{actual["miss_count"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -193,11 +193,11 @@ class ReflecBeatGroovinUpper(BaseClient):
if resp.child_value('player/player_select_score/name') != self.NAME:
raise Exception(
'Invalid name {} returned on score read!'.format(resp.child_value('player/player_select_score/name'))
f'Invalid name {resp.child_value("player/player_select_score/name")} returned on score read!'
)
if resp.child_value('player/player_select_score/user_id') != extid:
raise Exception(
'Invalid name {} returned on score read!'.format(resp.child_value('player/player_select_score/user_id'))
f'Invalid name {resp.child_value("player/player_select_score/user_id")} returned on score read!'
)
def verify_player_rb4succeed(self, refid: str) -> None:
@ -289,7 +289,7 @@ class ReflecBeatGroovinUpper(BaseClient):
self.assert_path(resp, "response/player/pdata/pue")
if resp.child_value('player/pdata/base/name') != self.NAME:
raise Exception('Invalid name {} returned on profile read!'.format(resp.child_value('player/pdata/base/name')))
raise Exception(f'Invalid name {resp.child_value("player/pdata/base/name")} returned on profile read!')
def verify_player_rb4readscore(self, refid: str, location: str) -> List[Dict[str, int]]:
call = self.call_node()
@ -339,7 +339,7 @@ class ReflecBeatGroovinUpper(BaseClient):
continue
if child.child_value('user_id') != extid:
raise Exception('Invalid user ID returned {}'.format(child.child_value('user_id')))
raise Exception(f'Invalid user ID returned {child.child_value("user_id")}')
episode = {
'id': child.child_value('type'),
@ -586,9 +586,9 @@ class ReflecBeatGroovinUpper(BaseClient):
name = child.child_value('name')
comment = child.child_value('comment')
if name != self.NAME:
raise Exception('Invalid name \'{}\' returned for comment!'.format(name))
raise Exception(f'Invalid name \'{name}\' returned for comment!')
if comment != 'アメ〜〜!':
raise Exception('Invalid comment \'{}\' returned for comment!'.format(comment))
raise Exception(f'Invalid comment \'{comment}\' returned for comment!')
found = True
if not found:
@ -668,15 +668,15 @@ class ReflecBeatGroovinUpper(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Always get a player start, regardless of new profile or not
self.verify_player_rb4start(ref_id)
@ -694,7 +694,7 @@ class ReflecBeatGroovinUpper(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify lobby functionality
self.verify_lobby_rb4read(location, extid)
@ -741,11 +741,7 @@ class ReflecBeatGroovinUpper(BaseClient):
for i in range(len(dummyepisodes)):
for key in dummyepisodes[i]:
if dummyepisodes[i][key] != episodes[i][key]:
raise Exception('Invalid value {} returned for episode {} key {}'.format(
episodes[i][key],
dummyepisodes[i]['id'],
key,
))
raise Exception(f'Invalid value {episodes[i][key]} returned for episode {dummyepisodes[i]["id"]} key {key}')
# Verify we start with empty scores
scores = self.verify_player_rb4readscore(ref_id, location)
@ -838,7 +834,7 @@ class ReflecBeatGroovinUpper(BaseClient):
break
if actual is None:
raise Exception("Didn't find song {} chart {} in response!".format(expected['id'], expected['chart']))
raise Exception(f"Didn't find song {expected['id']} chart {expected['chart']} in response!")
if 'expected_score' in expected:
expected_score = expected['expected_score']
@ -862,25 +858,15 @@ class ReflecBeatGroovinUpper(BaseClient):
expected_miss_count = expected['miss_count']
if actual['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, expected['id'], expected['chart'], actual['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got score \'{actual["score"]}\'')
if actual['achievement_rate'] != expected_achievement_rate:
raise Exception('Expected an achievement rate of \'{}\' for song \'{}\' chart \'{}\' but got achievement rate \'{}\''.format(
expected_achievement_rate, expected['id'], expected['chart'], actual['achievement_rate'],
))
raise Exception(f'Expected an achievement rate of \'{expected_achievement_rate}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got achievement rate \'{actual["achievement_rate"]}\'')
if actual['clear_type'] != expected_clear_type:
raise Exception('Expected a clear_type of \'{}\' for song \'{}\' chart \'{}\' but got clear_type \'{}\''.format(
expected_clear_type, expected['id'], expected['chart'], actual['clear_type'],
))
raise Exception(f'Expected a clear_type of \'{expected_clear_type}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got clear_type \'{actual["clear_type"]}\'')
if actual['combo_type'] != expected_combo_type:
raise Exception('Expected a combo_type of \'{}\' for song \'{}\' chart \'{}\' but got combo_type \'{}\''.format(
expected_combo_type, expected['id'], expected['chart'], actual['combo_type'],
))
raise Exception(f'Expected a combo_type of \'{expected_combo_type}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got combo_type \'{actual["combo_type"]}\'')
if actual['miss_count'] != expected_miss_count:
raise Exception('Expected a miss count of \'{}\' for song \'{}\' chart \'{}\' but got miss count \'{}\''.format(
expected_miss_count, expected['id'], expected['chart'], actual['miss_count'],
))
raise Exception(f'Expected a miss count of \'{expected_miss_count}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got miss count \'{actual["miss_count"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -213,7 +213,7 @@ class ReflecBeatLimelight(BaseClient):
self.assert_path(resp, "response/player/pdata/narrow_down/adv_param")
if resp.child_value('player/pdata/base/name') != self.NAME:
raise Exception('Invalid name {} returned on profile read!'.format(resp.child_value('player/pdata/base/name')))
raise Exception(f'Invalid name {resp.child_value("player/pdata/base/name")} returned on profile read!')
scores = []
for child in resp.child('player/pdata/record').children:
@ -326,7 +326,7 @@ class ReflecBeatLimelight(BaseClient):
# First, filter down to only records that are also in the battle log
def key(thing: Dict[str, int]) -> str:
return '{}-{}'.format(thing['id'], thing['chart'])
return f'{thing["id"]}-{thing["chart"]}'
updates = [key(score) for score in scores]
sortedrecords = {key(record): record for record in records if key(record) in updates}
@ -661,9 +661,9 @@ class ReflecBeatLimelight(BaseClient):
name = child.child_value('p_name')
comment = child.child_value('comment')
if name != self.NAME:
raise Exception('Invalid name \'{}\' returned for comment!'.format(name))
raise Exception(f'Invalid name \'{name}\' returned for comment!')
if comment != 'アメ〜〜!':
raise Exception('Invalid comment \'{}\' returned for comment!'.format(comment))
raise Exception(f'Invalid comment \'{comment}\' returned for comment!')
found = True
if not found:
@ -677,7 +677,7 @@ class ReflecBeatLimelight(BaseClient):
if child.child_value('uid') == extid:
name = child.child_value('p_name')
if name != self.NAME:
raise Exception('Invalid name \'{}\' returned for status!'.format(name))
raise Exception(f'Invalid name \'{name}\' returned for status!')
found = True
if not found:
@ -720,15 +720,15 @@ class ReflecBeatLimelight(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Always get a player start, regardless of new profile or not
self.verify_player_start(ref_id)
self.verify_player_delete(ref_id)
@ -747,7 +747,7 @@ class ReflecBeatLimelight(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify lobby functionality
self.verify_lobby_read(location, extid)
@ -848,7 +848,7 @@ class ReflecBeatLimelight(BaseClient):
break
if actual is None:
raise Exception("Didn't find song {} chart {} in response!".format(expected['id'], expected['chart']))
raise Exception(f"Didn't find song {expected['id']} chart {expected['chart']} in response!")
if 'expected_score' in expected:
expected_score = expected['expected_score']
@ -872,25 +872,15 @@ class ReflecBeatLimelight(BaseClient):
expected_miss_count = expected['miss_count']
if actual['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, expected['id'], expected['chart'], actual['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got score \'{actual["score"]}\'')
if actual['achievement_rate'] != expected_achievement_rate:
raise Exception('Expected an achievement rate of \'{}\' for song \'{}\' chart \'{}\' but got achievement rate \'{}\''.format(
expected_achievement_rate, expected['id'], expected['chart'], actual['achievement_rate'],
))
raise Exception(f'Expected an achievement rate of \'{expected_achievement_rate}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got achievement rate \'{actual["achievement_rate"]}\'')
if actual['clear_type'] != expected_clear_type:
raise Exception('Expected a clear_type of \'{}\' for song \'{}\' chart \'{}\' but got clear_type \'{}\''.format(
expected_clear_type, expected['id'], expected['chart'], actual['clear_type'],
))
raise Exception(f'Expected a clear_type of \'{expected_clear_type}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got clear_type \'{actual["clear_type"]}\'')
if actual['combo'] != expected_combo:
raise Exception('Expected a combo of \'{}\' for song \'{}\' chart \'{}\' but got combo \'{}\''.format(
expected_combo, expected['id'], expected['chart'], actual['combo'],
))
raise Exception(f'Expected a combo of \'{expected_combo}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got combo \'{actual["combo"]}\'')
if actual['miss_count'] != expected_miss_count:
raise Exception('Expected a miss count of \'{}\' for song \'{}\' chart \'{}\' but got miss count \'{}\''.format(
expected_miss_count, expected['id'], expected['chart'], actual['miss_count'],
))
raise Exception(f'Expected a miss count of \'{expected_miss_count}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got miss count \'{actual["miss_count"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -155,7 +155,7 @@ class ReflecBeat(BaseClient):
self.assert_path(resp, "response/player/pdata/cmnt")
if resp.child_value('player/pdata/base/name') != self.NAME:
raise Exception('Invalid name {} returned on profile read!'.format(resp.child_value('player/pdata/base/name')))
raise Exception(f'Invalid name {resp.child_value("player/pdata/base/name")} returned on profile read!')
scores = []
for child in resp.child('player/pdata/record').children:
@ -212,7 +212,7 @@ class ReflecBeat(BaseClient):
# First, filter down to only records that are also in the battle log
def key(thing: Dict[str, int]) -> str:
return '{}-{}'.format(thing['id'], thing['chart'])
return f'{thing["id"]}-{thing["chart"]}'
updates = [key(score) for score in scores]
sortedrecords = {key(record): record for record in records if key(record) in updates}
@ -450,15 +450,15 @@ class ReflecBeat(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Always get a player start, regardless of new profile or not
self.verify_player_start(ref_id)
self.verify_player_delete(ref_id)
@ -477,7 +477,7 @@ class ReflecBeat(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify lobby functionality
self.verify_lobby_read(location, extid)
@ -573,7 +573,7 @@ class ReflecBeat(BaseClient):
break
if actual is None:
raise Exception("Didn't find song {} chart {} in response!".format(expected['id'], expected['chart']))
raise Exception(f"Didn't find song {expected['id']} chart {expected['chart']} in response!")
if 'expected_score' in expected:
expected_score = expected['expected_score']
@ -597,25 +597,15 @@ class ReflecBeat(BaseClient):
expected_miss_count = expected['miss_count']
if actual['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, expected['id'], expected['chart'], actual['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got score \'{actual["score"]}\'')
if actual['achievement_rate'] != expected_achievement_rate:
raise Exception('Expected an achievement rate of \'{}\' for song \'{}\' chart \'{}\' but got achievement rate \'{}\''.format(
expected_achievement_rate, expected['id'], expected['chart'], actual['achievement_rate'],
))
raise Exception(f'Expected an achievement rate of \'{expected_achievement_rate}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got achievement rate \'{actual["achievement_rate"]}\'')
if actual['clear_type'] != expected_clear_type:
raise Exception('Expected a clear_type of \'{}\' for song \'{}\' chart \'{}\' but got clear_type \'{}\''.format(
expected_clear_type, expected['id'], expected['chart'], actual['clear_type'],
))
raise Exception(f'Expected a clear_type of \'{expected_clear_type}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got clear_type \'{actual["clear_type"]}\'')
if actual['combo'] != expected_combo:
raise Exception('Expected a combo of \'{}\' for song \'{}\' chart \'{}\' but got combo \'{}\''.format(
expected_combo, expected['id'], expected['chart'], actual['combo'],
))
raise Exception(f'Expected a combo of \'{expected_combo}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got combo \'{actual["combo"]}\'')
if actual['miss_count'] != expected_miss_count:
raise Exception('Expected a miss count of \'{}\' for song \'{}\' chart \'{}\' but got miss count \'{}\''.format(
expected_miss_count, expected['id'], expected['chart'], actual['miss_count'],
))
raise Exception(f'Expected a miss count of \'{expected_miss_count}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got miss count \'{actual["miss_count"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -194,11 +194,11 @@ class ReflecBeatVolzza(BaseClient):
if resp.child_value('player/player_select_score/name') != self.NAME:
raise Exception(
'Invalid name {} returned on score read!'.format(resp.child_value('player/player_select_score/name'))
f'Invalid name {resp.child_value("player/player_select_score/name")} returned on score read!'
)
if resp.child_value('player/player_select_score/user_id') != extid:
raise Exception(
'Invalid name {} returned on score read!'.format(resp.child_value('player/player_select_score/user_id'))
f'Invalid name {resp.child_value("player/player_select_score/user_id")} returned on score read!'
)
def verify_player_rb5_player_read_rival_ranking_data(self, extid: int) -> None:
@ -222,7 +222,7 @@ class ReflecBeatVolzza(BaseClient):
self.assert_path(resp, "response/player/rival_data/rl/sl/t")
if resp.child_value('player/rival_data/rl/nm') != self.NAME:
raise Exception(
'Invalid name {} returned on rival ranking read!'.format(resp.child_value('player/rival_data/rl/nm'))
f'Invalid name {resp.child_value("player/rival_data/rl/nm")} returned on rival ranking read!'
)
def verify_player_rb5_player_succeed(self, refid: str) -> None:
@ -297,7 +297,7 @@ class ReflecBeatVolzza(BaseClient):
self.assert_path(resp, "response/player/pdata/mylist/list/mlst")
if resp.child_value('player/pdata/base/name') != self.NAME:
raise Exception('Invalid name {} returned on profile read!'.format(resp.child_value('player/pdata/base/name')))
raise Exception(f'Invalid name {resp.child_value("player/pdata/base/name")} returned on profile read!')
def verify_player_rb5_player_read_score(self, refid: str, location: str) -> List[Dict[str, int]]:
call = self.call_node()
@ -568,15 +568,15 @@ class ReflecBeatVolzza(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Always get a player start, regardless of new profile or not
self.verify_player_rb5_player_start(ref_id)
@ -593,7 +593,7 @@ class ReflecBeatVolzza(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify lobby functionality
self.verify_lobby_rb5_lobby_read(location, extid)
@ -691,7 +691,7 @@ class ReflecBeatVolzza(BaseClient):
break
if actual is None:
raise Exception("Didn't find song {} chart {} in response!".format(expected['id'], expected['chart']))
raise Exception(f"Didn't find song {expected['id']} chart {expected['chart']} in response!")
if 'expected_score' in expected:
expected_score = expected['expected_score']
@ -715,25 +715,15 @@ class ReflecBeatVolzza(BaseClient):
expected_miss_count = expected['miss_count']
if actual['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, expected['id'], expected['chart'], actual['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got score \'{actual["score"]}\'')
if actual['achievement_rate'] != expected_achievement_rate:
raise Exception('Expected an achievement rate of \'{}\' for song \'{}\' chart \'{}\' but got achievement rate \'{}\''.format(
expected_achievement_rate, expected['id'], expected['chart'], actual['achievement_rate'],
))
raise Exception(f'Expected an achievement rate of \'{expected_achievement_rate}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got achievement rate \'{actual["achievement_rate"]}\'')
if actual['clear_type'] != expected_clear_type:
raise Exception('Expected a clear_type of \'{}\' for song \'{}\' chart \'{}\' but got clear_type \'{}\''.format(
expected_clear_type, expected['id'], expected['chart'], actual['clear_type'],
))
raise Exception(f'Expected a clear_type of \'{expected_clear_type}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got clear_type \'{actual["clear_type"]}\'')
if actual['combo_type'] != expected_combo_type:
raise Exception('Expected a combo_type of \'{}\' for song \'{}\' chart \'{}\' but got combo_type \'{}\''.format(
expected_combo_type, expected['id'], expected['chart'], actual['combo_type'],
))
raise Exception(f'Expected a combo_type of \'{expected_combo_type}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got combo_type \'{actual["combo_type"]}\'')
if actual['miss_count'] != expected_miss_count:
raise Exception('Expected a miss count of \'{}\' for song \'{}\' chart \'{}\' but got miss count \'{}\''.format(
expected_miss_count, expected['id'], expected['chart'], actual['miss_count'],
))
raise Exception(f'Expected a miss count of \'{expected_miss_count}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got miss count \'{actual["miss_count"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -196,11 +196,11 @@ class ReflecBeatVolzza2(BaseClient):
if resp.child_value('player/player_select_score/name') != self.NAME:
raise Exception(
'Invalid name {} returned on score read!'.format(resp.child_value('player/player_select_score/name'))
f'Invalid name {resp.child_value("player/player_select_score/name")} returned on score read!'
)
if resp.child_value('player/player_select_score/user_id') != extid:
raise Exception(
'Invalid name {} returned on score read!'.format(resp.child_value('player/player_select_score/user_id'))
f'Invalid name {resp.child_value("player/player_select_score/user_id")} returned on score read!'
)
def verify_player_rb5_player_read_rival_ranking_data_5(self, extid: int) -> None:
@ -224,7 +224,7 @@ class ReflecBeatVolzza2(BaseClient):
self.assert_path(resp, "response/player/rival_data/rl/sl/t")
if resp.child_value('player/rival_data/rl/nm') != self.NAME:
raise Exception(
'Invalid name {} returned on rival ranking read!'.format(resp.child_value('player/rival_data/rl/nm'))
f'Invalid name {resp.child_value("player/rival_data/rl/nm")} returned on rival ranking read!'
)
def verify_player_rb5_player_succeed(self, refid: str) -> None:
@ -304,7 +304,7 @@ class ReflecBeatVolzza2(BaseClient):
self.assert_path(resp, "response/player/pdata/mycourse_f")
if resp.child_value('player/pdata/base/name') != self.NAME:
raise Exception('Invalid name {} returned on profile read!'.format(resp.child_value('player/pdata/base/name')))
raise Exception(f'Invalid name {resp.child_value("player/pdata/base/name")} returned on profile read!')
mycourse = [
{
@ -673,15 +673,15 @@ class ReflecBeatVolzza2(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Always get a player start, regardless of new profile or not
self.verify_player_rb5_player_start(ref_id)
@ -698,7 +698,7 @@ class ReflecBeatVolzza2(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify lobby functionality
self.verify_lobby_rb5_lobby_read(location, extid)
@ -805,7 +805,7 @@ class ReflecBeatVolzza2(BaseClient):
break
if actual is None:
raise Exception("Didn't find song {} chart {} in response!".format(expected['id'], expected['chart']))
raise Exception(f"Didn't find song {expected['id']} chart {expected['chart']} in response!")
if 'expected_score' in expected:
expected_score = expected['expected_score']
@ -829,25 +829,15 @@ class ReflecBeatVolzza2(BaseClient):
expected_miss_count = expected['miss_count']
if actual['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, expected['id'], expected['chart'], actual['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got score \'{actual["score"]}\'')
if actual['achievement_rate'] != expected_achievement_rate:
raise Exception('Expected an achievement rate of \'{}\' for song \'{}\' chart \'{}\' but got achievement rate \'{}\''.format(
expected_achievement_rate, expected['id'], expected['chart'], actual['achievement_rate'],
))
raise Exception(f'Expected an achievement rate of \'{expected_achievement_rate}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got achievement rate \'{actual["achievement_rate"]}\'')
if actual['clear_type'] != expected_clear_type:
raise Exception('Expected a clear_type of \'{}\' for song \'{}\' chart \'{}\' but got clear_type \'{}\''.format(
expected_clear_type, expected['id'], expected['chart'], actual['clear_type'],
))
raise Exception(f'Expected a clear_type of \'{expected_clear_type}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got clear_type \'{actual["clear_type"]}\'')
if actual['combo_type'] != expected_combo_type:
raise Exception('Expected a combo_type of \'{}\' for song \'{}\' chart \'{}\' but got combo_type \'{}\''.format(
expected_combo_type, expected['id'], expected['chart'], actual['combo_type'],
))
raise Exception(f'Expected a combo_type of \'{expected_combo_type}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got combo_type \'{actual["combo_type"]}\'')
if actual['miss_count'] != expected_miss_count:
raise Exception('Expected a miss count of \'{}\' for song \'{}\' chart \'{}\' but got miss count \'{}\''.format(
expected_miss_count, expected['id'], expected['chart'], actual['miss_count'],
))
raise Exception(f'Expected a miss count of \'{expected_miss_count}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got miss count \'{actual["miss_count"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)
@ -882,11 +872,11 @@ class ReflecBeatVolzza2(BaseClient):
profile = self.verify_player_rb5_player_read(ref_id, card, location)
for i in range(len(profile['mycourse'])):
if profile['mycourse'][i]['music_id'] != firstcourse[i]['music_id']:
raise Exception('invalid music ID for mycourse entry {}!'.format(i))
raise Exception(f'invalid music ID for mycourse entry {i}!')
if profile['mycourse'][i]['note_grade'] != firstcourse[i]['note_grade']:
raise Exception('invalid chart for mycourse entry {}!'.format(i))
raise Exception(f'invalid chart for mycourse entry {i}!')
if profile['mycourse'][i]['score'] != firstcourse[i]['score']:
raise Exception('invalid score for mycourse entry {}!'.format(i))
raise Exception(f'invalid score for mycourse entry {i}!')
# Do a worse job on a different course
secondcourse = [
@ -915,11 +905,11 @@ class ReflecBeatVolzza2(BaseClient):
profile = self.verify_player_rb5_player_read(ref_id, card, location)
for i in range(len(profile['mycourse'])):
if profile['mycourse'][i]['music_id'] != firstcourse[i]['music_id']:
raise Exception('invalid music ID for mycourse entry {}!'.format(i))
raise Exception(f'invalid music ID for mycourse entry {i}!')
if profile['mycourse'][i]['note_grade'] != firstcourse[i]['note_grade']:
raise Exception('invalid chart for mycourse entry {}!'.format(i))
raise Exception(f'invalid chart for mycourse entry {i}!')
if profile['mycourse'][i]['score'] != firstcourse[i]['score']:
raise Exception('invalid score for mycourse entry {}!'.format(i))
raise Exception(f'invalid score for mycourse entry {i}!')
# Now, do better on our course, and verify it updates
thirdcourse = [
@ -948,11 +938,11 @@ class ReflecBeatVolzza2(BaseClient):
profile = self.verify_player_rb5_player_read(ref_id, card, location)
for i in range(len(profile['mycourse'])):
if profile['mycourse'][i]['music_id'] != thirdcourse[i]['music_id']:
raise Exception('invalid music ID for mycourse entry {}!'.format(i))
raise Exception(f'invalid music ID for mycourse entry {i}!')
if profile['mycourse'][i]['note_grade'] != thirdcourse[i]['note_grade']:
raise Exception('invalid chart for mycourse entry {}!'.format(i))
raise Exception(f'invalid chart for mycourse entry {i}!')
if profile['mycourse'][i]['score'] != thirdcourse[i]['score']:
raise Exception('invalid score for mycourse entry {}!'.format(i))
raise Exception(f'invalid score for mycourse entry {i}!')
# Verify ending game
self.verify_player_rb5_player_end(ref_id)

View File

@ -283,7 +283,7 @@ class SoundVoltexBoothClient(BaseClient):
'exp': resp.child_value('game/exp_point'),
}
else:
raise Exception("Invalid game load type {}".format(msg_type))
raise Exception(f"Invalid game load type {msg_type}")
def verify_game_lounge(self) -> None:
call = self.call_node()
@ -436,15 +436,15 @@ class SoundVoltexBoothClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# SDVX doesn't read the new profile, it asks for the profile itself after calling new
self.verify_game_load(card, ref_id, msg_type='new')
self.verify_game_new(location, ref_id)
@ -457,7 +457,7 @@ class SoundVoltexBoothClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify account freezing
self.verify_game_frozen(ref_id, 900)
@ -472,7 +472,7 @@ class SoundVoltexBoothClient(BaseClient):
# Verify profile loading and saving
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 0:
raise Exception('Profile has nonzero blocks associated with it!')
if profile['block'] != 0:
@ -486,7 +486,7 @@ class SoundVoltexBoothClient(BaseClient):
self.verify_game_save(location, ref_id, packet=123, block=234, exp=42)
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 123:
raise Exception('Profile has invalid blocks associated with it!')
if profile['block'] != 234:
@ -497,7 +497,7 @@ class SoundVoltexBoothClient(BaseClient):
self.verify_game_save(location, ref_id, packet=1, block=2, exp=3)
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 124:
raise Exception('Profile has invalid blocks associated with it!')
if profile['block'] != 236:
@ -509,7 +509,7 @@ class SoundVoltexBoothClient(BaseClient):
self.verify_game_buy(ref_id, 1004, True)
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 124:
raise Exception('Profile has invalid blocks associated with it!')
if profile['block'] != 226:
@ -593,7 +593,7 @@ class SoundVoltexBoothClient(BaseClient):
break
if actual is None:
raise Exception("Didn't find song {} chart {} in response!".format(expected['id'], expected['chart']))
raise Exception(f"Didn't find song {expected['id']} chart {expected['chart']} in response!")
if 'expected_score' in expected:
expected_score = expected['expected_score']
@ -609,17 +609,11 @@ class SoundVoltexBoothClient(BaseClient):
expected_clear_type = expected['clear_type']
if actual['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, expected['id'], expected['chart'], actual['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got score \'{actual["score"]}\'')
if actual['grade'] != expected_grade:
raise Exception('Expected a grade of \'{}\' for song \'{}\' chart \'{}\' but got grade \'{}\''.format(
expected_grade, expected['id'], expected['chart'], actual['grade'],
))
raise Exception(f'Expected a grade of \'{expected_grade}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got grade \'{actual["grade"]}\'')
if actual['clear_type'] != expected_clear_type:
raise Exception('Expected a clear_type of \'{}\' for song \'{}\' chart \'{}\' but got clear_type \'{}\''.format(
expected_clear_type, expected['id'], expected['chart'], actual['clear_type'],
))
raise Exception(f'Expected a clear_type of \'{expected_clear_type}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got clear_type \'{actual["clear_type"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -346,7 +346,7 @@ class SoundVoltexGravityWarsS1Client(BaseClient):
'courses': courses,
}
else:
raise Exception("Invalid game load type {}".format(msg_type))
raise Exception(f"Invalid game load type {msg_type}")
def verify_game_lounge(self) -> None:
call = self.call_node()
@ -567,15 +567,15 @@ class SoundVoltexGravityWarsS1Client(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# SDVX doesn't read the new profile, it asks for the profile itself after calling new
self.verify_game_load(card, ref_id, msg_type='new')
self.verify_game_new(location, ref_id)
@ -588,7 +588,7 @@ class SoundVoltexGravityWarsS1Client(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify account freezing
self.verify_game_frozen(ref_id, 900)
@ -605,7 +605,7 @@ class SoundVoltexGravityWarsS1Client(BaseClient):
# Verify profile loading and saving
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 0:
raise Exception('Profile has nonzero blocks associated with it!')
if profile['block'] != 0:
@ -623,7 +623,7 @@ class SoundVoltexGravityWarsS1Client(BaseClient):
self.verify_game_save(location, ref_id, packet=123, block=234, blaster_energy=42)
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 123:
raise Exception('Profile has invalid blocks associated with it!')
if profile['block'] != 234:
@ -638,7 +638,7 @@ class SoundVoltexGravityWarsS1Client(BaseClient):
self.verify_game_save(location, ref_id, packet=1, block=2, blaster_energy=3)
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 124:
raise Exception('Profile has invalid blocks associated with it!')
if profile['block'] != 236:
@ -654,7 +654,7 @@ class SoundVoltexGravityWarsS1Client(BaseClient):
self.verify_game_buy(ref_id, 0, 29, 1, 10, 0, 29, 3, True)
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 124:
raise Exception('Profile has invalid blocks associated with it!')
if profile['block'] != 226:
@ -754,7 +754,7 @@ class SoundVoltexGravityWarsS1Client(BaseClient):
break
if actual is None:
raise Exception("Didn't find song {} chart {} in response!".format(expected['id'], expected['chart']))
raise Exception(f"Didn't find song {expected['id']} chart {expected['chart']} in response!")
if 'expected_score' in expected:
expected_score = expected['expected_score']
@ -770,17 +770,11 @@ class SoundVoltexGravityWarsS1Client(BaseClient):
expected_clear_type = expected['clear_type']
if actual['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, expected['id'], expected['chart'], actual['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got score \'{actual["score"]}\'')
if actual['grade'] != expected_grade:
raise Exception('Expected a grade of \'{}\' for song \'{}\' chart \'{}\' but got grade \'{}\''.format(
expected_grade, expected['id'], expected['chart'], actual['grade'],
))
raise Exception(f'Expected a grade of \'{expected_grade}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got grade \'{actual["grade"]}\'')
if actual['clear_type'] != expected_clear_type:
raise Exception('Expected a clear_type of \'{}\' for song \'{}\' chart \'{}\' but got clear_type \'{}\''.format(
expected_clear_type, expected['id'], expected['chart'], actual['clear_type'],
))
raise Exception(f'Expected a clear_type of \'{expected_clear_type}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got clear_type \'{actual["clear_type"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -234,7 +234,7 @@ class SoundVoltexGravityWarsS2Client(BaseClient):
'courses': courses,
}
else:
raise Exception("Invalid game load type {}".format(msg_type))
raise Exception(f"Invalid game load type {msg_type}")
def verify_game_save(self, location: str, refid: str, packet: int, block: int, blaster_energy: int) -> None:
call = self.call_node()
@ -590,15 +590,15 @@ class SoundVoltexGravityWarsS2Client(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# SDVX doesn't read the new profile, it asks for the profile itself after calling new
self.verify_game_load(card, ref_id, msg_type='new')
self.verify_game_new(location, ref_id)
@ -611,7 +611,7 @@ class SoundVoltexGravityWarsS2Client(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify rivals node (necessary to return but can hold nothing)
self.verify_game_load_r(ref_id)
@ -631,7 +631,7 @@ class SoundVoltexGravityWarsS2Client(BaseClient):
# Verify profile loading and saving
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 0:
raise Exception('Profile has nonzero blocks associated with it!')
if profile['block'] != 0:
@ -649,7 +649,7 @@ class SoundVoltexGravityWarsS2Client(BaseClient):
self.verify_game_save(location, ref_id, packet=123, block=234, blaster_energy=42)
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 123:
raise Exception('Profile has invalid blocks associated with it!')
if profile['block'] != 234:
@ -664,7 +664,7 @@ class SoundVoltexGravityWarsS2Client(BaseClient):
self.verify_game_save(location, ref_id, packet=1, block=2, blaster_energy=3)
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 124:
raise Exception('Profile has invalid blocks associated with it!')
if profile['block'] != 236:
@ -680,7 +680,7 @@ class SoundVoltexGravityWarsS2Client(BaseClient):
self.verify_game_buy(ref_id, 0, 29, 1, 10, 0, 29, 3, True)
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 124:
raise Exception('Profile has invalid blocks associated with it!')
if profile['block'] != 226:
@ -780,7 +780,7 @@ class SoundVoltexGravityWarsS2Client(BaseClient):
break
if actual is None:
raise Exception("Didn't find song {} chart {} in response!".format(expected['id'], expected['chart']))
raise Exception(f"Didn't find song {expected['id']} chart {expected['chart']} in response!")
if 'expected_score' in expected:
expected_score = expected['expected_score']
@ -796,17 +796,11 @@ class SoundVoltexGravityWarsS2Client(BaseClient):
expected_clear_type = expected['clear_type']
if actual['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, expected['id'], expected['chart'], actual['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got score \'{actual["score"]}\'')
if actual['grade'] != expected_grade:
raise Exception('Expected a grade of \'{}\' for song \'{}\' chart \'{}\' but got grade \'{}\''.format(
expected_grade, expected['id'], expected['chart'], actual['grade'],
))
raise Exception(f'Expected a grade of \'{expected_grade}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got grade \'{actual["grade"]}\'')
if actual['clear_type'] != expected_clear_type:
raise Exception('Expected a clear_type of \'{}\' for song \'{}\' chart \'{}\' but got clear_type \'{}\''.format(
expected_clear_type, expected['id'], expected['chart'], actual['clear_type'],
))
raise Exception(f'Expected a clear_type of \'{expected_clear_type}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got clear_type \'{actual["clear_type"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -262,7 +262,7 @@ class SoundVoltexHeavenlyHavenClient(BaseClient):
'courses': courses,
}
else:
raise Exception("Invalid game load type {}".format(msg_type))
raise Exception(f"Invalid game load type {msg_type}")
def verify_game_save(self, location: str, refid: str, packet: int, block: int, blaster_energy: int) -> None:
call = self.call_node()
@ -669,15 +669,15 @@ class SoundVoltexHeavenlyHavenClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# SDVX doesn't read the new profile, it asks for the profile itself after calling new
self.verify_game_load(card, ref_id, msg_type='new')
self.verify_game_new(location, ref_id)
@ -690,7 +690,7 @@ class SoundVoltexHeavenlyHavenClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify rivals node (necessary to return but can hold nothing)
self.verify_game_load_r(ref_id)
@ -709,7 +709,7 @@ class SoundVoltexHeavenlyHavenClient(BaseClient):
# Verify profile loading and saving
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 0:
raise Exception('Profile has nonzero blocks associated with it!')
if profile['block'] != 0:
@ -727,7 +727,7 @@ class SoundVoltexHeavenlyHavenClient(BaseClient):
self.verify_game_save(location, ref_id, packet=123, block=234, blaster_energy=42)
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 123:
raise Exception('Profile has invalid blocks associated with it!')
if profile['block'] != 234:
@ -740,7 +740,7 @@ class SoundVoltexHeavenlyHavenClient(BaseClient):
self.verify_game_save(location, ref_id, packet=1, block=2, blaster_energy=3)
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 124:
raise Exception('Profile has invalid blocks associated with it!')
if profile['block'] != 236:
@ -754,7 +754,7 @@ class SoundVoltexHeavenlyHavenClient(BaseClient):
self.verify_game_buy(ref_id, 0, 29, 1, 10, 0, 29, 3, True)
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 124:
raise Exception('Profile has invalid blocks associated with it!')
if profile['block'] != 226:
@ -858,7 +858,7 @@ class SoundVoltexHeavenlyHavenClient(BaseClient):
break
if actual is None:
raise Exception("Didn't find song {} chart {} in response!".format(expected['id'], expected['chart']))
raise Exception(f"Didn't find song {expected['id']} chart {expected['chart']} in response!")
if 'expected_score' in expected:
expected_score = expected['expected_score']
@ -874,17 +874,11 @@ class SoundVoltexHeavenlyHavenClient(BaseClient):
expected_clear_type = expected['clear_type']
if actual['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, expected['id'], expected['chart'], actual['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got score \'{actual["score"]}\'')
if actual['grade'] != expected_grade:
raise Exception('Expected a grade of \'{}\' for song \'{}\' chart \'{}\' but got grade \'{}\''.format(
expected_grade, expected['id'], expected['chart'], actual['grade'],
))
raise Exception(f'Expected a grade of \'{expected_grade}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got grade \'{actual["grade"]}\'')
if actual['clear_type'] != expected_clear_type:
raise Exception('Expected a clear_type of \'{}\' for song \'{}\' chart \'{}\' but got clear_type \'{}\''.format(
expected_clear_type, expected['id'], expected['chart'], actual['clear_type'],
))
raise Exception(f'Expected a clear_type of \'{expected_clear_type}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got clear_type \'{actual["clear_type"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -339,7 +339,7 @@ class SoundVoltexInfiniteInfectionClient(BaseClient):
'courses': courses,
}
else:
raise Exception("Invalid game load type {}".format(msg_type))
raise Exception(f"Invalid game load type {msg_type}")
def verify_game_lounge(self) -> None:
call = self.call_node()
@ -519,15 +519,15 @@ class SoundVoltexInfiniteInfectionClient(BaseClient):
card = cardid
else:
card = self.random_card()
print("Generated random card ID {} for use.".format(card))
print(f"Generated random card ID {card} for use.")
if cardid is None:
self.verify_cardmng_inquire(card, msg_type='unregistered', paseli_enabled=paseli_enabled)
ref_id = self.verify_cardmng_getrefid(card)
if len(ref_id) != 16:
raise Exception('Invalid refid \'{}\' returned when registering card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when registering card')
if ref_id != self.verify_cardmng_inquire(card, msg_type='new', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# SDVX doesn't read the new profile, it asks for the profile itself after calling new
self.verify_game_load(card, ref_id, msg_type='new')
self.verify_game_new(location, ref_id)
@ -540,7 +540,7 @@ class SoundVoltexInfiniteInfectionClient(BaseClient):
self.verify_cardmng_authpass(ref_id, correct=True)
self.verify_cardmng_authpass(ref_id, correct=False)
if ref_id != self.verify_cardmng_inquire(card, msg_type='query', paseli_enabled=paseli_enabled):
raise Exception('Invalid refid \'{}\' returned when querying card'.format(ref_id))
raise Exception(f'Invalid refid \'{ref_id}\' returned when querying card')
# Verify account freezing
self.verify_game_frozen(ref_id, 900)
@ -555,7 +555,7 @@ class SoundVoltexInfiniteInfectionClient(BaseClient):
# Verify profile loading and saving
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 0:
raise Exception('Profile has nonzero blocks associated with it!')
if profile['block'] != 0:
@ -575,7 +575,7 @@ class SoundVoltexInfiniteInfectionClient(BaseClient):
self.verify_game_save(location, ref_id, packet=123, block=234, blaster_energy=42, appealcards=[])
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 123:
raise Exception('Profile has invalid blocks associated with it!')
if profile['block'] != 234:
@ -592,7 +592,7 @@ class SoundVoltexInfiniteInfectionClient(BaseClient):
self.verify_game_save(location, ref_id, packet=1, block=2, blaster_energy=3, appealcards=[])
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 124:
raise Exception('Profile has invalid blocks associated with it!')
if profile['block'] != 236:
@ -610,7 +610,7 @@ class SoundVoltexInfiniteInfectionClient(BaseClient):
self.verify_game_buy(ref_id, 0, 29, 1, 10, 0, 29, 3, True)
profile = self.verify_game_load(card, ref_id, msg_type='existing')
if profile['name'] != self.NAME:
raise Exception('Profile has incorrect name {} associated with it!'.format(profile['name']))
raise Exception(f'Profile has incorrect name {profile["name"]} associated with it!')
if profile['packet'] != 124:
raise Exception('Profile has invalid blocks associated with it!')
if profile['block'] != 226:
@ -631,9 +631,9 @@ class SoundVoltexInfiniteInfectionClient(BaseClient):
profile = self.verify_game_load(card, ref_id, msg_type='existing')
for i in [1001, 1002, 1003, 1004, 1005]:
if i not in profile['appealcards']:
raise Exception('Profile missing appeal card {}'.format(i))
raise Exception(f'Profile missing appeal card {i}')
if profile['appealcards'][i] != 0:
raise Exception('Profile has bad count for appeal card {}'.format(i))
raise Exception(f'Profile has bad count for appeal card {i}')
# Verify that we can finish skill analyzer courses
self.verify_game_save_c(location, ref_id, 14, 3)
@ -721,7 +721,7 @@ class SoundVoltexInfiniteInfectionClient(BaseClient):
break
if actual is None:
raise Exception("Didn't find song {} chart {} in response!".format(expected['id'], expected['chart']))
raise Exception(f"Didn't find song {expected['id']} chart {expected['chart']} in response!")
if 'expected_score' in expected:
expected_score = expected['expected_score']
@ -737,17 +737,11 @@ class SoundVoltexInfiniteInfectionClient(BaseClient):
expected_clear_type = expected['clear_type']
if actual['score'] != expected_score:
raise Exception('Expected a score of \'{}\' for song \'{}\' chart \'{}\' but got score \'{}\''.format(
expected_score, expected['id'], expected['chart'], actual['score'],
))
raise Exception(f'Expected a score of \'{expected_score}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got score \'{actual["score"]}\'')
if actual['grade'] != expected_grade:
raise Exception('Expected a grade of \'{}\' for song \'{}\' chart \'{}\' but got grade \'{}\''.format(
expected_grade, expected['id'], expected['chart'], actual['grade'],
))
raise Exception(f'Expected a grade of \'{expected_grade}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got grade \'{actual["grade"]}\'')
if actual['clear_type'] != expected_clear_type:
raise Exception('Expected a clear_type of \'{}\' for song \'{}\' chart \'{}\' but got clear_type \'{}\''.format(
expected_clear_type, expected['id'], expected['chart'], actual['clear_type'],
))
raise Exception(f'Expected a clear_type of \'{expected_clear_type}\' for song \'{expected["id"]}\' chart \'{expected["chart"]}\' but got clear_type \'{actual["clear_type"]}\'')
# Sleep so we don't end up putting in score history on the same second
time.sleep(1)

View File

@ -14,7 +14,7 @@ class AESCipher:
self.__key = hashlib.sha256(key.encode('utf-8')).digest()
def __pad(self, s: str) -> str:
intermediate = "{}.{}".format(len(s), s)
intermediate = f"{len(s)}.{s}"
while len(intermediate) % self.__padamt != 0:
intermediate = intermediate + '-'
return intermediate

View File

@ -220,7 +220,7 @@ class CardCipher:
"""
if len(cardid) != 16:
raise CardCipherException(
'Expected 16-character card ID, got {}'.format(len(cardid)),
f'Expected 16-character card ID, got {len(cardid)}',
)
cardint = [int(cardid[i:(i + 2)], 16) for i in range(0, len(cardid), 2)]
@ -284,13 +284,13 @@ class CardCipher:
if len(cardid) != 16:
raise CardCipherException(
'Expected 16-character card ID, got {}'.format(len(cardid)),
f'Expected 16-character card ID, got {len(cardid)}',
)
for c in cardid:
if c not in CardCipher.VALID_CHARS:
raise CardCipherException(
'Got unexpected character {} in card ID'.format(c),
f'Got unexpected character {c} in card ID',
)
# Convert chars to groups
@ -365,7 +365,7 @@ class CardCipher:
def __encode(inbytes: bytes) -> bytes:
if len(inbytes) != 8:
raise CardCipherException(
'Expected 8-byte input, got {}'.format(len(inbytes)),
f'Expected 8-byte input, got {len(inbytes)}',
)
inp = [b for b in inbytes]
@ -381,7 +381,7 @@ class CardCipher:
def __decode(inbytes: bytes) -> bytes:
if len(inbytes) != 8:
raise CardCipherException(
'Expected 8-byte input, got {}'.format(len(inbytes)),
f'Expected 8-byte input, got {len(inbytes)}',
)
inp = [b for b in inbytes]

View File

@ -130,9 +130,9 @@ class HTTP:
# Add first part of header
if request:
out.append('{} {} {}'.format(parsed_headers['method'], parsed_headers['uri'], parsed_headers['version']))
out.append(f'{parsed_headers["method"]} {parsed_headers["uri"]} {parsed_headers["version"]}')
elif response:
out.append('{} {} {}'.format(parsed_headers['version'], parsed_headers['code'], parsed_headers['error']))
out.append(f'{parsed_headers["version"]} {parsed_headers["code"]} {parsed_headers["error"]}')
else:
raise Exception("Logic error!")
@ -149,9 +149,9 @@ class HTTP:
continue
else:
# Woah, can't figure this out!
raise Exception("Unknown transfer-encodign {}".format(value))
raise Exception(f"Unknown transfer-encodign {value}")
out.append("{}: {}".format(name, value))
out.append(f"{name}: {value}")
# Concatenate it with the binary data
return "\r\n".join(out).encode('ascii') + b'\r\n\r\n' + data

View File

@ -19,7 +19,7 @@ class ID:
extid_str = str(extid)
while len(extid_str) < 8:
extid_str = '0' + extid_str
return '{}-{}'.format(extid_str[0:4], extid_str[4:8])
return f'{extid_str[0:4]}-{extid_str[4:8]}'
@staticmethod
def parse_extid(extid: str) -> Optional[int]:
@ -46,7 +46,7 @@ class ID:
"""
Take a machine ID as an integer, format it as a string.
"""
return 'US-{}'.format(machine_id)
return f'US-{machine_id}'
@staticmethod
def parse_machine_id(machine_id: str) -> Optional[int]:

View File

@ -43,10 +43,10 @@ class Model:
elif len(parts) == 4:
game, dest, spec, rev = parts
return Model(game, dest, spec, rev, None)
raise Exception('Couldn\'t parse model {}'.format(model))
raise Exception(f'Couldn\'t parse model {model}')
def __str__(self) -> str:
if self.version is None:
return '{}:{}:{}:{}'.format(self.game, self.dest, self.spec, self.rev)
return f'{self.game}:{self.dest}:{self.spec}:{self.rev}'
else:
return '{}:{}:{}:{}:{}'.format(self.game, self.dest, self.spec, self.rev, self.version)
return f'{self.game}:{self.dest}:{self.spec}:{self.rev}:{self.version}'

View File

@ -44,12 +44,12 @@ class APIClient:
def __exchange_data(self, request_uri: str, request_args: Dict[str, Any]) -> Dict[str, Any]:
if self.base_uri[-1:] != '/':
uri = '{}/{}'.format(self.base_uri, request_uri)
uri = f'{self.base_uri}/{request_uri}'
else:
uri = '{}{}'.format(self.base_uri, request_uri)
uri = f'{self.base_uri}{request_uri}'
headers = {
'Authorization': 'Token {}'.format(self.token),
'Authorization': f'Token {self.token}',
'Content-Type': 'application/json; charset=utf-8',
}
data = json.dumps(request_args).encode('utf8')
@ -67,7 +67,7 @@ class APIClient:
raise APIException('Failed to query remote server!')
if r.headers['content-type'] != 'application/json; charset=utf-8':
raise APIException('API returned invalid content type \'{}\'!'.format(r.headers['content-type']))
raise APIException(f'API returned invalid content type \'{r.headers["content-type"]}\'!')
jsondata = r.json()
@ -75,7 +75,7 @@ class APIClient:
return jsondata
if 'error' not in jsondata:
raise APIException('API returned error code {} but did not include \'error\' attribute in response JSON!'.format(r.status_code))
raise APIException(f'API returned error code {r.status_code} but did not include \'error\' attribute in response JSON!')
error = jsondata['error']
if r.status_code == 401:
@ -85,7 +85,7 @@ class APIClient:
if r.status_code == 405:
raise UnrecognizedRequestAPIException('The server did not recognize the request!')
if r.status_code == 500:
raise RemoteServerErrorAPIException('The server had an error processing the request and returned \'{}\''.format(error))
raise RemoteServerErrorAPIException(f'The server had an error processing the request and returned \'{error}\'')
if r.status_code == 501:
raise UnsupportedVersionAPIException('The server does not support this version of the API!')
raise APIException('The server returned an invalid status code {}!', format(r.status_code))
@ -184,7 +184,7 @@ class APIClient:
try:
servergame, serverversion = self.__translate(game, version)
resp = self.__exchange_data(
'{}/{}/{}'.format(self.API_VERSION, servergame, serverversion),
f'{self.API_VERSION}/{servergame}/{serverversion}',
{
'ids': ids,
'type': idtype,
@ -221,7 +221,7 @@ class APIClient:
if until is not None:
data['until'] = until
resp = self.__exchange_data(
'{}/{}/{}'.format(self.API_VERSION, servergame, serverversion),
f'{self.API_VERSION}/{servergame}/{serverversion}',
data,
)
return resp['records']
@ -237,7 +237,7 @@ class APIClient:
try:
servergame, serverversion = self.__translate(game, version)
resp = self.__exchange_data(
'{}/{}/{}'.format(self.API_VERSION, servergame, serverversion),
f'{self.API_VERSION}/{servergame}/{serverversion}',
{
'ids': ids,
'type': idtype,
@ -255,7 +255,7 @@ class APIClient:
try:
servergame, serverversion = self.__translate(game, version)
resp = self.__exchange_data(
'{}/{}/{}'.format(self.API_VERSION, servergame, serverversion),
f'{self.API_VERSION}/{servergame}/{serverversion}',
{
'ids': [],
'type': 'server',

View File

@ -121,12 +121,7 @@ class Data:
@classmethod
def sqlalchemy_url(cls, config: Dict[str, Any]) -> str:
return "mysql://{}:{}@{}/{}?charset=utf8mb4".format(
config['database']['user'],
config['database']['password'],
config['database']['address'],
config['database']['database'],
)
return f"mysql://{config['database']['user']}:{config['database']['password']}@{config['database']['address']}/{config['database']['database']}?charset=utf8mb4"
@classmethod
def create_engine(cls, config: Dict[str, Any]) -> Engine:
@ -149,9 +144,9 @@ class Data:
'-c',
os.path.join(base_dir, 'alembic.ini'),
'-x',
'script_location={}'.format(base_dir),
f'script_location={base_dir}',
'-x',
'sqlalchemy.url={}'.format(self.__url),
f'sqlalchemy.url={self.__url}',
command,
]
alembicArgs.extend(args)

View File

@ -298,10 +298,7 @@ class GameData(BaseData):
if result['start_time'] == start_time and result['end_time'] == end_time:
# This is just this event being updated, that's fine.
continue
raise Exception('This event overlaps an existing one with start time {} and end time {}'.format(
result['start_time'],
result['end_time'],
))
raise Exception(f'This event overlaps an existing one with start time {result["start_time"]} and end time {result["end_time"]}')
# Insert or update this setting
sql = (

View File

@ -101,12 +101,7 @@ class MusicData(BaseData):
cursor = self.execute(sql, {'songid': songid, 'chart': songchart, 'game': game, 'version': version})
if cursor.rowcount != 1:
# music doesn't exist
raise Exception('Song {} chart {} doesn\'t exist for game {} version {}'.format(
songid,
songchart,
game,
version,
))
raise Exception(f'Song {songid} chart {songchart} doesn\'t exist for game {game} version {version}')
result = cursor.fetchone()
return result['id']
@ -226,11 +221,7 @@ class MusicData(BaseData):
)
except IntegrityError:
raise ScoreSaveException(
'There is already an attempt by {} for music id {} at {}'.format(
userid if userid is not None else 0,
musicid,
ts,
)
f'There is already an attempt by {userid if userid is not None else 0} for music id {musicid} at {ts}'
)
def get_score(self, game: str, version: int, userid: UserID, songid: int, songchart: int) -> Optional[Score]:
@ -584,7 +575,7 @@ class MusicData(BaseData):
"WHERE music.id = :musicid"
)
if interested_versions is not None:
sql += " AND music.version in ({})".format(",".join(str(int(v)) for v in interested_versions))
sql += f" AND music.version in ({','.join(str(int(v)) for v in interested_versions)})"
cursor = self.execute(sql, {'musicid': musicid})
all_songs = []
for result in cursor.fetchall():
@ -764,17 +755,11 @@ class MusicData(BaseData):
if len(userlist) == 0:
# We don't have any users, but SQL will shit the bed, so lets add a fake one.
userlist.append(UserID(-1))
user_sql = (
"SELECT userid FROM score WHERE score.musicid = played.musicid AND score.userid IN :userlist {} ORDER BY points DESC, timestamp DESC LIMIT 1"
).format(location_sql)
user_sql = f"SELECT userid FROM score WHERE score.musicid = played.musicid AND score.userid IN :userlist {location_sql} ORDER BY points DESC, timestamp DESC LIMIT 1"
params['userlist'] = tuple(userlist)
else:
user_sql = (
"SELECT userid FROM score WHERE score.musicid = played.musicid {} ORDER BY points DESC, timestamp DESC LIMIT 1"
).format(location_sql)
records_sql = (
"SELECT ({}) AS userid, musicid FROM ({}) played"
).format(user_sql, musicid_sql)
user_sql = f"SELECT userid FROM score WHERE score.musicid = played.musicid {location_sql} ORDER BY points DESC, timestamp DESC LIMIT 1"
records_sql = f"SELECT ({user_sql}) AS userid, musicid FROM ({musicid_sql}) played"
# Now, join it up against the score and music table to grab the info we need
sql = (

View File

@ -270,7 +270,7 @@ class NetworkData(BaseData):
if until_id is not None:
wheres.append("id < :until_id")
if len(wheres) > 0:
sql = sql + "WHERE {} ".format(' AND '.join(wheres))
sql = sql + f"WHERE {' AND '.join(wheres)} "
# Order it newest to oldest
sql = sql + "ORDER BY id DESC"

View File

@ -32,12 +32,7 @@ class User:
self.admin = admin
def __repr__(self) -> str:
return "User(userid={}, username={}, email={}, admin={})".format(
self.id,
self.username,
self.email,
self.admin,
)
return f"User(userid={self.id}, username={self.username}, email={self.email}, admin={self.admin})"
class Achievement:
@ -64,12 +59,7 @@ class Achievement:
self.data = ValidatedDict(data)
def __repr__(self) -> str:
return "Achievement(achievementid={}, achievementtype={}, timestamp={}, data={})".format(
self.id,
self.type,
self.timestamp,
self.data,
)
return f"Achievement(achievementid={self.id}, achievementtype={self.type}, timestamp={self.timestamp}, data={self.data})"
class Link:
@ -94,12 +84,7 @@ class Link:
self.data = ValidatedDict(data)
def __repr__(self) -> str:
return "Link(userid={}, linktype={}, other_userid={}, data={})".format(
self.userid,
self.type,
self.other_userid,
self.data,
)
return f"Link(userid={self.userid}, linktype={self.type}, other_userid={self.other_userid}, data={self.data})"
class Machine:
@ -147,17 +132,7 @@ class Machine:
self.data = ValidatedDict(data)
def __repr__(self) -> str:
return "Machine(machineid={}, pcbid={}, name={}, description={}, arcade={}, port={}, game={}, version={}, data={})".format(
self.id,
self.pcbid,
self.name,
self.description,
self.arcade,
self.port,
self.game,
self.version,
self.data,
)
return f"Machine(machineid={self.id}, pcbid={self.pcbid}, name={self.name}, description={self.description}, arcade={self.arcade}, port={self.port}, game={self.game}, version={self.version}, data={self.data})"
class Arcade:
@ -189,14 +164,7 @@ class Arcade:
self.owners = owners
def __repr__(self) -> str:
return "Arcade(arcadeid={}, name={}, description={}, pin={}, data={}, owners={})".format(
self.id,
self.name,
self.description,
self.pin,
self.data,
self.owners,
)
return f"Arcade(arcadeid={self.id}, name={self.name}, description={self.description}, pin={self.pin}, data={self.data}, owners={self.owners})"
class Song:
@ -238,16 +206,7 @@ class Song:
self.data = ValidatedDict(data)
def __repr__(self) -> str:
return "Song(game={}, version={}, songid={}, songchart={}, name={}, artist={}, genre={}, data={})".format(
self.game,
self.version,
self.id,
self.chart,
self.name,
self.artist,
self.genre,
self.data,
)
return f"Song(game={self.game}, version={self.version}, songid={self.id}, songchart={self.chart}, name={self.name}, artist={self.artist}, genre={self.genre}, data={self.data})"
class Score:
@ -292,17 +251,7 @@ class Score:
self.data = ValidatedDict(data)
def __repr__(self) -> str:
return "Score(key={}, songid={}, songchart={}, points={}, timestamp={}, update={}, location={}, plays={}, data={})".format(
self.key,
self.id,
self.chart,
self.points,
self.timestamp,
self.update,
self.location,
self.plays,
self.data,
)
return f"Score(key={self.key}, songid={self.id}, songchart={self.chart}, points={self.points}, timestamp={self.timestamp}, update={self.update}, location={self.location}, plays={self.plays}, data={self.data})"
class Attempt:
@ -344,16 +293,7 @@ class Attempt:
self.data = ValidatedDict(data)
def __repr__(self) -> str:
return "Attempt(key={}, songid={}, songchart={}, points={}, timestamp={}, location={}, new_record={}, data={})".format(
self.key,
self.id,
self.chart,
self.points,
self.timestamp,
self.location,
self.new_record,
self.data,
)
return f"Attempt(key={self.key}, songid={self.id}, songchart={self.chart}, points={self.points}, timestamp={self.timestamp}, location={self.location}, new_record={self.new_record}, data={self.data})"
class News:
@ -378,12 +318,7 @@ class News:
self.body = body
def __repr__(self) -> str:
return "News(newsid={}, timestamp={}, title={}, body={})".format(
self.id,
self.timestamp,
self.title,
self.body,
)
return f"News(newsid={self.id}, timestamp={self.timestamp}, title={self.title}, body={self.body})"
class Event:
@ -412,14 +347,7 @@ class Event:
self.data = ValidatedDict(data)
def __repr__(self) -> str:
return "Event(auditid={}, timestamp={}, userid={}, arcadeid={}, event={}, data={})".format(
self.id,
self.timestamp,
self.userid,
self.arcadeid,
self.type,
self.data,
)
return f"Event(auditid={self.id}, timestamp={self.timestamp}, userid={self.userid}, arcadeid={self.arcadeid}, event={self.type}, data={self.data})"
class Item:
@ -441,11 +369,7 @@ class Item:
self.data = ValidatedDict(data)
def __repr__(self) -> str:
return "Item(cattype={}, catid={}, data={})".format(
self.type,
self.id,
self.data,
)
return f"Item(cattype={self.type}, catid={self.id}, data={self.data})"
class Client:
@ -470,12 +394,7 @@ class Client:
self.token = token
def __repr__(self) -> str:
return "Client(clientid={}, timestamp={}, name={}, token={})".format(
self.id,
self.timestamp,
self.name,
self.token,
)
return f"Client(clientid={self.id}, timestamp={self.timestamp}, name={self.name}, token={self.token})"
class Server:
@ -504,11 +423,4 @@ class Server:
self.allow_scores = allow_scores
def __repr__(self) -> str:
return "Server(serverid={}, timestamp={}, uri={}, token={}, allow_stats={}, allow_scores={})".format(
self.id,
self.timestamp,
self.uri,
self.token,
self.allow_stats,
self.allow_scores,
)
return f"Server(serverid={self.id}, timestamp={self.timestamp}, uri={self.uri}, token={self.token}, allow_stats={self.allow_stats}, allow_scores={self.allow_scores})"

View File

@ -79,7 +79,7 @@ class IFS:
files[node_name] = (node.value[0] + data_index, node.value[1], node.value[2])
else:
for subchild in node.children:
get_children(os.path.join(parent, "{}/".format(real_name)), subchild)
get_children(os.path.join(parent, f"{real_name}/"), subchild)
get_children("/", header)
@ -110,7 +110,7 @@ class IFS:
if md5sum == filename:
if textfmt == "argb8888rev":
name = '{}.png'.format(subchild.attribute('name'))
name = f'{subchild.attribute("name")}.png'
else:
name = subchild.attribute('name')
newpath = os.path.join(path, name)

View File

@ -82,7 +82,7 @@ class IIDXMusicDB:
leap = 0x340
if sig[0] != b'IIDX':
raise Exception('Invalid signature \'{}\' found!'.format(sig[0]))
raise Exception(f'Invalid signature \'{sig[0]}\' found!')
def parse_string(string: bytes) -> str:
for i in range(len(string)):

View File

@ -38,7 +38,7 @@ class TwoDX:
wavOffset = offset + headerSize
wavData = data[wavOffset:(wavOffset + wavSize)]
self.__files['{}_{}.wav'.format(self.__name, fileno)] = wavData
self.__files[f'{self.__name}_{fileno}.wav'] = wavData
fileno = fileno + 1
@property

View File

@ -687,7 +687,7 @@ def updatepcbid() -> Dict[str, Any]:
# Make sure we don't duplicate port assignments
other_pcbid = g.data.local.machine.from_port(machine['port'])
if other_pcbid is not None and other_pcbid != machine['pcbid']:
raise Exception('This port is already in use by \'{}\'!'.format(other_pcbid))
raise Exception(f'This port is already in use by \'{other_pcbid}\'!')
if machine['port'] < 1 or machine['port'] > 65535:
raise Exception('The specified port is out of range!')

View File

@ -119,7 +119,7 @@ def jsx(filename: str) -> Response:
# Figure out what our update time is to namespace on
jsxfile = os.path.join(static_location, filename)
mtime = os.path.getmtime(jsxfile)
namespace = '{}.{}'.format(mtime, jsxfile)
namespace = f'{mtime}.{jsxfile}'
jsx = g.cache.get(namespace)
if jsx is None:
transformer = JSXTransformer()

View File

@ -309,7 +309,7 @@ def updatearcade(arcadeid: int, attribute: str) -> Dict[str, Any]:
elif attribute == 'mask_services_url':
arcade.data.replace_bool('mask_services_url', new_value)
else:
raise Exception('Unknown attribute {} to update!'.format(attribute))
raise Exception(f'Unknown attribute {attribute} to update!')
g.data.local.machine.put_arcade(arcade)

View File

@ -39,7 +39,7 @@ class FrontendBase:
self.cache = cache
def make_index(self, songid: int, chart: int) -> str:
return '{}-{}'.format(songid, chart)
return f'{songid}-{chart}'
def get_duplicate_id(self, musicid: int, chart: int) -> Optional[Tuple[int, int]]:
return None
@ -105,7 +105,7 @@ class FrontendBase:
def get_all_songs(self, force_db_load: bool=False) -> Dict[int, Dict[str, Any]]:
if not force_db_load:
cached_songs = self.cache.get('{}.sorted_songs'.format(self.game))
cached_songs = self.cache.get(f'{self.game}.sorted_songs')
if cached_songs is not None:
return cached_songs
@ -120,7 +120,7 @@ class FrontendBase:
else:
songs[song.id] = self.merge_song(songs[song.id], song)
self.cache.set('{}.sorted_songs'.format(self.game), songs, timeout=600)
self.cache.set(f'{self.game}.sorted_songs', songs, timeout=600)
return songs
def get_all_player_info(self, userids: List[UserID], limit: Optional[int]=None, allow_remote: bool=False) -> Dict[UserID, Dict[int, Dict[str, Any]]]:

View File

@ -57,7 +57,7 @@ def viewplayer(userid: UserID) -> Response:
latest_version = sorted(djinfo.keys(), reverse=True)[0]
return render_react(
'{}\'s BishiBashi Profile'.format(djinfo[latest_version]['name']),
f'{djinfo[latest_version]["name"]}\'s BishiBashi Profile',
'bishi/player.react.js',
{
'playerid': userid,

View File

@ -26,7 +26,7 @@ class DDRFrontend(FrontendBase):
DDRBase.CHART_DOUBLE_CHALLENGE,
]
valid_rival_types = ['friend_{}'.format(i) for i in range(10)]
valid_rival_types = [f'friend_{i}' for i in range(10)]
max_active_rivals = {
VersionConstants.DDR_X2: 1,

Some files were not shown because too many files have changed in this diff Show More