make DIRECTORY.md paths relative Fixes (#6179) (#6190)

This commit is contained in:
Vcrostin 2022-06-22 07:01:05 +03:00 committed by GitHub
parent c86aa72cfa
commit 69cde43ca1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 833 additions and 829 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3,8 +3,6 @@
import os
from typing import Iterator
URL_BASE = "https://github.com/TheAlgorithms/Python/blob/master"
def good_file_paths(top_dir: str = ".") -> Iterator[str]:
for dir_path, dir_names, filenames in os.walk(top_dir):
@ -36,7 +34,7 @@ def print_directory_md(top_dir: str = ".") -> None:
if filepath != old_path:
old_path = print_path(old_path, filepath)
indent = (filepath.count(os.sep) + 1) if filepath else 0
url = "/".join((URL_BASE, filepath, filename)).replace(" ", "%20")
url = "/".join((filepath, filename)).replace(" ", "%20")
filename = os.path.splitext(filename.replace("_", " ").title())[0]
print(f"{md_prefix(indent)} [{filename}]({url})")