Skip to content

Commit

Permalink
Merge pull request #463 from Ammar64/master
Browse files Browse the repository at this point in the history
Make it work for older python versions
  • Loading branch information
offa authored Nov 7, 2024
2 parents 2a01618 + e4efbb4 commit 6d5ea07
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

6 changes: 3 additions & 3 deletions ensure_sorted.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -93,12 +93,12 @@ 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:
exit(2)


if __name__ == "__main__":
main()
main()

0 comments on commit 6d5ea07

Please sign in to comment.