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

Function find_root_from_paths

src/packagedcode/utils.py:169–179  ·  view source on GitHub ↗

Return the resource for the root directory of this filesystem or None, given a ``resource`` in ``codebase`` with a list of possible resource root- relative ``paths`` (e.g. extending from the root directory we are looking for).

(paths, resource, codebase)

Source from the content-addressed store, hash-verified

167
168
169def find_root_from_paths(paths, resource, codebase):
170 """
171 Return the resource for the root directory of this filesystem or None, given
172 a ``resource`` in ``codebase`` with a list of possible resource root-
173 relative ``paths`` (e.g. extending from the root directory we are looking
174 for).
175 """
176 for path in paths:
177 if not resource.path.endswith(path):
178 continue
179 return find_root_resource(path=path, resource=resource, codebase=codebase)
180
181
182def find_root_resource(path, resource, codebase):

Callers

nothing calls this directly

Calls 1

find_root_resourceFunction · 0.85

Tested by

no test coverage detected