style: remove trailing spaces from update_directory_md.yml

This commit is contained in:
vil02 2024-01-17 15:24:51 +01:00
parent 6075b3a824
commit 64777732f8

View file

@ -13,17 +13,17 @@ jobs:
from typing import Iterator from typing import Iterator
URL_BASE = "https://github.com/TheAlgorithms/Ruby/blob/master" URL_BASE = "https://github.com/TheAlgorithms/Ruby/blob/master"
g_output = [] g_output = []
def good_filepaths(top_dir: str = ".") -> Iterator[str]: def good_filepaths(top_dir: str = ".") -> Iterator[str]:
for dirpath, dirnames, filenames in os.walk(top_dir): for dirpath, dirnames, filenames in os.walk(top_dir):
dirnames[:] = [d for d in dirnames if d[0] not in "._"] dirnames[:] = [d for d in dirnames if d[0] not in "._"]
for filename in filenames: for filename in filenames:
if os.path.splitext(filename)[1].lower() == ".rb": if os.path.splitext(filename)[1].lower() == ".rb":
yield os.path.join(dirpath, filename).lstrip("./") yield os.path.join(dirpath, filename).lstrip("./")
def md_prefix(i): def md_prefix(i):
return f"{i * ' '}*" if i else "\n##" return f"{i * ' '}*" if i else "\n##"
def print_path(old_path: str, new_path: str) -> str: def print_path(old_path: str, new_path: str) -> str:
global g_output global g_output
old_parts = old_path.split(os.sep) old_parts = old_path.split(os.sep)
@ -32,7 +32,7 @@ jobs:
if new_part: if new_part:
g_output.append(f"{md_prefix(i)} {new_part.replace('_', ' ').title()}") g_output.append(f"{md_prefix(i)} {new_part.replace('_', ' ').title()}")
return new_path return new_path
def build_directory_md(top_dir: str = ".") -> str: def build_directory_md(top_dir: str = ".") -> str:
global g_output global g_output
old_path = "" old_path = ""
@ -47,7 +47,7 @@ jobs:
return "\n".join(g_output) return "\n".join(g_output)
with open("DIRECTORY.md", "w") as out_file: with open("DIRECTORY.md", "w") as out_file:
out_file.write(build_directory_md(".") + "\n") out_file.write(build_directory_md(".") + "\n")
- name: Update DIRECTORY.md - name: Update DIRECTORY.md
run: | run: |
cat DIRECTORY.md cat DIRECTORY.md