run linter + formatter

This commit is contained in:
jonschz 2024-08-24 09:55:16 +02:00
parent 36d6167057
commit f906c2c355
4 changed files with 15 additions and 6 deletions

View File

@ -228,7 +228,6 @@ def log_and_track_failure(
def main():
if GLOBALS.running_from_ghidra:
origfile_name = getProgramFile().getName()
@ -237,7 +236,9 @@ def main():
elif origfile_name in ["LEGO1D.DLL", "BETA10.DLL"]:
module = SupportedModules.BETA10
else:
raise Lego1Exception(f"Unsupported file name in import script: {origfile_name}")
raise Lego1Exception(
f"Unsupported file name in import script: {origfile_name}"
)
else:
module = SupportedModules.LEGO1
@ -262,7 +263,9 @@ def main():
with Bin(str(origfile_path), find_str=True) as origfile, Bin(
str(recompiledfile_path)
) as recompfile:
isle_compare = IsleCompare(origfile, recompfile, str(pdbfile_path), str(repo_root))
isle_compare = IsleCompare(
origfile, recompfile, str(pdbfile_path), str(repo_root)
)
logger.info("Comparison complete.")

View File

@ -39,6 +39,7 @@
class PdbFunctionImporter(ABC):
"""A representation of a function from the PDB with each type replaced by a Ghidra type instance."""
def __init__(
self,
api: FlatProgramAPI,
@ -71,10 +72,12 @@ def build(api: FlatProgramAPI, func: PdbFunction, type_importer: "PdbTypeImporte
)
@abstractmethod
def matches_ghidra_function(self, ghidra_function: Function) -> bool: ...
def matches_ghidra_function(self, ghidra_function: Function) -> bool:
...
@abstractmethod
def overwrite_ghidra_function(self, ghidra_function: Function): ...
def overwrite_ghidra_function(self, ghidra_function: Function):
...
class ThunkPdbFunctionImport(PdbFunctionImporter):
@ -101,6 +104,7 @@ def overwrite_ghidra_function(self, ghidra_function: Function):
# pylint: disable=too-many-instance-attributes
class FullPdbFunctionImporter(PdbFunctionImporter):
"""For importing functions into Ghidra where all information are available."""
def __init__(
self,
api: FlatProgramAPI,

View File

@ -80,9 +80,11 @@ def create_ghidra_namespace(
namespace = api.createNamespace(namespace, part)
return namespace
# These appear in debug builds
THUNK_OF_RE = re.compile(r"^Thunk of '(.*)'$")
def sanitize_name(name: str) -> str:
"""
Takes a full class or function name and replaces characters not accepted by Ghidra.

View File

@ -17,4 +17,4 @@ def getFunctionAt(
def createFunction(
entryPoint: ghidra.program.model.address.Address, name: str
) -> ghidra.program.model.listing.Function: ...
def getProgramFile() -> Any: ... # actually java.io.File
def getProgramFile() -> Any: ... # actually java.io.File