From 6eb3bf401cf768a81788e2aa90cb2cafbcd8d763 Mon Sep 17 00:00:00 2001 From: adaliaramon <70635214+adaliaramon@users.noreply.github.com> Date: Thu, 11 Jan 2024 17:04:53 +0100 Subject: [PATCH] Removed unused imports and other minor improvements (#1602) * Removed unused imports and other minor improvements * revert tools/ZAPD/ZAPD/genbuildinfo.py * revert diff.py * Update sym_info.py * revert asm_processor/ --------- Co-authored-by: fig02 Co-authored-by: Dragorn421 --- first_diff.py | 2 +- format.py | 2 +- progress.py | 1 - sym_info.py | 2 +- tools/convert_chars.py | 1 - tools/decompile_data.py | 1 - tools/ichaindis.py | 2 +- tools/overlayhelpers/colliderinit.py | 4 ++-- tools/overlayhelpers/damage_table.py | 2 +- tools/overlayhelpers/filemap.py | 7 +++---- tools/overlayhelpers/lmapmark.py | 3 +-- tools/overlayhelpers/mapmark.py | 2 +- tools/sfxconvert.py | 2 +- tools/vt_fmt.py | 3 --- 14 files changed, 13 insertions(+), 21 deletions(-) diff --git a/first_diff.py b/first_diff.py index 6d599d7a98..360eb42dc1 100755 --- a/first_diff.py +++ b/first_diff.py @@ -47,7 +47,7 @@ def firstDiffMain(): buildFolder = Path("build") / args.version BUILTROM = Path(f"oot-{args.version}.z64") - BUILTMAP = buildFolder / f"z64.map" + BUILTMAP = buildFolder / "z64.map" EXPECTEDROM = Path("baserom.z64") EXPECTEDMAP = "expected" / BUILTMAP diff --git a/format.py b/format.py index aabe89e48f..520a2d8078 100755 --- a/format.py +++ b/format.py @@ -108,7 +108,7 @@ def format_files(src_files: List[str], extra_files: List[str], nb_jobs: int): if nb_jobs != 1: print(f"Formatting files with {nb_jobs} jobs") else: - print(f"Formatting files with a single job (consider using -j to make this faster)") + print("Formatting files with a single job (consider using -j to make this faster)") # Format files in chunks to improve performance while still utilizing jobs file_chunks = list(list_chunks(src_files, (len(src_files) // nb_jobs) + 1)) diff --git a/progress.py b/progress.py index dfc756062f..6b05f7a648 100755 --- a/progress.py +++ b/progress.py @@ -2,7 +2,6 @@ import argparse import json -import csv import git import os import re diff --git a/sym_info.py b/sym_info.py index afc3ba4e36..9a279593db 100755 --- a/sym_info.py +++ b/sym_info.py @@ -17,7 +17,7 @@ def symInfoMain(): args = parser.parse_args() - BUILTMAP = Path(f"build") / "gc-eu-mq-dbg" / f"z64.map" + BUILTMAP = Path("build") / "gc-eu-mq-dbg" / "z64.map" mapPath = BUILTMAP if args.use_expected: diff --git a/tools/convert_chars.py b/tools/convert_chars.py index 3778165e50..261ed92399 100644 --- a/tools/convert_chars.py +++ b/tools/convert_chars.py @@ -2,7 +2,6 @@ import os import re -import sys script_dir = os.path.dirname(os.path.realpath(__file__)) root_dir = script_dir + "/../" diff --git a/tools/decompile_data.py b/tools/decompile_data.py index 01b2e05197..9805cb888a 100755 --- a/tools/decompile_data.py +++ b/tools/decompile_data.py @@ -2,7 +2,6 @@ import os import re -import sys import struct script_dir = os.path.dirname(os.path.realpath(__file__)) diff --git a/tools/ichaindis.py b/tools/ichaindis.py index e20fd6e5af..f19a15ddf3 100755 --- a/tools/ichaindis.py +++ b/tools/ichaindis.py @@ -5,7 +5,7 @@ import sys import struct import argparse import re -from overlayhelpers.filemap import FileResult, GetFromVRam, GetFromRom +from overlayhelpers.filemap import GetFromVRam ICHAIN_MACROS = [ 'ICHAIN_U8', diff --git a/tools/overlayhelpers/colliderinit.py b/tools/overlayhelpers/colliderinit.py index da99e4e986..61fb42e7cd 100755 --- a/tools/overlayhelpers/colliderinit.py +++ b/tools/overlayhelpers/colliderinit.py @@ -3,7 +3,7 @@ import os import struct import argparse -from filemap import FileResult, GetFromVRam, GetFromRom +from filemap import GetFromVRam, GetFromRom T_DEFAULT = '' TType1 = 'Type1' @@ -244,7 +244,7 @@ def GetColliderStr(data, off, type): else: cBase[i] = '0x{0:02X}'.format(cBase[i]) - return cf[1].format(*cBase); + return cf[1].format(*cBase) def GetItems(data, off, count, structf, fmt, size): result = '' diff --git a/tools/overlayhelpers/damage_table.py b/tools/overlayhelpers/damage_table.py index 3dedb31545..47ee6d8fa6 100755 --- a/tools/overlayhelpers/damage_table.py +++ b/tools/overlayhelpers/damage_table.py @@ -2,7 +2,7 @@ import os import argparse -from filemap import FileResult, GetFromVRam, GetFromRom +from filemap import GetFromVRam, GetFromRom damage_types = [ 'Deku nut', diff --git a/tools/overlayhelpers/filemap.py b/tools/overlayhelpers/filemap.py index 58dd7e0e40..3bf4eb9b96 100644 --- a/tools/overlayhelpers/filemap.py +++ b/tools/overlayhelpers/filemap.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 import os -import struct import json table = None @@ -82,9 +81,9 @@ def CreateTable(): json.dump(dict, table) def AddressLookup(lookupTable, addr): - start = 0; - end = 0; - key = None; + start = 0 + end = 0 + key = None for k, v in lookupTable.items(): if addr >= k: diff --git a/tools/overlayhelpers/lmapmark.py b/tools/overlayhelpers/lmapmark.py index 5075bcae83..cd13ea98cc 100644 --- a/tools/overlayhelpers/lmapmark.py +++ b/tools/overlayhelpers/lmapmark.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 import os import struct -import sys SIMPLIFY_OUTPUT = True OVL_KALEIDO_SCOPE_RAM = 0x80813820 @@ -88,7 +87,7 @@ for name, numMaps in SCENES: cstr = "" -cstr += f"PauseMapMarksData gPauseMapMarkDataTable[] = {{\n" +cstr += "PauseMapMarksData gPauseMapMarkDataTable[] = {\n" for scenemap in scenemaps: for mapId, map in enumerate(scenemap[1]): cstr += IND(1) + f"// {scenemap[0]} map {mapId}\n" diff --git a/tools/overlayhelpers/mapmark.py b/tools/overlayhelpers/mapmark.py index 8f0186bf9f..44b2ec92a8 100644 --- a/tools/overlayhelpers/mapmark.py +++ b/tools/overlayhelpers/mapmark.py @@ -43,7 +43,7 @@ def GetMapsPerScene(ptrs): def GetPoints(data, ptr, numPoints): points = [] - off = RamToOff(ptr); + off = RamToOff(ptr) for i in range(numPoints): points.append(struct.unpack_from(">bBB", data[off:off+3])) off = off + 3 diff --git a/tools/sfxconvert.py b/tools/sfxconvert.py index 22044dd594..a125467aef 100644 --- a/tools/sfxconvert.py +++ b/tools/sfxconvert.py @@ -37,7 +37,7 @@ def get_func_data(funcdata,i): funcname = argdata[0].split(' ')[1] for x in range(len(argdata)): if(argdata[x].count('sfxId')): - break; + break if(x == len(argdata) - 1): print('sfxId not found in ', funcname) return None,-1 diff --git a/tools/vt_fmt.py b/tools/vt_fmt.py index e0929ff8be..139ddb7d7a 100755 --- a/tools/vt_fmt.py +++ b/tools/vt_fmt.py @@ -1,8 +1,5 @@ #!/usr/bin/python3 -import os -import sys -import struct import argparse import re