mapfile-parser 2.3.0__tar.gz → 2.3.1__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 (42) hide show
  1. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/CHANGELOG.md +12 -0
  2. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/Cargo.lock +32 -25
  3. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/Cargo.toml +4 -6
  4. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/PKG-INFO +3 -15
  5. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/README.md +2 -14
  6. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/pyproject.toml +1 -1
  7. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/mapfile_parser/__init__.py +1 -1
  8. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/mapfile_parser/frontends/progress.py +2 -2
  9. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/mapfile_parser/mapfile_parser.pyi +22 -0
  10. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/mapfile_parser/mapfile_rs.py +0 -34
  11. mapfile_parser-2.3.1/src/mapfile_parser/progress_stats.py +60 -0
  12. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/rs/file.rs +230 -125
  13. mapfile_parser-2.3.1/src/rs/found_symbol_info.rs +128 -0
  14. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/rs/lib.rs +1 -0
  15. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/rs/mapfile.rs +161 -78
  16. mapfile_parser-2.3.1/src/rs/maps_comparison_info.rs +91 -0
  17. mapfile_parser-2.3.1/src/rs/progress_stats.rs +173 -0
  18. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/rs/segment.rs +193 -97
  19. mapfile_parser-2.3.1/src/rs/symbol.rs +325 -0
  20. mapfile_parser-2.3.1/src/rs/symbol_comparison_info.rs +138 -0
  21. mapfile_parser-2.3.0/src/mapfile_parser/progress_stats.py +0 -41
  22. mapfile_parser-2.3.0/src/rs/found_symbol_info.rs +0 -73
  23. mapfile_parser-2.3.0/src/rs/maps_comparison_info.rs +0 -39
  24. mapfile_parser-2.3.0/src/rs/progress_stats.rs +0 -69
  25. mapfile_parser-2.3.0/src/rs/symbol.rs +0 -141
  26. mapfile_parser-2.3.0/src/rs/symbol_comparison_info.rs +0 -50
  27. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/.gitattributes +0 -0
  28. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/.gitignore +0 -0
  29. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/LICENSE +0 -0
  30. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/mapfile_parser/__main__.py +0 -0
  31. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/mapfile_parser/frontends/__init__.py +0 -0
  32. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/mapfile_parser/frontends/bss_check.py +0 -0
  33. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/mapfile_parser/frontends/first_diff.py +0 -0
  34. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/mapfile_parser/frontends/jsonify.py +0 -0
  35. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/mapfile_parser/frontends/pj64_syms.py +0 -0
  36. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/mapfile_parser/frontends/sym_info.py +0 -0
  37. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/mapfile_parser/frontends/symbol_sizes_csv.py +0 -0
  38. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/mapfile_parser/frontends/upload_frogress.py +0 -0
  39. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/mapfile_parser/mapfile.py +0 -0
  40. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/mapfile_parser/progress_stats_rs.py +0 -0
  41. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/mapfile_parser/utils.py +0 -0
  42. {mapfile_parser-2.3.0 → mapfile_parser-2.3.1}/src/rs/utils.rs +0 -0
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.3.1] - 2023-12-23
11
+
12
+ ### Added
13
+
14
+ - Add a few utility methods to `ProgressStats`.
15
+
16
+ ### Changed
17
+
18
+ - `pyo3` is no longer needed to use this crate as Rust-only library.
19
+ - Updated Rust dependencies.
20
+
10
21
  ## [2.3.0] - 2023-11-05
11
22
 
12
23
  ### Added
@@ -277,6 +288,7 @@ Full changes: <https://github.com/Decompollaborate/mapfile_parser/compare/702a73
277
288
  - Initial release
278
289
 
279
290
  [unreleased]: https://github.com/Decompollaborate/mapfile_parser/compare/master...develop
291
+ [2.3.1]: https://github.com/Decompollaborate/mapfile_parser/compare/2.3.0...2.3.1
280
292
  [2.3.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.2.1...2.3.0
281
293
  [2.2.1]: https://github.com/Decompollaborate/mapfile_parser/compare/2.2.0...2.2.1
282
294
  [2.2.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.1.5...2.2.0
@@ -29,11 +29,17 @@ version = "1.0.0"
29
29
  source = "registry+https://github.com/rust-lang/crates.io-index"
30
30
  checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
31
31
 
32
+ [[package]]
33
+ name = "heck"
34
+ version = "0.4.1"
35
+ source = "registry+https://github.com/rust-lang/crates.io-index"
36
+ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
37
+
32
38
  [[package]]
33
39
  name = "indoc"
34
- version = "1.0.9"
40
+ version = "2.0.4"
35
41
  source = "registry+https://github.com/rust-lang/crates.io-index"
36
- checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306"
42
+ checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8"
37
43
 
38
44
  [[package]]
39
45
  name = "lazy_static"
@@ -43,9 +49,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
43
49
 
44
50
  [[package]]
45
51
  name = "libc"
46
- version = "0.2.150"
52
+ version = "0.2.151"
47
53
  source = "registry+https://github.com/rust-lang/crates.io-index"
48
- checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
54
+ checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
49
55
 
50
56
  [[package]]
51
57
  name = "lock_api"
@@ -59,7 +65,7 @@ dependencies = [
59
65
 
60
66
  [[package]]
61
67
  name = "mapfile_parser"
62
- version = "2.3.0"
68
+ version = "2.3.1"
63
69
  dependencies = [
64
70
  "lazy_static",
65
71
  "pyo3",
@@ -83,9 +89,9 @@ dependencies = [
83
89
 
84
90
  [[package]]
85
91
  name = "once_cell"
86
- version = "1.18.0"
92
+ version = "1.19.0"
87
93
  source = "registry+https://github.com/rust-lang/crates.io-index"
88
- checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
94
+ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
89
95
 
90
96
  [[package]]
91
97
  name = "parking_lot"
@@ -112,18 +118,18 @@ dependencies = [
112
118
 
113
119
  [[package]]
114
120
  name = "proc-macro2"
115
- version = "1.0.69"
121
+ version = "1.0.71"
116
122
  source = "registry+https://github.com/rust-lang/crates.io-index"
117
- checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
123
+ checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8"
118
124
  dependencies = [
119
125
  "unicode-ident",
120
126
  ]
121
127
 
122
128
  [[package]]
123
129
  name = "pyo3"
124
- version = "0.19.2"
130
+ version = "0.20.0"
125
131
  source = "registry+https://github.com/rust-lang/crates.io-index"
126
- checksum = "e681a6cfdc4adcc93b4d3cf993749a4552018ee0a9b65fc0ccfad74352c72a38"
132
+ checksum = "04e8453b658fe480c3e70c8ed4e3d3ec33eb74988bd186561b0cc66b85c3bc4b"
127
133
  dependencies = [
128
134
  "cfg-if",
129
135
  "indoc",
@@ -138,9 +144,9 @@ dependencies = [
138
144
 
139
145
  [[package]]
140
146
  name = "pyo3-build-config"
141
- version = "0.19.2"
147
+ version = "0.20.0"
142
148
  source = "registry+https://github.com/rust-lang/crates.io-index"
143
- checksum = "076c73d0bc438f7a4ef6fdd0c3bb4732149136abd952b110ac93e4edb13a6ba5"
149
+ checksum = "a96fe70b176a89cff78f2fa7b3c930081e163d5379b4dcdf993e3ae29ca662e5"
144
150
  dependencies = [
145
151
  "once_cell",
146
152
  "target-lexicon",
@@ -148,9 +154,9 @@ dependencies = [
148
154
 
149
155
  [[package]]
150
156
  name = "pyo3-ffi"
151
- version = "0.19.2"
157
+ version = "0.20.0"
152
158
  source = "registry+https://github.com/rust-lang/crates.io-index"
153
- checksum = "e53cee42e77ebe256066ba8aa77eff722b3bb91f3419177cf4cd0f304d3284d9"
159
+ checksum = "214929900fd25e6604661ed9cf349727c8920d47deff196c4e28165a6ef2a96b"
154
160
  dependencies = [
155
161
  "libc",
156
162
  "pyo3-build-config",
@@ -158,9 +164,9 @@ dependencies = [
158
164
 
159
165
  [[package]]
160
166
  name = "pyo3-macros"
161
- version = "0.19.2"
167
+ version = "0.20.0"
162
168
  source = "registry+https://github.com/rust-lang/crates.io-index"
163
- checksum = "dfeb4c99597e136528c6dd7d5e3de5434d1ceaf487436a3f03b2d56b6fc9efd1"
169
+ checksum = "dac53072f717aa1bfa4db832b39de8c875b7c7af4f4a6fe93cdbf9264cf8383b"
164
170
  dependencies = [
165
171
  "proc-macro2",
166
172
  "pyo3-macros-backend",
@@ -170,10 +176,11 @@ dependencies = [
170
176
 
171
177
  [[package]]
172
178
  name = "pyo3-macros-backend"
173
- version = "0.19.2"
179
+ version = "0.20.0"
174
180
  source = "registry+https://github.com/rust-lang/crates.io-index"
175
- checksum = "947dc12175c254889edc0c02e399476c2f652b4b9ebd123aa655c224de259536"
181
+ checksum = "7774b5a8282bd4f25f803b1f0d945120be959a36c72e08e7cd031c792fdfd424"
176
182
  dependencies = [
183
+ "heck",
177
184
  "proc-macro2",
178
185
  "quote",
179
186
  "syn",
@@ -234,15 +241,15 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
234
241
 
235
242
  [[package]]
236
243
  name = "smallvec"
237
- version = "1.11.1"
244
+ version = "1.11.2"
238
245
  source = "registry+https://github.com/rust-lang/crates.io-index"
239
- checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a"
246
+ checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
240
247
 
241
248
  [[package]]
242
249
  name = "syn"
243
- version = "1.0.109"
250
+ version = "2.0.42"
244
251
  source = "registry+https://github.com/rust-lang/crates.io-index"
245
- checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
252
+ checksum = "5b7d0a2c048d661a1a59fcd7355baa232f7ed34e0ee4df2eef3c1c1c0d3852d8"
246
253
  dependencies = [
247
254
  "proc-macro2",
248
255
  "quote",
@@ -263,9 +270,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
263
270
 
264
271
  [[package]]
265
272
  name = "unindent"
266
- version = "0.1.11"
273
+ version = "0.2.3"
267
274
  source = "registry+https://github.com/rust-lang/crates.io-index"
268
- checksum = "e1766d682d402817b5ac4490b3c3002d91dfa0d22812f341609f97b08757359c"
275
+ checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
269
276
 
270
277
  [[package]]
271
278
  name = "windows-targets"
@@ -3,7 +3,7 @@
3
3
 
4
4
  [package]
5
5
  name = "mapfile_parser"
6
- version = "2.3.0"
6
+ version = "2.3.1"
7
7
  edition = "2021"
8
8
  authors = ["Anghelo Carvajal <angheloalf95@gmail.com>"]
9
9
  description = "Map file parser library focusing decompilation projects"
@@ -22,11 +22,9 @@ path = "src/rs/lib.rs"
22
22
  crate-type = ["cdylib", "staticlib", "rlib"]
23
23
 
24
24
  [dependencies]
25
- regex = "1.9.5"
26
- # pyo3 = { version = "0.19.0", optional = true }
27
- pyo3 = { version = "0.19.0", optional = false }
25
+ regex = "1.10.2"
26
+ pyo3 = { version = "0.20.0", optional = true }
28
27
  lazy_static = "1.4.0"
29
28
 
30
29
  [features]
31
- python_bindings = []
32
- # python_bindings = ["dep:pyo3"]
30
+ python_bindings = ["dep:pyo3"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mapfile_parser
3
- Version: 2.3.0
3
+ Version: 2.3.1
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -54,7 +54,7 @@ If you use a `requirements.txt` file in your repository, then you can add
54
54
  this library with the following line:
55
55
 
56
56
  ```txt
57
- mapfile_parser>=2.3.0,<3.0.0
57
+ mapfile_parser>=2.3.1,<3.0.0
58
58
  ```
59
59
 
60
60
  #### Development version
@@ -93,19 +93,7 @@ cargo add mapfile_parser
93
93
  Or add the following line manually to your `Cargo.toml` file:
94
94
 
95
95
  ```toml
96
- mapfile_parser = "2.3.0"
97
- ```
98
-
99
- #### System-wide dependencies
100
-
101
- Due to how intrusive `pyo3` is (and even impossible to disable via Cargo
102
- features), Python development files are required to build and use the Rust
103
- version of this library
104
-
105
- To install those dependencies on a Debian/Ubuntu Linux distro:
106
-
107
- ```bash
108
- sudo apt install libpython3-dev
96
+ mapfile_parser = "2.3.1"
109
97
  ```
110
98
 
111
99
  ## Versioning and changelog
@@ -35,7 +35,7 @@ If you use a `requirements.txt` file in your repository, then you can add
35
35
  this library with the following line:
36
36
 
37
37
  ```txt
38
- mapfile_parser>=2.3.0,<3.0.0
38
+ mapfile_parser>=2.3.1,<3.0.0
39
39
  ```
40
40
 
41
41
  #### Development version
@@ -74,19 +74,7 @@ cargo add mapfile_parser
74
74
  Or add the following line manually to your `Cargo.toml` file:
75
75
 
76
76
  ```toml
77
- mapfile_parser = "2.3.0"
78
- ```
79
-
80
- #### System-wide dependencies
81
-
82
- Due to how intrusive `pyo3` is (and even impossible to disable via Cargo
83
- features), Python development files are required to build and use the Rust
84
- version of this library
85
-
86
- To install those dependencies on a Debian/Ubuntu Linux distro:
87
-
88
- ```bash
89
- sudo apt install libpython3-dev
77
+ mapfile_parser = "2.3.1"
90
78
  ```
91
79
 
92
80
  ## Versioning and changelog
@@ -3,7 +3,7 @@
3
3
 
4
4
  [project]
5
5
  name = "mapfile_parser"
6
- version = "2.3.0"
6
+ version = "2.3.1"
7
7
  description = "Map file parser library focusing decompilation projects"
8
8
  readme = "README.md"
9
9
  requires-python = ">=3.7"
@@ -5,7 +5,7 @@
5
5
 
6
6
  from __future__ import annotations
7
7
 
8
- __version_info__ = (2, 3, 0)
8
+ __version_info__ = (2, 3, 1)
9
9
  __version__ = ".".join(map(str, __version_info__))
10
10
  __author__ = "Decompollaborate"
11
11
 
@@ -32,7 +32,7 @@ def processArguments(args: argparse.Namespace):
32
32
  asmPath: Path = args.asmpath
33
33
  nonmatchingsPath: Path = args.nonmatchingspath
34
34
  pathIndex: int = args.path_index
35
- debugging: bool = args.debugging
35
+ debugging: bool = args.debugging #! @deprecated
36
36
 
37
37
  exit(doProgress(mapPath, asmPath, nonmatchingsPath, pathIndex=pathIndex, debugging=debugging))
38
38
 
@@ -43,6 +43,6 @@ def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser])
43
43
  parser.add_argument("asmpath", help="Path to asm folder", type=Path)
44
44
  parser.add_argument("nonmatchingspath", help="Path to nonmatchings folder", type=Path)
45
45
  parser.add_argument("-i", "--path-index", help="Specify the index to start reading the file paths. Defaults to 2", type=int, default=2)
46
- parser.add_argument("-d", "--debugging", help="Enable debugging prints", action="store_true")
46
+ parser.add_argument("-d", "--debugging", help="Enable debugging prints. This option is deprecated", action="store_true")
47
47
 
48
48
  parser.set_defaults(func=processArguments)
@@ -47,11 +47,30 @@ class ProgressStats:
47
47
  @property
48
48
  def total(self) -> int: ...
49
49
 
50
+ def undecompedPercentage(self) -> float:
51
+ ...
52
+
53
+ def decompedPercentage(self) -> float:
54
+ ...
55
+
56
+ def undecompedPercentageTotal(self, totalStats: ProgressStats) -> float:
57
+ ...
58
+
59
+ def decompedPercentageTotal(self, totalStats: ProgressStats) -> float:
60
+ ...
61
+
50
62
  def getAsFrogressEntry(self, name: str) -> dict[str, int]: ...
51
63
 
64
+ @staticmethod
65
+ def getHeaderAsStr() -> str:
66
+ ...
67
+
52
68
  @staticmethod
53
69
  def printHeader() -> None: ...
54
70
 
71
+ def getEntryAsStr(self, category: str, totalStats: ProgressStats) -> str:
72
+ ...
73
+
55
74
  def print(self, category: str, totalStats: ProgressStats) -> None: ...
56
75
 
57
76
 
@@ -67,7 +86,9 @@ class Symbol:
67
86
  def getVramStr(self) -> str: ...
68
87
  def getSizeStr(self) -> str: ...
69
88
  def getVromStr(self) -> str: ...
89
+ def getAlignStr(self) -> str: ...
70
90
 
91
+ def serializeName(self, humanReadable: bool=True) -> str|int|None: ...
71
92
  def serializeVram(self, humanReadable: bool=True) -> str|int|None: ...
72
93
  def serializeSize(self, humanReadable: bool=True) -> str|int|None: ...
73
94
  def serializeVrom(self, humanReadable: bool=True) -> str|int|None: ...
@@ -84,6 +105,7 @@ class Symbol:
84
105
 
85
106
  def __eq__(self, other) -> bool: ...
86
107
  def __hash__(self): ...
108
+ def __repr__(self): ...
87
109
 
88
110
 
89
111
  class File:
@@ -18,40 +18,6 @@ from .mapfile_parser import Segment as Segment
18
18
  from .mapfile_parser import MapFile as MapFile
19
19
 
20
20
 
21
- def __symbolrs_serializeVram(self: Symbol, humanReadable: bool=True) -> str|int|None:
22
- if humanReadable:
23
- return f"0x{self.vram:08X}"
24
- return self.vram
25
-
26
- def __symbolrs_serializeSize(self: Symbol, humanReadable: bool=True) -> str|int|None:
27
- if self.size is None:
28
- return None
29
- if humanReadable:
30
- return f"0x{self.size:X}"
31
- return self.size
32
-
33
- def __symbolrs_serializeVrom(self: Symbol, humanReadable: bool=True) -> str|int|None:
34
- if self.vrom is None:
35
- return None
36
- if humanReadable:
37
- return f"0x{self.vrom:06X}"
38
- return self.vrom
39
-
40
- def __symbolrs_toJson(self: Symbol, humanReadable: bool=True) -> dict[str, Any]:
41
- result: dict[str, Any] = {
42
- "name": self.name,
43
- "vram": self.serializeVram(humanReadable=humanReadable),
44
- "size": self.serializeSize(humanReadable=humanReadable),
45
- "vrom": self.serializeVrom(humanReadable=humanReadable),
46
- }
47
- return result
48
-
49
- Symbol.serializeVram = __symbolrs_serializeVram # type: ignore
50
- Symbol.serializeSize = __symbolrs_serializeSize # type: ignore
51
- Symbol.serializeVrom = __symbolrs_serializeVrom # type: ignore
52
- Symbol.toJson = __symbolrs_toJson # type: ignore
53
-
54
-
55
21
  @property # type: ignore
56
22
  def __filers_filepath(self: File) -> Path:
57
23
  return Path(self._filepath_internal)
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env python3
2
+
3
+ # SPDX-FileCopyrightText: © 2022-2023 Decompollaborate
4
+ # SPDX-License-Identifier: MIT
5
+
6
+ from __future__ import annotations
7
+
8
+ import dataclasses
9
+
10
+
11
+ @dataclasses.dataclass
12
+ class ProgressStats:
13
+ undecompedSize: int = 0
14
+ decompedSize: int = 0
15
+
16
+ @property
17
+ def total(self) -> int:
18
+ return self.undecompedSize + self.decompedSize
19
+
20
+ def undecompedPercentage(self) -> float:
21
+ return self.undecompedSize / self.total * 100
22
+
23
+ def decompedPercentage(self) -> float:
24
+ return self.decompedSize / self.total * 100
25
+
26
+ def undecompedPercentageTotal(self, totalStats: ProgressStats) -> float:
27
+ return self.undecompedSize / totalStats.total * 100
28
+
29
+ def decompedPercentageTotal(self, totalStats: ProgressStats) -> float:
30
+ return self.decompedSize / totalStats.total * 100
31
+
32
+ def getAsFrogressEntry(self, name: str) -> dict[str, int]:
33
+ categories: dict[str, int] = {}
34
+ categories[name] = self.decompedSize
35
+ categories[f"{name}/total"] = self.total
36
+ return categories
37
+
38
+ @staticmethod
39
+ def getHeaderAsStr() -> str:
40
+ return f"{'Category':<28}: {'DecompedSize':>12} / {'Total':>8} {'OfFolder':>10}% ({'OfTotal':>20}%)"
41
+
42
+ @staticmethod
43
+ def printHeader():
44
+ print(ProgressStats.getHeaderAsStr())
45
+
46
+ def getEntryAsStr(self, category: str, totalStats: ProgressStats) -> str:
47
+ return f"{category:<28}: {self.decompedSize:>12} / {self.total:>8} {self.decompedPercentage():>10.4f}% ({self.decompedPercentageTotal(totalStats):>8.4f}% / {self.total / totalStats.total * 100:>8.4f}%)"
48
+
49
+ def print(self, category: str, totalStats: ProgressStats):
50
+ print(self.getEntryAsStr(category, totalStats))
51
+
52
+
53
+ def printStats(totalStats: ProgressStats, progressPerFolder: dict[str, ProgressStats]):
54
+ ProgressStats.printHeader()
55
+ totalStats.print("all", totalStats)
56
+ print()
57
+
58
+ for folder, statsEntry in progressPerFolder.items():
59
+ statsEntry.print(folder, totalStats)
60
+