From b1c317538737100aad2450753076e246bdf10971 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 18 Mar 2025 20:36:38 +0100 Subject: [PATCH] fix ruff warnings --- util/analyze-gnu-results.py | 1 + util/compare_gnu_result.py | 10 ++++++---- util/gnu-json-result.py | 1 - util/remaining-gnu-error.py | 4 ++-- util/size-experiment.py | 5 +++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/util/analyze-gnu-results.py b/util/analyze-gnu-results.py index 82c13d778..b9e8534b3 100644 --- a/util/analyze-gnu-results.py +++ b/util/analyze-gnu-results.py @@ -29,6 +29,7 @@ Output: Prints shell export statements for TOTAL, PASS, FAIL, SKIP, XPASS, and ERROR that can be evaluated in a shell environment. """ + import json import sys from collections import defaultdict diff --git a/util/compare_gnu_result.py b/util/compare_gnu_result.py index 37fb3bef5..e0b017e81 100755 --- a/util/compare_gnu_result.py +++ b/util/compare_gnu_result.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 """ -Compare the current results to the last results gathered from the main branch to highlight -if a PR is making the results better/worse. +Compare the current results to the last results gathered from the main branch to +highlight if a PR is making the results better/worse. Don't exit with error code if all failing tests are in the ignore-intermittent.txt list. """ @@ -28,13 +28,15 @@ skip_d = int(current["skip"]) - int(last["skip"]) # Get an annotation to highlight changes print( - f"::warning ::Changes from '{REPO_DEFAULT_BRANCH}': PASS {pass_d:+d} / FAIL {fail_d:+d} / ERROR {error_d:+d} / SKIP {skip_d:+d} " + f"""::warning ::Changes from '{REPO_DEFAULT_BRANCH}': PASS {pass_d:+d} / + FAIL {fail_d:+d} / ERROR {error_d:+d} / SKIP {skip_d:+d}""" ) # If results are worse, check if we should fail the job if pass_d < 0: print( - f"::error ::PASS count is reduced from '{REPO_DEFAULT_BRANCH}': PASS {pass_d:+d} " + f"""::error ::PASS count is reduced from + '{REPO_DEFAULT_BRANCH}': PASS {pass_d:+d}""" ) # Check if all failing tests are intermittent based on the environment variable diff --git a/util/gnu-json-result.py b/util/gnu-json-result.py index ffd39233b..86c2f59d0 100644 --- a/util/gnu-json-result.py +++ b/util/gnu-json-result.py @@ -37,5 +37,4 @@ for filepath in test_dir.glob("**/*.log"): except Exception as e: print(f"Error processing file {path}: {e}", file=sys.stderr) - print(json.dumps(out, indent=2, sort_keys=True)) diff --git a/util/remaining-gnu-error.py b/util/remaining-gnu-error.py index 85486aebe..a632e891c 100755 --- a/util/remaining-gnu-error.py +++ b/util/remaining-gnu-error.py @@ -39,9 +39,9 @@ for files in types: list_of_files = sorted(tests, key=lambda x: os.stat(x).st_size) -def show_list(l): +def show_list(list_test): # Remove the factor tests and reverse the list (bigger first) - tests = list(filter(lambda k: "factor" not in k, l)) + tests = list(filter(lambda k: "factor" not in k, list_test)) for f in reversed(tests): if contains_require_root(f): diff --git a/util/size-experiment.py b/util/size-experiment.py index 5369b73c6..d383c906e 100644 --- a/util/size-experiment.py +++ b/util/size-experiment.py @@ -75,8 +75,9 @@ collect_diff(2, "opt-level") collect_diff(3, "lto") -def analyze(l): - return f"MIN: {float(min(l)):.3}, AVG: {float(sum(l)/len(l)):.3}, MAX: {float(max(l)):.3}" +def analyze(change): + return f"""MIN: {float(min(change)):.3}, + AVG: {float(sum(change) / len(change)):.3}, MAX: {float(max(change)):.3}""" print("Absolute changes")