1
0
mirror of synced 2024-09-23 19:08:21 +02:00

Address newest crop of lint issue with new flake8 tool.

This commit is contained in:
Jennifer Taylor 2021-07-06 22:29:41 +00:00
parent debc7b3aac
commit de3f9107cd
14 changed files with 37 additions and 37 deletions

View File

@ -218,7 +218,7 @@ class JubeatProp(
scores = []
absentees = []
for [userid, player] in profiles:
for [userid, _player] in profiles:
# Look up scores for last week if they played
league_score = data.local.user.get_achievement(
cls.game,

View File

@ -91,7 +91,7 @@ class PopnMusicEclale(PopnMusicBase):
# Calculate most popular characters
profiles = self.data.remote.user.get_all_profiles(self.game, self.version)
charas: Dict[int, int] = {}
for (userid, profile) in profiles:
for (_userid, profile) in profiles:
chara = profile.get_int('chara', -1)
if chara <= 0:
continue
@ -109,7 +109,7 @@ class PopnMusicEclale(PopnMusicBase):
# Output the top 20 of them
rank = 1
for (charaid, usecount) in charamap[:20]:
for (charaid, _usecount) in charamap[:20]:
popular = Node.void('popular')
root.add_child(popular)
popular.add_child(Node.s16('rank', rank))
@ -117,7 +117,7 @@ class PopnMusicEclale(PopnMusicBase):
rank = rank + 1
# Output the hit chart
for (songid, plays) in self.data.local.music.get_hit_chart(self.game, self.version, 500):
for (songid, _plays) in self.data.local.music.get_hit_chart(self.game, self.version, 500):
popular_music = Node.void('popular_music')
root.add_child(popular_music)
popular_music.add_child(Node.s16('music_num', songid))

View File

@ -282,7 +282,7 @@ class PopnMusicUsaNeko(PopnMusicBase):
# Calculate most popular characters
profiles = self.data.remote.user.get_all_profiles(self.game, self.version)
charas: Dict[int, int] = {}
for (userid, profile) in profiles:
for (_userid, profile) in profiles:
chara = profile.get_int('chara', -1)
if chara <= 0:
continue
@ -299,14 +299,14 @@ class PopnMusicUsaNeko(PopnMusicBase):
)
# Top 20 Popular characters
for rank, (charaid, usecount) in enumerate(charamap[:20]):
for rank, (charaid, _usecount) in enumerate(charamap[:20]):
popular = Node.void('popular')
root.add_child(popular)
popular.add_child(Node.s16('rank', rank + 1))
popular.add_child(Node.s16('chara_num', charaid))
# Top 500 Popular music
for (songid, plays) in self.data.local.music.get_hit_chart(self.game, self.version, 500):
for (songid, _plays) in self.data.local.music.get_hit_chart(self.game, self.version, 500):
popular_music = Node.void('popular_music')
root.add_child(popular_music)
popular_music.add_child(Node.s16('music_num', songid))

View File

@ -129,7 +129,7 @@ class ReflecBeatLimelight(ReflecBeatBase):
def __add_event_info(self, request: Node) -> None:
events: Dict[int, int] = {}
for (eventid, phase) in events.items():
for (_eventid, _phase) in events.items():
data = Node.void('data')
request.add_child(data)
data.add_child(Node.s32('type', -1))
@ -158,7 +158,7 @@ class ReflecBeatLimelight(ReflecBeatBase):
hitchart = self.data.local.music.get_hit_chart(self.game, self.version, 10)
rank = 1
for (mid, plays) in hitchart:
for (mid, _plays) in hitchart:
record = Node.void('record')
originals.add_child(record)
record.add_child(Node.s16('id', mid))

View File

@ -122,7 +122,7 @@ class ReflecBeat(ReflecBeatBase):
def __add_event_info(self, request: Node) -> None:
events: Dict[int, int] = {}
for (eventid, phase) in events.items():
for (_eventid, _phase) in events.items():
data = Node.void('data')
request.add_child(data)
data.add_child(Node.s32('type', -1))

View File

@ -3269,7 +3269,7 @@ class SoundVoltexHeavenlyHaven(
catalog = Node.void('catalog')
game.add_child(catalog)
for item in []: # type: ignore
for _item in []: # type: ignore
info = Node.void('info')
catalog.add_child(info)
info.add_child(Node.u8('catalog_type', 0))

View File

@ -434,11 +434,11 @@ class PopnMusicEclaleClient(BaseClient):
# Verify unlocks/story mode work
unlocks = self.verify_player23_read(ref_id, msg_type='query')
for item in unlocks['items']:
for _ in unlocks['items']:
raise Exception('Got nonzero items count on a new card!')
for med in unlocks['medals']:
for _ in unlocks['medals']:
raise Exception('Got nonzero medals count on a new card!')
for char in unlocks['characters']:
for _ in unlocks['characters']:
raise Exception('Got nonzero characters count on a new card!')
if unlocks['lumina'][0]['lumina'] != 300:
raise Exception('Got wrong default value for lumina on a new card!')
@ -483,9 +483,9 @@ class PopnMusicEclaleClient(BaseClient):
if cardid is None:
# Verify score handling
scores = self.verify_player23_read_score(ref_id)
for medal in scores['medals']:
for _ in scores['medals']:
raise Exception('Got nonzero medals count on a new card!')
for score in scores['scores']:
for _ in scores['scores']:
raise Exception('Got nonzero scores count on a new card!')
for phase in [1, 2]:

View File

@ -487,9 +487,9 @@ class PopnMusicUsaNekoClient(BaseClient):
# Song unlocks after one play
continue
raise Exception('Got nonzero items count on a new card!')
for char in unlocks['characters']:
for _ in unlocks['characters']:
raise Exception('Got nonzero characters count on a new card!')
for course in unlocks['courses']:
for _ in unlocks['courses']:
raise Exception('Got nonzero course count on a new card!')
if unlocks['points'][0]['points'] != 300:
raise Exception('Got wrong default value for points on a new card!')
@ -540,9 +540,9 @@ class PopnMusicUsaNekoClient(BaseClient):
# Verify score handling
scores = self.verify_player24_read_score(ref_id)
for medal in scores['medals']:
for _ in scores['medals']:
raise Exception('Got nonzero medals count on a new card!')
for score in scores['scores']:
for _ in scores['scores']:
raise Exception('Got nonzero scores count on a new card!')
for phase in [1, 2]:

View File

@ -336,7 +336,7 @@ def affine_composite(
imgy, result = results.get()
lines[imgy] = result
for proc in procs:
for _proc in procs:
work.put(None)
for proc in procs:
proc.join()

View File

@ -1162,7 +1162,7 @@ class TXP2File(TrackedCoverage, VerboseOutput):
if self.endian == "<":
magic = b"TDXT"
elif self.endian == ">":
magic != b"TXDT"
magic = b"TXDT"
else:
raise Exception("Unexpected texture format!")

View File

@ -468,7 +468,7 @@ class AFPRenderer(VerboseOutput):
verbose: bool = False,
) -> Generator[Image.Image, None, None]:
# Given a path to a SWF root animation, attempt to render it to a list of frames.
for name, swf in self.swfs.items():
for _name, swf in self.swfs.items():
if swf.exported_name == path:
# This is the SWF we care about.
with self.debugging(verbose):
@ -483,7 +483,7 @@ class AFPRenderer(VerboseOutput):
path: str,
) -> Rectangle:
# Given a path to a SWF root animation, find its bounding rectangle.
for name, swf in self.swfs.items():
for _name, swf in self.swfs.items():
if swf.exported_name == path:
# This is the SWF we care about.
return swf.location
@ -496,7 +496,7 @@ class AFPRenderer(VerboseOutput):
) -> int:
# Given a path to a SWF root animation, figure out how many frames are
# in that root path with no regard to bytecode 'stop()' commands.
for name, swf in self.swfs.items():
for _name, swf in self.swfs.items():
if swf.exported_name == path:
# This is the SWF we care about.
return len(swf.frames)
@ -509,7 +509,7 @@ class AFPRenderer(VerboseOutput):
) -> int:
# Given a path to a SWF root animation, figure out how many milliseconds are
# occupied by each frame.
for name, swf in self.swfs.items():
for _name, swf in self.swfs.items():
if swf.exported_name == path:
# This is the SWF we care about.
spf = 1.0 / swf.fps
@ -523,7 +523,7 @@ class AFPRenderer(VerboseOutput):
) -> Rectangle:
# Given a path to a SWF root animation, figure out what the dimensions
# of the SWF are.
for name, swf in self.swfs.items():
for _name, swf in self.swfs.items():
if swf.exported_name == path:
return swf.location
@ -531,7 +531,7 @@ class AFPRenderer(VerboseOutput):
def list_paths(self, verbose: bool = False) -> Generator[str, None, None]:
# Given the loaded animations, return a list of possible paths to render.
for name, swf in self.swfs.items():
for _name, swf in self.swfs.items():
yield swf.exported_name
def __execute_bytecode(self, bytecode: ByteCode, clip: PlacedClip, thisptr: Optional[Any] = MissingThis, prefix: str="") -> None:
@ -1222,7 +1222,7 @@ class AFPRenderer(VerboseOutput):
# Go through, recursively resolve imports for all SWF files.
for tag_id, imp in swf.imported_tags.items():
for name, other in self.swfs.items():
for _name, other in self.swfs.items():
if other.exported_name == imp.swf:
# This SWF should have the tag reference.
if imp.tag not in other.exported_tags:
@ -1271,7 +1271,7 @@ class AFPRenderer(VerboseOutput):
for frame in clip.frames:
tags = clip.tags[frame.start_tag_offset:(frame.start_tag_offset + frame.num_tags)]
for tagno, tag in enumerate(tags):
for tag in tags:
# Attempt to place any tags.
if isinstance(tag, AP2ShapeTag):
if tag.id == tag_id:

View File

@ -1846,7 +1846,7 @@ class SWF(TrackedCoverage, VerboseOutput):
self.vprint(f"{prefix} Unk5: {unk5}, Unk6: {unk6}, F1: {f1}, F2: {f2}, F3: {f3}, F4: {f4}, ABC: {a} {b} {c}, Count: {some_count}")
for j in range(some_count):
for _ in range(some_count):
shorts = struct.unpack("<HHHHHHHH", ap2data[chunk_offset:(chunk_offset + 16)])
self.add_coverage(chunk_offset, 16)
chunk_offset += 16
@ -2136,7 +2136,7 @@ class SWF(TrackedCoverage, VerboseOutput):
# Finally, parse frame labels
self.vprint(f"{prefix}Number of Frame Labels: {name_reference_count}, Flags: {hex(name_reference_flags)}")
labels: Dict[str, int] = {}
for i in range(name_reference_count):
for _ in range(name_reference_count):
frameno, stringoffset = struct.unpack("<HH", ap2data[name_reference_offset:(name_reference_offset + 4)])
strval = self.__get_string(stringoffset)
self.add_coverage(name_reference_offset, 4)
@ -2348,7 +2348,7 @@ class SWF(TrackedCoverage, VerboseOutput):
self.vprint(f"Number of Imported Tags: {imported_tags_count}")
self.imported_tags = {}
for i in range(imported_tags_count):
for _ in range(imported_tags_count):
# First grab the SWF this is importing from, and the number of assets being imported.
swf_name_offset, count = struct.unpack("<HH", data[imported_tags_offset:(imported_tags_offset + 4)])
self.add_coverage(imported_tags_offset, 4)
@ -2357,7 +2357,7 @@ class SWF(TrackedCoverage, VerboseOutput):
self.vprint(f" Source SWF: {swf_name}")
# Now, grab the actual asset names being imported.
for j in range(count):
for _ in range(count):
asset_id_no, asset_name_offset = struct.unpack("<HH", data[imported_tags_data_offset:(imported_tags_data_offset + 4)])
self.add_coverage(imported_tags_data_offset, 4)

View File

@ -55,7 +55,7 @@ class PackedOrdering:
self.order: List[Optional[int]] = []
self.expand = allow_expansion
for i in range(size):
for _ in range(size):
self.order.append(None)
self.__orderlen = size
self.__lastbyte = 0
@ -282,7 +282,7 @@ class BinaryDecoder:
return val
data = ''
for i in range(binary_length):
for _ in range(binary_length):
next_byte = self.stream.read_int()
if next_byte is None:
raise BinaryEncodingException("Ran out of data when attempting to read node name!")

View File

@ -1,3 +1,3 @@
#! /bin/bash
flake8 bemani/ --ignore E501,E252,W504 | grep -v "migrations\/"
flake8 bemani/ --ignore E501,E252,W504,B006,B008,B009 | grep -v "migrations\/"