From 4c4ac4df6b33ccd2f748554c77946e04827c3928 Mon Sep 17 00:00:00 2001 From: jonschz Date: Sun, 27 Oct 2024 07:46:36 +0100 Subject: [PATCH] Fix linting and formatting errors --- .pylintrc | 2 +- reccmp/ghidra_scripts/lego_util/function_importer.py | 6 ++++-- reccmp/ghidra_scripts/lego_util/ghidra_helper.py | 2 +- reccmp/ghidra_scripts/lego_util/type_importer.py | 2 +- reccmp/isledecomp/compare/core.py | 6 +++++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.pylintrc b/.pylintrc index 976b3764..6db73f71 100644 --- a/.pylintrc +++ b/.pylintrc @@ -67,7 +67,7 @@ ignored-modules=ghidra # Python code to execute, usually for sys.path manipulation such as # pygtk.require(). -init-hook='import sys; sys.path.append("tools/isledecomp"); sys.path.append("tools/ghidra_scripts")' +init-hook='import sys; sys.path.append("reccmp/ghidra_scripts")' # Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the # number of processors available to use, and will cap the count on Windows to diff --git a/reccmp/ghidra_scripts/lego_util/function_importer.py b/reccmp/ghidra_scripts/lego_util/function_importer.py index 808314d2..45e93c8d 100644 --- a/reccmp/ghidra_scripts/lego_util/function_importer.py +++ b/reccmp/ghidra_scripts/lego_util/function_importer.py @@ -72,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): diff --git a/reccmp/ghidra_scripts/lego_util/ghidra_helper.py b/reccmp/ghidra_scripts/lego_util/ghidra_helper.py index 601ce4f8..e48cc416 100644 --- a/reccmp/ghidra_scripts/lego_util/ghidra_helper.py +++ b/reccmp/ghidra_scripts/lego_util/ghidra_helper.py @@ -8,7 +8,7 @@ TypeNotFoundInGhidraError, MultipleTypesFoundInGhidraError, ) -from lego_util.globals import GLOBALS, SupportedModules +from lego_util.globals import GLOBALS # Disable spurious warnings in vscode / pylance # pyright: reportMissingModuleSource=false diff --git a/reccmp/ghidra_scripts/lego_util/type_importer.py b/reccmp/ghidra_scripts/lego_util/type_importer.py index daec0fde..220d5ee7 100644 --- a/reccmp/ghidra_scripts/lego_util/type_importer.py +++ b/reccmp/ghidra_scripts/lego_util/type_importer.py @@ -7,7 +7,6 @@ # pylint: disable=too-many-return-statements # a `match` would be better, but for now we are stuck with Python 3.9 # pylint: disable=no-else-return # Not sure why this rule even is a thing, this is great for checking exhaustiveness -from reccmp.isledecomp.cvdump.types import VirtualBasePointer from lego_util.exceptions import ( ClassOrNamespaceNotFoundInGhidraError, TypeNotFoundError, @@ -40,6 +39,7 @@ ) from ghidra.util.task import ConsoleTaskMonitor +from reccmp.isledecomp.cvdump.types import VirtualBasePointer logger = logging.getLogger(__name__) diff --git a/reccmp/isledecomp/compare/core.py b/reccmp/isledecomp/compare/core.py index 5cd8009c..37b60059 100644 --- a/reccmp/isledecomp/compare/core.py +++ b/reccmp/isledecomp/compare/core.py @@ -68,7 +68,11 @@ def lookup(addr: int, size: int) -> Optional[bytes]: class Compare: # pylint: disable=too-many-instance-attributes def __init__( - self, orig_bin: IsleBin, recomp_bin: IsleBin, pdb_file: Path | str, code_dir: Path | str + self, + orig_bin: IsleBin, + recomp_bin: IsleBin, + pdb_file: Path | str, + code_dir: Path | str, ): self.orig_bin = orig_bin self.recomp_bin = recomp_bin