1
0
mirror of synced 2025-01-18 22:24:04 +01: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 = [] scores = []
absentees = [] absentees = []
for [userid, player] in profiles: for [userid, _player] in profiles:
# Look up scores for last week if they played # Look up scores for last week if they played
league_score = data.local.user.get_achievement( league_score = data.local.user.get_achievement(
cls.game, cls.game,

View File

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

View File

@ -282,7 +282,7 @@ class PopnMusicUsaNeko(PopnMusicBase):
# Calculate most popular characters # Calculate most popular characters
profiles = self.data.remote.user.get_all_profiles(self.game, self.version) profiles = self.data.remote.user.get_all_profiles(self.game, self.version)
charas: Dict[int, int] = {} charas: Dict[int, int] = {}
for (userid, profile) in profiles: for (_userid, profile) in profiles:
chara = profile.get_int('chara', -1) chara = profile.get_int('chara', -1)
if chara <= 0: if chara <= 0:
continue continue
@ -299,14 +299,14 @@ class PopnMusicUsaNeko(PopnMusicBase):
) )
# Top 20 Popular characters # Top 20 Popular characters
for rank, (charaid, usecount) in enumerate(charamap[:20]): for rank, (charaid, _usecount) in enumerate(charamap[:20]):
popular = Node.void('popular') popular = Node.void('popular')
root.add_child(popular) root.add_child(popular)
popular.add_child(Node.s16('rank', rank + 1)) popular.add_child(Node.s16('rank', rank + 1))
popular.add_child(Node.s16('chara_num', charaid)) popular.add_child(Node.s16('chara_num', charaid))
# Top 500 Popular music # 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') popular_music = Node.void('popular_music')
root.add_child(popular_music) root.add_child(popular_music)
popular_music.add_child(Node.s16('music_num', songid)) 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: def __add_event_info(self, request: Node) -> None:
events: Dict[int, int] = {} events: Dict[int, int] = {}
for (eventid, phase) in events.items(): for (_eventid, _phase) in events.items():
data = Node.void('data') data = Node.void('data')
request.add_child(data) request.add_child(data)
data.add_child(Node.s32('type', -1)) 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) hitchart = self.data.local.music.get_hit_chart(self.game, self.version, 10)
rank = 1 rank = 1
for (mid, plays) in hitchart: for (mid, _plays) in hitchart:
record = Node.void('record') record = Node.void('record')
originals.add_child(record) originals.add_child(record)
record.add_child(Node.s16('id', mid)) record.add_child(Node.s16('id', mid))

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -468,7 +468,7 @@ class AFPRenderer(VerboseOutput):
verbose: bool = False, verbose: bool = False,
) -> Generator[Image.Image, None, None]: ) -> Generator[Image.Image, None, None]:
# Given a path to a SWF root animation, attempt to render it to a list of frames. # 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: if swf.exported_name == path:
# This is the SWF we care about. # This is the SWF we care about.
with self.debugging(verbose): with self.debugging(verbose):
@ -483,7 +483,7 @@ class AFPRenderer(VerboseOutput):
path: str, path: str,
) -> Rectangle: ) -> Rectangle:
# Given a path to a SWF root animation, find its bounding 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: if swf.exported_name == path:
# This is the SWF we care about. # This is the SWF we care about.
return swf.location return swf.location
@ -496,7 +496,7 @@ class AFPRenderer(VerboseOutput):
) -> int: ) -> int:
# Given a path to a SWF root animation, figure out how many frames are # 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. # 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: if swf.exported_name == path:
# This is the SWF we care about. # This is the SWF we care about.
return len(swf.frames) return len(swf.frames)
@ -509,7 +509,7 @@ class AFPRenderer(VerboseOutput):
) -> int: ) -> int:
# Given a path to a SWF root animation, figure out how many milliseconds are # Given a path to a SWF root animation, figure out how many milliseconds are
# occupied by each frame. # occupied by each frame.
for name, swf in self.swfs.items(): for _name, swf in self.swfs.items():
if swf.exported_name == path: if swf.exported_name == path:
# This is the SWF we care about. # This is the SWF we care about.
spf = 1.0 / swf.fps spf = 1.0 / swf.fps
@ -523,7 +523,7 @@ class AFPRenderer(VerboseOutput):
) -> Rectangle: ) -> Rectangle:
# Given a path to a SWF root animation, figure out what the dimensions # Given a path to a SWF root animation, figure out what the dimensions
# of the SWF are. # of the SWF are.
for name, swf in self.swfs.items(): for _name, swf in self.swfs.items():
if swf.exported_name == path: if swf.exported_name == path:
return swf.location return swf.location
@ -531,7 +531,7 @@ class AFPRenderer(VerboseOutput):
def list_paths(self, verbose: bool = False) -> Generator[str, None, None]: def list_paths(self, verbose: bool = False) -> Generator[str, None, None]:
# Given the loaded animations, return a list of possible paths to render. # 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 yield swf.exported_name
def __execute_bytecode(self, bytecode: ByteCode, clip: PlacedClip, thisptr: Optional[Any] = MissingThis, prefix: str="") -> None: 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. # Go through, recursively resolve imports for all SWF files.
for tag_id, imp in swf.imported_tags.items(): 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: if other.exported_name == imp.swf:
# This SWF should have the tag reference. # This SWF should have the tag reference.
if imp.tag not in other.exported_tags: if imp.tag not in other.exported_tags:
@ -1271,7 +1271,7 @@ class AFPRenderer(VerboseOutput):
for frame in clip.frames: for frame in clip.frames:
tags = clip.tags[frame.start_tag_offset:(frame.start_tag_offset + frame.num_tags)] 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. # Attempt to place any tags.
if isinstance(tag, AP2ShapeTag): if isinstance(tag, AP2ShapeTag):
if tag.id == tag_id: 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}") 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)]) shorts = struct.unpack("<HHHHHHHH", ap2data[chunk_offset:(chunk_offset + 16)])
self.add_coverage(chunk_offset, 16) self.add_coverage(chunk_offset, 16)
chunk_offset += 16 chunk_offset += 16
@ -2136,7 +2136,7 @@ class SWF(TrackedCoverage, VerboseOutput):
# Finally, parse frame labels # Finally, parse frame labels
self.vprint(f"{prefix}Number of Frame Labels: {name_reference_count}, Flags: {hex(name_reference_flags)}") self.vprint(f"{prefix}Number of Frame Labels: {name_reference_count}, Flags: {hex(name_reference_flags)}")
labels: Dict[str, int] = {} 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)]) frameno, stringoffset = struct.unpack("<HH", ap2data[name_reference_offset:(name_reference_offset + 4)])
strval = self.__get_string(stringoffset) strval = self.__get_string(stringoffset)
self.add_coverage(name_reference_offset, 4) 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.vprint(f"Number of Imported Tags: {imported_tags_count}")
self.imported_tags = {} 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. # 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)]) swf_name_offset, count = struct.unpack("<HH", data[imported_tags_offset:(imported_tags_offset + 4)])
self.add_coverage(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}") self.vprint(f" Source SWF: {swf_name}")
# Now, grab the actual asset names being imported. # 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)]) 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) self.add_coverage(imported_tags_data_offset, 4)

View File

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

View File

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