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

Method _prepare_clean_paths

src/commoncode/resource.py:347–358  ·  view source on GitHub ↗

Return a new set of cleaned ``paths`` possibly empty. We convert to POSIX and ensure we have no slash at both ends.

(self, paths=tuple())

Source from the content-addressed store, hash-verified

345 self._populate()
346
347 def _prepare_clean_paths(self, paths=tuple()):
348 """
349 Return a new set of cleaned ``paths`` possibly empty.
350 We convert to POSIX and ensure we have no slash at both ends.
351 """
352 paths = (clean_path(p) for p in (paths or []) if p)
353
354 # we sort by path segments (e.g. essentially a topo sort)
355 def _sorter(p):
356 return p.split("/")
357
358 return sorted(paths, key=_sorter)
359
360 def _setup_essentials(self, temp_dir=temp_dir, max_in_memory=10000):
361 """

Callers 2

__init__Method · 0.95
__init__Method · 0.80

Calls 1

clean_pathFunction · 0.85

Tested by

no test coverage detected