MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / print_path

Function print_path

scripts/build_directory_md.py:37–42  ·  view source on GitHub ↗
(old_path: str, new_path: str)

Source from the content-addressed store, hash-verified

35
36
37def print_path(old_path: str, new_path: str) -> str:
38 old_parts = old_path.split(os.sep)
39 for i, new_part in enumerate(new_path.split(os.sep)):
40 if (i + 1 > len(old_parts) or old_parts[i] != new_part) and new_part:
41 print(f"{md_prefix(i)} {new_part.replace('_', ' ').title()}")
42 return new_path
43
44
45def print_directory_md(top_dir: str = ".") -> None:

Callers 1

print_directory_mdFunction · 0.85

Calls 2

md_prefixFunction · 0.85
splitMethod · 0.80

Tested by

no test coverage detected