Skip to content

Commit 1eac943

Browse files
committed
modularize upload_frogress a bit
1 parent 55a078c commit 1eac943

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[project]
55
name = "mapfile_parser"
6-
version = "1.1.1"
6+
version = "1.1.2"
77
description = "Map file parser library focusing decompilation projects"
88
readme = "README.md"
99
requires-python = ">=3.7"

src/mapfile_parser/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from __future__ import annotations
77

8-
__version_info__ = (1, 1, 1)
8+
__version_info__ = (1, 1, 2)
99
__version__ = ".".join(map(str, __version_info__))
1010
__author__ = "Decompollaborate"
1111

src/mapfile_parser/frontends/upload_frogress.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
from . import progress
1515

1616

17-
def doUploadFrogress(mapPath: Path, asmPath: Path, nonmatchingsPath: Path, project: str, version: str, category: str, baseurl: str, apikey: str|None=None, verbose: bool=False) -> int:
18-
totalStats, progressPerFolder = progress.getProgress(mapPath, asmPath, nonmatchingsPath)
19-
17+
def getFrogressEntriesFromStats(totalStats: progress_stats.ProgressStats, progressPerFolder: dict[str, progress_stats.ProgressStats], verbose: bool=False) -> dict[str, int]:
2018
entries: dict[str, int] = {}
2119
if verbose:
2220
progress_stats.ProgressStats.printHeader()
@@ -32,9 +30,9 @@ def doUploadFrogress(mapPath: Path, asmPath: Path, nonmatchingsPath: Path, proje
3230

3331
if verbose:
3432
print()
33+
return entries
3534

36-
url = utils.generateFrogressEndpointUrl(baseurl, project, version)
37-
35+
def uploadEntriesToFrogress(entries: dict[str, int], category: str, url: str, apikey: str|None=None, verbose: bool=False):
3836
if verbose:
3937
print(f"Publishing entries to {url}")
4038
for key, value in entries.items():
@@ -51,10 +49,18 @@ def doUploadFrogress(mapPath: Path, asmPath: Path, nonmatchingsPath: Path, proje
5149
r.raise_for_status()
5250
if verbose:
5351
print("Done!")
54-
5552
return 0
5653

5754

55+
def doUploadFrogress(mapPath: Path, asmPath: Path, nonmatchingsPath: Path, project: str, version: str, category: str, baseurl: str, apikey: str|None=None, verbose: bool=False) -> int:
56+
totalStats, progressPerFolder = progress.getProgress(mapPath, asmPath, nonmatchingsPath)
57+
58+
entries: dict[str, int] = getFrogressEntriesFromStats(totalStats, progressPerFolder, verbose)
59+
60+
url = utils.generateFrogressEndpointUrl(baseurl, project, version)
61+
return uploadEntriesToFrogress(entries, category, url, apikey=apikey, verbose=verbose)
62+
63+
5864
def processArguments(args: argparse.Namespace):
5965
mapPath: Path = args.mapfile
6066
asmPath: Path = args.asmpath

0 commit comments

Comments
 (0)