diff --git a/pyproject.toml b/pyproject.toml index 60afaba..cb42d71 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ [project] name = "mapfile_parser" -version = "1.3.0" +version = "1.3.1.dev0" description = "Map file parser library focusing decompilation projects" readme = "README.md" requires-python = ">=3.7" diff --git a/src/mapfile_parser/__init__.py b/src/mapfile_parser/__init__.py index e49894f..4b601f3 100644 --- a/src/mapfile_parser/__init__.py +++ b/src/mapfile_parser/__init__.py @@ -5,8 +5,8 @@ from __future__ import annotations -__version_info__ = (1, 3, 0) -__version__ = ".".join(map(str, __version_info__)) +__version_info__ = (1, 3, 1) +__version__ = ".".join(map(str, __version_info__)) + ".dev0" __author__ = "Decompollaborate" from . import utils as utils diff --git a/src/mapfile_parser/mapfile.py b/src/mapfile_parser/mapfile.py index 8e4628e..57f5b5c 100644 --- a/src/mapfile_parser/mapfile.py +++ b/src/mapfile_parser/mapfile.py @@ -71,6 +71,16 @@ def toJson(self) -> dict: return result + def __eq__(self, other: object) -> bool: + if not isinstance(other, Symbol): + return False + return self.name == other.name and self.vram == other.vram + + # https://stackoverflow.com/a/56915493/6292472 + def __hash__(self): + return hash((self.name, self.vram)) + + @dataclasses.dataclass class File: filepath: Path @@ -192,6 +202,16 @@ def __iter__(self) -> Generator[Symbol, None, None]: def __getitem__(self, index) -> Symbol: return self.symbols[index] + def __eq__(self, other: object) -> bool: + if not isinstance(other, File): + return False + return self.filepath == other.filepath + + # https://stackoverflow.com/a/56915493/6292472 + def __hash__(self): + return hash((self.filepath,)) + + @dataclasses.dataclass class FoundSymbolInfo: file: File