mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
psf/black code formatting (#1277)
This commit is contained in:

committed by
Christian Clauss

parent
07f04a2e55
commit
9eac17a408
@ -14,7 +14,7 @@ def good_filepaths(top_dir: str = ".") -> Iterator[str]:
|
||||
continue
|
||||
if os.path.splitext(filename)[1] in (".py", ".ipynb"):
|
||||
yield os.path.join(dirpath, filename).lstrip("./")
|
||||
|
||||
|
||||
|
||||
def md_prefix(i):
|
||||
return f"{i * ' '}*" if i else "##"
|
||||
@ -36,7 +36,9 @@ 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.split(os.sep)[1], filename)).replace(" ", "%20")
|
||||
url = "/".join((URL_BASE, filepath.split(os.sep)[1], filename)).replace(
|
||||
" ", "%20"
|
||||
)
|
||||
filename = os.path.splitext(filename.replace("_", " "))[0]
|
||||
print(f"{md_prefix(indent)} [{filename}]({url})")
|
||||
|
||||
|
@ -25,4 +25,5 @@ if nodir_files:
|
||||
bad_files = len(upper_files + space_files + nodir_files)
|
||||
if bad_files:
|
||||
import sys
|
||||
|
||||
sys.exit(bad_files)
|
||||
|
Reference in New Issue
Block a user