From d34a8c1a2fc1037301bd51e1bda47d75f0a2fba7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 29 Feb 2024 22:25:47 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/update_decompile_stats.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/scripts/update_decompile_stats.py b/scripts/update_decompile_stats.py index 99531767..72b8fdc1 100644 --- a/scripts/update_decompile_stats.py +++ b/scripts/update_decompile_stats.py @@ -11,41 +11,45 @@ def get_file(fp): return file.readlines() except FileNotFoundError: - print("couldn't open "+str(fp)+" file") + print("couldn't open " + str(fp) + " file") print("hint: try running the ci from the project root") exit(1) + def create_status_profile(): impl = get_file(script_path / "config" / "implemented.csv") maps = get_file(script_path / "config" / "mapping.csv") raw_func_percentage = len(impl) / len(maps) * 100 - total_func_bytes = 246112 # number of function bytes + total_func_bytes = 246112 # number of function bytes impl_bytes = 0 - for (f_name, location, size) in (line.split(",") for line in maps): - if int(location.removeprefix("0x"), 16) > 4444512: # 0x0043d160 is where 3rd party lib functions start + for f_name, location, size in (line.split(",") for line in maps): + if ( + int(location.removeprefix("0x"), 16) > 4444512 + ): # 0x0043d160 is where 3rd party lib functions start break - if f_name+"\n" in impl: + if f_name + "\n" in impl: impl_bytes += int(size.removeprefix("0x"), 16) byte_impl_percentage = impl_bytes / total_func_bytes * 100 return raw_func_percentage, byte_impl_percentage + def update_svg(): with open(script_path / "resources" / "progress_template.svg", "r") as f: svg_data = f.read() - + func_impl, bytes_impl = create_status_profile() new_svg = svg_data.format( FUNC_PROG_PERCENT=round(func_impl, 2), BYTES_PROG_PERCENT=round(bytes_impl, 2), - FUNC_PROG_WIDTH=round((322*func_impl/100), 2), - BYTES_PROG_WIDTH=round((322*func_impl/100), 2), + FUNC_PROG_WIDTH=round((322 * func_impl / 100), 2), + BYTES_PROG_WIDTH=round((322 * func_impl / 100), 2), ) with open(script_path / "resources" / "progress.svg", "w") as f: @@ -61,7 +65,7 @@ def main(): print(round(raw_func_percentage, 2), "% func implemented") print(round(byte_impl_percentage, 2), "% size implemented") - + if __name__ == "__main__": main()