mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 17:34:49 +08:00
contribution guidelines checks (#1787)
* spelling corrections * review * improved documentation, removed redundant variables, added testing * added type hint * camel case to snake case * spelling fix * review * python --> Python # it is a brand name, not a snake * explicit cast to int * spaces in int list * "!= None" to "is not None" * Update comb_sort.py * various spelling corrections in documentation & several variables naming conventions fix * + char in file name * import dependency - bug fix Co-authored-by: John Law <johnlaw.po@gmail.com>
This commit is contained in:
@ -6,14 +6,14 @@ from typing import Iterator
|
||||
URL_BASE = "https://github.com/TheAlgorithms/Python/blob/master"
|
||||
|
||||
|
||||
def good_filepaths(top_dir: str = ".") -> Iterator[str]:
|
||||
for dirpath, dirnames, filenames in os.walk(top_dir):
|
||||
dirnames[:] = [d for d in dirnames if d != "scripts" and d[0] not in "._"]
|
||||
def good_file_paths(top_dir: str = ".") -> Iterator[str]:
|
||||
for dir_path, dir_names, filenames in os.walk(top_dir):
|
||||
dir_names[:] = [d for d in dir_names if d != "scripts" and d[0] not in "._"]
|
||||
for filename in filenames:
|
||||
if filename == "__init__.py":
|
||||
continue
|
||||
if os.path.splitext(filename)[1] in (".py", ".ipynb"):
|
||||
yield os.path.join(dirpath, filename).lstrip("./")
|
||||
yield os.path.join(dir_path, filename).lstrip("./")
|
||||
|
||||
|
||||
def md_prefix(i):
|
||||
@ -31,7 +31,7 @@ def print_path(old_path: str, new_path: str) -> str:
|
||||
|
||||
def print_directory_md(top_dir: str = ".") -> None:
|
||||
old_path = ""
|
||||
for filepath in sorted(good_filepaths()):
|
||||
for filepath in sorted(good_file_paths()):
|
||||
filepath, filename = os.path.split(filepath)
|
||||
if filepath != old_path:
|
||||
old_path = print_path(old_path, filepath)
|
||||
|
@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
from build_directory_md import good_filepaths
|
||||
from build_directory_md import good_file_paths
|
||||
|
||||
filepaths = list(good_filepaths())
|
||||
assert filepaths, "good_filepaths() failed!"
|
||||
filepaths = list(good_file_paths())
|
||||
assert filepaths, "good_file_paths() failed!"
|
||||
|
||||
|
||||
upper_files = [file for file in filepaths if file != file.lower()]
|
||||
|
Reference in New Issue
Block a user