From 83f8bf53704eecb32d2bf5889af165e0162dce20 Mon Sep 17 00:00:00 2001 From: Ammar64 Date: Thu, 7 Nov 2024 19:45:02 +0200 Subject: [PATCH 1/2] Make it work for older python versions --- ensure_sorted.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ensure_sorted.py b/ensure_sorted.py index 04951ee..dbf2818 100755 --- a/ensure_sorted.py +++ b/ensure_sorted.py @@ -93,7 +93,7 @@ def main(): longest_str = len(max(unsorted, key=len)) for j in range(len(sorted)): color = sorted[j] != unsorted[j] - print(f' {bcolors.RED if color else ''}{unsorted[j]}{bcolors.ENDC if color else ''}{((longest_str-len(unsorted[j]))+2) * ' '}{bcolors.GREEN if color else ''}{sorted[j]}{bcolors.ENDC if color else ''}') + print(f' {bcolors.RED if color else ""}{unsorted[j]}{bcolors.ENDC if color else ""}{((longest_str-len(unsorted[j]))+2) * " "}{bcolors.GREEN if color else ""}{sorted[j]}{bcolors.ENDC if color else ""}') all_sorted = False if not all_sorted: From e4efbb47dc65f6d29a133e64b1019a07a04af2cd Mon Sep 17 00:00:00 2001 From: offa Date: Thu, 7 Nov 2024 18:38:25 +0100 Subject: [PATCH 2/2] Fix CI check --- .github/workflows/ci.yml | 2 ++ ensure_sorted.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4526364..912f441 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,8 @@ jobs: contents: read name: Ensure sorted steps: + - name: Checkout + uses: actions/checkout@main - name: Ensure sorted run: python3 ensure_sorted.py diff --git a/ensure_sorted.py b/ensure_sorted.py index dbf2818..0137d25 100755 --- a/ensure_sorted.py +++ b/ensure_sorted.py @@ -74,7 +74,7 @@ def main(): categories.append(category) # This is also a category elif lines[i].startswith("## –"): - category_name = re.findall("(?<=##\s–\s).*?(?=\s–)", lines[i])[0] + category_name = re.findall("(?<=##\\s–\\s).*?(?=\\s–)", lines[i])[0] category = Category(category_name) categories.append(category) # This is an app @@ -101,4 +101,4 @@ def main(): if __name__ == "__main__": - main() \ No newline at end of file + main()