MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / clean_path

Function clean_path

src/commoncode/resource.py:1645–1654  ·  view source on GitHub ↗

Return a cleaned and normalized POSIX ``path``.

(path)

Source from the content-addressed store, hash-verified

1643
1644
1645def clean_path(path):
1646 """
1647 Return a cleaned and normalized POSIX ``path``.
1648 """
1649 path = path or ""
1650 # convert to posix and ensure we have no slash at the end
1651 path = posixpath_normpath(path.replace("\\", "/").rstrip("/"))
1652 if path == ".":
1653 path = ""
1654 return path
1655
1656
1657def strip_first_path_segment(path):

Callers 15

find_referenced_resourceFunction · 0.90
_prepare_clean_pathsMethod · 0.85
_exists_in_memoryMethod · 0.85
_exists_on_diskMethod · 0.85
get_resourceMethod · 0.85
save_resourceMethod · 0.85
_load_resourceMethod · 0.85
to_decoded_posix_pathFunction · 0.85
build_pathMethod · 0.85
full_root_pathMethod · 0.85

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected