MCPcopy Create free account
hub / github.com/idank/explainshell / source_from_path

Function source_from_path

explainshell/config.py:30–37  ·  view source on GitHub ↗

Return the ``distro/release/section/name.section.gz`` source identifier. Extracts the last four path components, which by convention are ``distro/release/section/file.gz``.

(gz_path)

Source from the content-addressed store, hash-verified

28
29
30def source_from_path(gz_path):
31 """Return the ``distro/release/section/name.section.gz`` source identifier.
32
33 Extracts the last four path components, which by convention are
34 ``distro/release/section/file.gz``.
35 """
36 parts = os.path.normpath(gz_path).split(os.sep)
37 return "/".join(parts[-4:])

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected