From de3f9107cd37ce823ee33539d5bcc8aae645666e Mon Sep 17 00:00:00 2001 From: Jennifer Taylor Date: Tue, 6 Jul 2021 22:29:41 +0000 Subject: [PATCH] Address newest crop of lint issue with new flake8 tool. --- bemani/backend/jubeat/prop.py | 2 +- bemani/backend/popn/eclale.py | 6 +++--- bemani/backend/popn/usaneko.py | 6 +++--- bemani/backend/reflec/limelight.py | 4 ++-- bemani/backend/reflec/reflecbeat.py | 2 +- bemani/backend/sdvx/heavenlyhaven.py | 2 +- bemani/client/popn/eclale.py | 10 +++++----- bemani/client/popn/usaneko.py | 8 ++++---- bemani/format/afp/blend/blend.py | 2 +- bemani/format/afp/container.py | 2 +- bemani/format/afp/render.py | 16 ++++++++-------- bemani/format/afp/swf.py | 8 ++++---- bemani/protocol/binary.py | 4 ++-- verifylint | 2 +- 14 files changed, 37 insertions(+), 37 deletions(-) diff --git a/bemani/backend/jubeat/prop.py b/bemani/backend/jubeat/prop.py index 42483ca..571e0a5 100644 --- a/bemani/backend/jubeat/prop.py +++ b/bemani/backend/jubeat/prop.py @@ -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, diff --git a/bemani/backend/popn/eclale.py b/bemani/backend/popn/eclale.py index e965b3c..7f232c2 100644 --- a/bemani/backend/popn/eclale.py +++ b/bemani/backend/popn/eclale.py @@ -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)) diff --git a/bemani/backend/popn/usaneko.py b/bemani/backend/popn/usaneko.py index 09cffe9..2f828ba 100644 --- a/bemani/backend/popn/usaneko.py +++ b/bemani/backend/popn/usaneko.py @@ -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)) diff --git a/bemani/backend/reflec/limelight.py b/bemani/backend/reflec/limelight.py index 5460018..eb63cbb 100644 --- a/bemani/backend/reflec/limelight.py +++ b/bemani/backend/reflec/limelight.py @@ -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)) diff --git a/bemani/backend/reflec/reflecbeat.py b/bemani/backend/reflec/reflecbeat.py index ecd40cc..0462765 100644 --- a/bemani/backend/reflec/reflecbeat.py +++ b/bemani/backend/reflec/reflecbeat.py @@ -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)) diff --git a/bemani/backend/sdvx/heavenlyhaven.py b/bemani/backend/sdvx/heavenlyhaven.py index 057f3ba..2028003 100644 --- a/bemani/backend/sdvx/heavenlyhaven.py +++ b/bemani/backend/sdvx/heavenlyhaven.py @@ -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)) diff --git a/bemani/client/popn/eclale.py b/bemani/client/popn/eclale.py index 6ea70e9..3d8c012 100644 --- a/bemani/client/popn/eclale.py +++ b/bemani/client/popn/eclale.py @@ -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]: diff --git a/bemani/client/popn/usaneko.py b/bemani/client/popn/usaneko.py index a774afa..f9b0f97 100644 --- a/bemani/client/popn/usaneko.py +++ b/bemani/client/popn/usaneko.py @@ -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]: diff --git a/bemani/format/afp/blend/blend.py b/bemani/format/afp/blend/blend.py index 6294d90..9a8b142 100644 --- a/bemani/format/afp/blend/blend.py +++ b/bemani/format/afp/blend/blend.py @@ -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() diff --git a/bemani/format/afp/container.py b/bemani/format/afp/container.py index dccb930..ad76fc6 100644 --- a/bemani/format/afp/container.py +++ b/bemani/format/afp/container.py @@ -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!") diff --git a/bemani/format/afp/render.py b/bemani/format/afp/render.py index 0978b2e..4f6de23 100644 --- a/bemani/format/afp/render.py +++ b/bemani/format/afp/render.py @@ -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: diff --git a/bemani/format/afp/swf.py b/bemani/format/afp/swf.py index 58d0d00..f53dba1 100644 --- a/bemani/format/afp/swf.py +++ b/bemani/format/afp/swf.py @@ -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("