mapfile_parser 2.13.0__tar.gz → 2.13.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/CHANGELOG.md +17 -3
  2. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/Cargo.lock +1 -1
  3. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/Cargo.toml +1 -1
  4. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/PKG-INFO +2 -2
  5. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/README.md +1 -1
  6. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/pyproject.toml +23 -1
  7. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/__init__.py +6 -9
  8. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/__main__.py +1 -0
  9. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/frontends/__init__.py +0 -1
  10. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/frontends/bss_check.py +3 -3
  11. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/frontends/first_diff.py +3 -3
  12. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/frontends/jsonify.py +3 -2
  13. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/frontends/objdiff_report.py +5 -5
  14. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/frontends/pj64_syms.py +3 -2
  15. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/frontends/progress.py +4 -4
  16. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/frontends/sym_info.py +3 -3
  17. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/frontends/symbol_sizes_csv.py +2 -1
  18. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/frontends/upload_frogress.py +3 -3
  19. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/internals/objdiff_report.py +2 -3
  20. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/mapfile.py +28 -16
  21. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/mapfile_parser.pyi +4 -6
  22. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/mapfile_rs.py +5 -6
  23. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/utils.py +2 -2
  24. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/mapfile.rs +0 -2
  25. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/report.rs +7 -0
  26. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/section.rs +1 -1
  27. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/symbol_decomp_state.rs +16 -0
  28. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/uv.lock +1 -1
  29. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/.gitattributes +0 -0
  30. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/.gitignore +0 -0
  31. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/LICENSE +0 -0
  32. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/internals/__init__.py +0 -0
  33. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/progress_stats.py +0 -0
  34. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/mapfile_parser/progress_stats_rs.py +0 -0
  35. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/found_symbol_info.rs +0 -0
  36. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/iterators/iter_mapfile_syms_by_name.rs +0 -0
  37. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/iterators/iter_mapfile_syms_by_vram.rs +0 -0
  38. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/iterators/iter_mapfile_syms_by_vrom.rs +0 -0
  39. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/iterators/iter_segment_syms_by_name.rs +0 -0
  40. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/iterators/mod.rs +0 -0
  41. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/lib.rs +0 -0
  42. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/maps_comparison_info.rs +0 -0
  43. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/maybe_found_symbol_info.rs +0 -0
  44. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/parser.rs +0 -0
  45. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/progress_stats.rs +0 -0
  46. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/segment.rs +0 -0
  47. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/symbol.rs +0 -0
  48. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/symbol_comparison_info.rs +0 -0
  49. {mapfile_parser-2.13.0 → mapfile_parser-2.13.2}/src/rs/utils.rs +0 -0
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.13.2] - 2026-08-21
11
+
12
+ ### Fixed
13
+
14
+ - Avoid emitting zero-sized symbols in objdiff reports.
15
+
16
+ ## [2.13.1] - 2026-08-18
17
+
18
+ ### Fixed
19
+
20
+ - Fix `first_diff` and some lookup functions grabbing the first existing
21
+ `.NON_MATCHING` marker instead of the actual symbol.
22
+
10
23
  ## [2.13.0] - 2026-06-28
11
24
 
12
25
  ### Added
@@ -730,9 +743,10 @@ Full changes: <https://github.com/Decompollaborate/mapfile_parser/compare/702a73
730
743
 
731
744
  [unreleased]: https://github.com/Decompollaborate/mapfile_parser/compare/2.13.0...HEAD
732
745
 
733
- [2.13.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.21.2...2.13.0
734
- [2.12.2]: https://github.com/Decompollaborate/mapfile_parser/compare/2.21.1...2.12.2
735
- [2.12.1]: https://github.com/Decompollaborate/mapfile_parser/compare/2.21.0...2.12.1
746
+ [2.13.1]: https://github.com/Decompollaborate/mapfile_parser/compare/2.13.0...2.13.1
747
+ [2.13.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.12.2...2.13.0
748
+ [2.12.2]: https://github.com/Decompollaborate/mapfile_parser/compare/2.12.1...2.12.2
749
+ [2.12.1]: https://github.com/Decompollaborate/mapfile_parser/compare/2.12.0...2.12.1
736
750
  [2.12.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.11.0...2.12.0
737
751
  [2.11.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.10.0...2.11.0
738
752
  [2.10.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.9.4...2.10.0
@@ -171,7 +171,7 @@ checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
171
171
 
172
172
  [[package]]
173
173
  name = "mapfile_parser"
174
- version = "2.13.0"
174
+ version = "2.13.2"
175
175
  dependencies = [
176
176
  "lazy_static",
177
177
  "objdiff-core",
@@ -3,7 +3,7 @@
3
3
 
4
4
  [package]
5
5
  name = "mapfile_parser"
6
- version = "2.13.0"
6
+ version = "2.13.2"
7
7
  edition = "2021"
8
8
  rust-version = "1.74.0"
9
9
  authors = ["Anghelo Carvajal <angheloalf95@gmail.com>"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapfile_parser
3
- Version: 2.13.0
3
+ Version: 2.13.2
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -51,7 +51,7 @@ If you use a `requirements.txt` file in your repository, then you can add
51
51
  this library with the following line:
52
52
 
53
53
  ```txt
54
- mapfile_parser>=2.12,<3.0.0
54
+ mapfile_parser>=2.13,<3.0.0
55
55
  ```
56
56
 
57
57
  #### Development version
@@ -36,7 +36,7 @@ If you use a `requirements.txt` file in your repository, then you can add
36
36
  this library with the following line:
37
37
 
38
38
  ```txt
39
- mapfile_parser>=2.12,<3.0.0
39
+ mapfile_parser>=2.13,<3.0.0
40
40
  ```
41
41
 
42
42
  #### Development version
@@ -3,7 +3,7 @@
3
3
 
4
4
  [project]
5
5
  name = "mapfile_parser"
6
- version = "2.13.0"
6
+ version = "2.13.2"
7
7
  description = "Map file parser library focusing decompilation projects"
8
8
  readme = "README.md"
9
9
  requires-python = ">=3.8"
@@ -33,3 +33,25 @@ mapfile_parser = "mapfile_parser.__main__:mapfileParserMain"
33
33
  features = ["pyo3/extension-module", "python_bindings"]
34
34
  # https://github.com/PyO3/maturin/blob/0dee40510083c03607834c821eea76964140a126/Readme.md#mixed-rustpython-projects
35
35
  python-source = "src"
36
+
37
+ [tool.ruff.lint]
38
+ # Keep alphabetically sorted
39
+ # TODO: fix
40
+ ignore = [
41
+ "B006",
42
+ "B008",
43
+ "BLE001",
44
+ "C408",
45
+ "EXE001",
46
+ "EXE005",
47
+ "FLY002",
48
+ "PERF402",
49
+ "PLC0414",
50
+ "PLR1722",
51
+ "PLW0127",
52
+ "PLW0128",
53
+ "PYI015",
54
+ "RUF012",
55
+ "SIM102",
56
+ "UP028",
57
+ ]
@@ -5,25 +5,22 @@
5
5
 
6
6
  from __future__ import annotations
7
7
 
8
- __version_info__ = (2, 13, 0)
8
+ __version_info__ = (2, 13, 2)
9
9
  __version__ = ".".join(map(str, __version_info__)) # + "-dev0"
10
10
  __author__ = "Decompollaborate"
11
11
 
12
+ from . import frontends as frontends
12
13
  from . import utils as utils
13
-
14
+ from .mapfile import FoundSymbolInfo as FoundSymbolInfo
14
15
  from .mapfile import MapFile as MapFile
15
- from .mapfile import Symbol as Symbol
16
+ from .mapfile import MapsComparisonInfo as MapsComparisonInfo
17
+ from .mapfile import ReportCategories as ReportCategories
16
18
  from .mapfile import Section as Section
17
19
  from .mapfile import Segment as Segment
18
- from .mapfile import FoundSymbolInfo as FoundSymbolInfo
20
+ from .mapfile import Symbol as Symbol
19
21
  from .mapfile import SymbolComparisonInfo as SymbolComparisonInfo
20
- from .mapfile import MapsComparisonInfo as MapsComparisonInfo
21
- from .mapfile import ReportCategories as ReportCategories
22
-
23
22
  from .progress_stats import ProgressStats as ProgressStats
24
23
 
25
- from . import frontends as frontends
26
-
27
24
  # Renamed types.
28
25
  # TODO: remove on version 3.0
29
26
  File = Section
@@ -6,6 +6,7 @@
6
6
  from __future__ import annotations
7
7
 
8
8
  import argparse
9
+
9
10
  import decomp_settings
10
11
 
11
12
  import mapfile_parser
@@ -5,7 +5,6 @@
5
5
 
6
6
  from __future__ import annotations
7
7
 
8
-
9
8
  from . import bss_check as bss_check
10
9
  from . import first_diff as first_diff
11
10
  from . import jsonify as jsonify
@@ -7,11 +7,11 @@ from __future__ import annotations
7
7
 
8
8
  import argparse
9
9
  from collections.abc import Callable
10
- import decomp_settings
11
10
  from pathlib import Path
12
11
 
13
- from .. import mapfile
14
- from .. import utils
12
+ import decomp_settings
13
+
14
+ from .. import mapfile, utils
15
15
 
16
16
 
17
17
  def getComparison(
@@ -7,12 +7,12 @@ from __future__ import annotations
7
7
 
8
8
  import argparse
9
9
  from collections.abc import Callable
10
- import decomp_settings
11
10
  from pathlib import Path
12
11
  from typing import Literal
13
12
 
14
- from .. import mapfile
15
- from .. import utils
13
+ import decomp_settings
14
+
15
+ from .. import mapfile, utils
16
16
 
17
17
 
18
18
  def doFirstDiff(
@@ -6,11 +6,12 @@
6
6
  from __future__ import annotations
7
7
 
8
8
  import argparse
9
- from collections.abc import Callable
10
- import decomp_settings
11
9
  import json
10
+ from collections.abc import Callable
12
11
  from pathlib import Path
13
12
 
13
+ import decomp_settings
14
+
14
15
  from .. import mapfile
15
16
 
16
17
 
@@ -6,14 +6,14 @@
6
6
  from __future__ import annotations
7
7
 
8
8
  import argparse
9
- from collections.abc import Callable
10
9
  import dataclasses
11
- import decomp_settings
12
- from pathlib import Path
13
10
  import os
11
+ from collections.abc import Callable
12
+ from pathlib import Path
13
+
14
+ import decomp_settings
14
15
 
15
- from .. import mapfile
16
- from .. import utils
16
+ from .. import mapfile, utils
17
17
  from ..internals import objdiff_report as report_internal
18
18
 
19
19
 
@@ -6,11 +6,12 @@
6
6
  from __future__ import annotations
7
7
 
8
8
  import argparse
9
+ import sys
9
10
  from collections.abc import Callable
10
- import decomp_settings
11
11
  from pathlib import Path
12
12
  from typing import TextIO
13
- import sys
13
+
14
+ import decomp_settings
14
15
 
15
16
  from .. import mapfile
16
17
 
@@ -6,13 +6,13 @@
6
6
  from __future__ import annotations
7
7
 
8
8
  import argparse
9
- from collections.abc import Callable
10
- import decomp_settings
11
9
  import json
10
+ from collections.abc import Callable
12
11
  from pathlib import Path
13
12
 
14
- from .. import mapfile
15
- from .. import progress_stats
13
+ import decomp_settings
14
+
15
+ from .. import mapfile, progress_stats
16
16
 
17
17
 
18
18
  def getProgress(
@@ -7,12 +7,12 @@ from __future__ import annotations
7
7
 
8
8
  import argparse
9
9
  from collections.abc import Callable
10
- import decomp_settings
11
10
  from pathlib import Path
12
11
  from typing import Generator
13
12
 
14
- from .. import mapfile
15
- from .. import utils
13
+ import decomp_settings
14
+
15
+ from .. import mapfile, utils
16
16
 
17
17
 
18
18
  def doSymInfo(
@@ -7,9 +7,10 @@ from __future__ import annotations
7
7
 
8
8
  import argparse
9
9
  from collections.abc import Callable
10
- import decomp_settings
11
10
  from pathlib import Path
12
11
 
12
+ import decomp_settings
13
+
13
14
  from .. import mapfile
14
15
 
15
16
 
@@ -7,12 +7,12 @@ from __future__ import annotations
7
7
 
8
8
  import argparse
9
9
  from collections.abc import Callable
10
- import decomp_settings
11
10
  from pathlib import Path
11
+
12
+ import decomp_settings
12
13
  import requests # type: ignore
13
14
 
14
- from .. import utils
15
- from .. import progress_stats
15
+ from .. import progress_stats, utils
16
16
  from . import progress
17
17
 
18
18
 
@@ -6,8 +6,8 @@
6
6
  from __future__ import annotations
7
7
 
8
8
  import dataclasses
9
- from pathlib import Path
10
9
  import json
10
+ from pathlib import Path
11
11
 
12
12
 
13
13
  @dataclasses.dataclass
@@ -42,8 +42,7 @@ class Report:
42
42
  # Calculate the size for the first column
43
43
  columnSize = 8
44
44
  for name, _ in new_cats:
45
- if len(name) > columnSize:
46
- columnSize = len(name)
45
+ columnSize = max(columnSize, len(name))
47
46
  columnSize += 1
48
47
 
49
48
  categoryStr = "{0:<{1}}".format("Category", columnSize)
@@ -5,20 +5,19 @@
5
5
 
6
6
  from __future__ import annotations
7
7
 
8
- from collections.abc import Callable
9
8
  import dataclasses
10
9
  import re
11
- from typing import Any, Generator
10
+ from collections.abc import Callable
12
11
  from pathlib import Path
12
+ from typing import Any, Generator
13
13
 
14
- from .progress_stats import ProgressStats
15
14
  from . import utils
16
-
17
15
  from .mapfile_rs import MapFile as MapFileRs
18
- from .mapfile_rs import Segment as SegmentRs
16
+ from .mapfile_rs import ReportCategories as ReportCategories
19
17
  from .mapfile_rs import Section as SectionRs
18
+ from .mapfile_rs import Segment as SegmentRs
20
19
  from .mapfile_rs import Symbol as SymbolRs
21
- from .mapfile_rs import ReportCategories as ReportCategories
20
+ from .progress_stats import ProgressStats
22
21
 
23
22
  regex_fileDataEntry = re.compile(
24
23
  r"^\s+(?P<section>\.[^\s]+)\s+(?P<vram>0x[^\s]+)\s+(?P<size>0x[^\s]+)\s+(?P<name>[^\s]+)$"
@@ -318,6 +317,9 @@ class Section:
318
317
  return None
319
318
 
320
319
  def findSymbolByVram(self, address: int) -> tuple[Symbol, int] | None:
320
+ if not self.containsVram(address):
321
+ return None
322
+
321
323
  nonMatchingSym: Symbol | None = None
322
324
 
323
325
  for sym in self._symbols:
@@ -341,7 +343,7 @@ class Section:
341
343
  nonMatchingSym = sym
342
344
  continue
343
345
 
344
- if sym.vram < address and address < sym.vram + sym.size:
346
+ if sym.vram < address < sym.vram + sym.size:
345
347
  if sym.isNonmatching:
346
348
  # Try to avoid non matching marker symbols
347
349
  nonMatchingSym = sym
@@ -353,6 +355,9 @@ class Section:
353
355
  return None
354
356
 
355
357
  def findSymbolByVrom(self, address: int) -> tuple[Symbol, int] | None:
358
+ if not self.containsVrom(address):
359
+ return None
360
+
356
361
  nonMatchingSym: Symbol | None = None
357
362
 
358
363
  for sym in self._symbols:
@@ -379,7 +384,7 @@ class Section:
379
384
  nonMatchingSym = sym
380
385
  continue
381
386
 
382
- if sym.vrom < address and address < sym.vrom + sym.size:
387
+ if sym.vrom < address < sym.vrom + sym.size:
383
388
  if sym.isNonmatching:
384
389
  # Try to avoid non matching marker symbols
385
390
  nonMatchingSym = sym
@@ -564,12 +569,13 @@ class Segment:
564
569
  ) -> tuple[FoundSymbolInfo | None, list[Section]]:
565
570
  possibleFiles: list[Section] = []
566
571
  for section in self._sectionsList:
572
+ if not section.containsVram(address):
573
+ continue
567
574
  pair = section.findSymbolByVram(address)
568
575
  if pair is not None:
569
576
  sym, offset = pair
570
577
  return FoundSymbolInfo(section, sym, offset), []
571
- if section.containsVram(address):
572
- possibleFiles.append(section)
578
+ possibleFiles.append(section)
573
579
  return None, possibleFiles
574
580
 
575
581
  def findSymbolByVrom(
@@ -580,12 +586,13 @@ class Segment:
580
586
  for section in self._sectionsList:
581
587
  if section.vrom is None:
582
588
  continue
589
+ if not section.containsVrom(address):
590
+ continue
583
591
  pair = section.findSymbolByVrom(address)
584
592
  if pair is not None:
585
593
  sym, offset = pair
586
594
  return FoundSymbolInfo(section, sym, offset), []
587
- if section.containsVrom(address):
588
- possibleFiles.append(section)
595
+ possibleFiles.append(section)
589
596
  return None, possibleFiles
590
597
 
591
598
  def findPossibleSymbolByVram(
@@ -981,7 +988,8 @@ class MapFile:
981
988
  return None
982
989
 
983
990
  def findSymbolByVram(
984
- self, address: int
991
+ self,
992
+ address: int,
985
993
  ) -> tuple[FoundSymbolInfo | None, list[Section]]:
986
994
  """
987
995
  Returns a symbol with the specified VRAM address (or with an addend) if
@@ -994,6 +1002,8 @@ class MapFile:
994
1002
 
995
1003
  possibleFiles: list[Section] = []
996
1004
  for segment in self._segmentsList:
1005
+ if not segment.containsVram(address):
1006
+ continue
997
1007
  info, possibleFilesAux = segment.findSymbolByVram(address)
998
1008
  if info is not None:
999
1009
  return info, []
@@ -1001,10 +1011,11 @@ class MapFile:
1001
1011
  return None, possibleFiles
1002
1012
 
1003
1013
  def findSymbolByVrom(
1004
- self, address: int
1014
+ self,
1015
+ address: int,
1005
1016
  ) -> tuple[FoundSymbolInfo | None, list[Section]]:
1006
1017
  """
1007
- Returns a symbol with the specified VRAM address (or with an addend) if
1018
+ Returns a symbol with the specified VROM address (or with an addend) if
1008
1019
  it exists on the mapfile.
1009
1020
 
1010
1021
  If no symbol if found, then a list of possible files where this symbol
@@ -1014,6 +1025,8 @@ class MapFile:
1014
1025
 
1015
1026
  possibleFiles: list[Section] = []
1016
1027
  for segment in self._segmentsList:
1028
+ if not segment.containsVrom(address):
1029
+ continue
1017
1030
  info, possibleFilesAux = segment.findSymbolByVrom(address)
1018
1031
  if info is not None:
1019
1032
  return info, []
@@ -1362,7 +1375,6 @@ class MapFile:
1362
1375
  else:
1363
1376
  # Keep the original section if there are no maps for this path
1364
1377
  newSeg._sectionsList.append(sect.clone())
1365
- pass
1366
1378
 
1367
1379
  resolvedMap._segmentsList.append(newSeg)
1368
1380
  return resolvedMap
@@ -3,10 +3,8 @@
3
3
  # SPDX-FileCopyrightText: © 2023-2025 Decompollaborate
4
4
  # SPDX-License-Identifier: MIT
5
5
 
6
- from __future__ import annotations
7
-
8
6
  from pathlib import Path
9
- from typing import Any, Generator
7
+ from typing import Any, Iterator
10
8
 
11
9
  class FoundSymbolInfo:
12
10
  section: Section
@@ -154,7 +152,7 @@ class Section:
154
152
  def appendSymbol(self, sym: Symbol) -> None:
155
153
  """Appends a copy of `sym` into the internal symbol list"""
156
154
 
157
- def __iter__(self) -> Generator[Symbol, None, None]: ...
155
+ def __iter__(self) -> Iterator[Symbol]: ...
158
156
  def __getitem__(self, index) -> Symbol: ...
159
157
  def __setitem__(self, index, sym: Symbol): ...
160
158
  def __len__(self) -> int: ...
@@ -221,7 +219,7 @@ class Segment:
221
219
  def appendFile(self, section: Section) -> None:
222
220
  """Appends a copy of `section` into the internal section list"""
223
221
 
224
- def __iter__(self) -> Generator[Section, None, None]: ...
222
+ def __iter__(self) -> Iterator[Section]: ...
225
223
  def __getitem__(self, index) -> Section: ...
226
224
  def __setitem__(self, index, section: Section): ...
227
225
  def __len__(self) -> int: ...
@@ -303,7 +301,7 @@ class MapFile:
303
301
  def appendSegment(self, segment: Segment) -> None:
304
302
  """Appends a copy of `segment` into the internal segment list"""
305
303
 
306
- def __iter__(self) -> Generator[Segment, None, None]: ...
304
+ def __iter__(self) -> Iterator[Segment]: ...
307
305
  def __getitem__(self, index) -> Segment: ...
308
306
  def __setitem__(self, index, segment: Segment): ...
309
307
  def __len__(self) -> int: ...
@@ -7,18 +7,17 @@ from __future__ import annotations
7
7
 
8
8
  from typing import Any
9
9
 
10
-
11
10
  from .mapfile_parser import FoundSymbolInfo as FoundSymbolInfo
12
- from .mapfile_parser import SymbolComparisonInfo as SymbolComparisonInfo
13
- from .mapfile_parser import MapsComparisonInfo as MapsComparisonInfo
14
- from .mapfile_parser import Symbol as Symbol
15
- from .mapfile_parser import Section as Section
16
- from .mapfile_parser import Segment as Segment
17
11
  from .mapfile_parser import MapFile as MapFile
12
+ from .mapfile_parser import MapsComparisonInfo as MapsComparisonInfo
18
13
  from .mapfile_parser import ReportCategories as ReportCategories
19
14
 
20
15
  # Renamed types
21
16
  from .mapfile_parser import Section as File
17
+ from .mapfile_parser import Section as Section
18
+ from .mapfile_parser import Segment as Segment
19
+ from .mapfile_parser import Symbol as Symbol
20
+ from .mapfile_parser import SymbolComparisonInfo as SymbolComparisonInfo
22
21
 
23
22
 
24
23
  def __filers_serializeVram(self: File, humanReadable: bool = True) -> str | int | None:
@@ -5,9 +5,9 @@
5
5
 
6
6
  from __future__ import annotations
7
7
 
8
- from pathlib import Path
9
8
  import subprocess
10
9
  import sys
10
+ from pathlib import Path
11
11
 
12
12
 
13
13
  def eprint(*args, **kwargs):
@@ -33,7 +33,7 @@ def hexbytes(bs: bytes, addColons: bool = True) -> str:
33
33
  glue = ""
34
34
  if addColons:
35
35
  glue = ":"
36
- return glue.join("{:02X}".format(c) for c in bs)
36
+ return glue.join(f"{c:02X}" for c in bs)
37
37
 
38
38
 
39
39
  def getGitCommitTimestamp() -> int:
@@ -513,8 +513,6 @@ impl MapFile {
513
513
  #[cfg(feature = "python_bindings")]
514
514
  #[allow(non_snake_case)]
515
515
  pub(crate) mod python_bindings {
516
- use pyo3::prelude::*;
517
-
518
516
  use std::{
519
517
  collections::HashMap,
520
518
  fs,
@@ -220,6 +220,13 @@ fn report_from_section(
220
220
  | section.section_type.starts_with(".init");
221
221
 
222
222
  for sym_state in section.symbol_match_state_iter(path_decomp_settings) {
223
+ if sym_state.size() == 0 {
224
+ // Avoid zero sized symbols.
225
+ // These are usually `weak` symbols that only bloat the report and
226
+ // can produce misreportings and noise
227
+ continue;
228
+ }
229
+
223
230
  let mut fuzzy_match_percent = 0.0;
224
231
 
225
232
  let sym = match sym_state {
@@ -408,7 +408,7 @@ impl Hash for Section {
408
408
  #[cfg(feature = "python_bindings")]
409
409
  #[allow(non_snake_case)]
410
410
  pub(crate) mod python_bindings {
411
- use pyo3::{intern, prelude::*, IntoPyObjectExt};
411
+ use pyo3::{intern, IntoPyObjectExt};
412
412
 
413
413
  // Required to call the `.hash` and `.finish` methods, which are defined on traits.
414
414
  use std::hash::{Hash, Hasher};
@@ -5,6 +5,7 @@ use std::path::PathBuf;
5
5
 
6
6
  use crate::{section, symbol};
7
7
 
8
+ #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
8
9
  pub enum SymbolDecompState<'sect> {
9
10
  /// The symbol has been decompiled.
10
11
  /// In other words it is being handled by a compiler instead of assembled from automatic disassemblies.
@@ -14,6 +15,21 @@ pub enum SymbolDecompState<'sect> {
14
15
  Undecomped(&'sect symbol::Symbol),
15
16
  }
16
17
 
18
+ impl<'sect> SymbolDecompState<'sect> {
19
+ const fn inner(&self) -> &'sect symbol::Symbol {
20
+ match self {
21
+ Self::Decomped(sym) => sym,
22
+ Self::Undecomped(sym) => sym,
23
+ }
24
+ }
25
+ pub const fn vram(&self) -> u64 {
26
+ self.inner().vram
27
+ }
28
+ pub const fn size(&self) -> u64 {
29
+ self.inner().size
30
+ }
31
+ }
32
+
17
33
  pub struct SymbolDecompStateIter<'sect> {
18
34
  section: &'sect section::Section,
19
35
  whole_file_is_undecomped: bool,
@@ -219,7 +219,7 @@ wheels = [
219
219
 
220
220
  [[package]]
221
221
  name = "mapfile-parser"
222
- version = "2.12.2"
222
+ version = "2.13.2"
223
223
  source = { editable = "." }
224
224
  dependencies = [
225
225
  { name = "decomp-settings" },
File without changes