Skip to content

Commit 9ddb027

Browse files
Adding doctest for md_prefix function in build_directory_md.py (#12874)
* Adding doctests for md_prefix function in build_directory_md.py * Update build_directory_md.py * Update build_directory_md.py * Update build_directory_md.py --------- Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
1 parent c2b9003 commit 9ddb027

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

scripts/build_directory_md.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,20 @@ def good_file_paths(top_dir: str = ".") -> Iterator[str]:
1818
yield os.path.join(dir_path, filename).lstrip("./")
1919

2020

21-
def md_prefix(i):
22-
return f"{i * ' '}*" if i else "\n##"
21+
def md_prefix(indent: int) -> str:
22+
"""
23+
Markdown prefix based on indent for bullet points
24+
25+
>>> md_prefix(0)
26+
'\\n##'
27+
>>> md_prefix(1)
28+
' *'
29+
>>> md_prefix(2)
30+
' *'
31+
>>> md_prefix(3)
32+
' *'
33+
"""
34+
return f"{indent * ' '}*" if indent else "\n##"
2335

2436

2537
def print_path(old_path: str, new_path: str) -> str:

0 commit comments

Comments
 (0)