MCPcopy Index your code
hub / github.com/idank/explainshell / validate_source_path

Function validate_source_path

explainshell/store.py:23–33  ·  view source on GitHub ↗

Validate that *source* has the ``distro/release/section/name.section.gz`` format. Raises ``errors.InvalidSourcePath`` on failure.

(source: str)

Source from the content-addressed store, hash-verified

21
22
23def validate_source_path(source: str) -> None:
24 """Validate that *source* has the ``distro/release/section/name.section.gz`` format.
25
26 Raises ``errors.InvalidSourcePath`` on failure.
27 """
28 if not _SOURCE_RE.match(source):
29 raise errors.InvalidSourcePath(
30 f"source path {source!r} does not match the required "
31 f"'distro/release/section/name.section.gz' format "
32 f"(e.g. 'ubuntu/26.04/1/tar.1.gz')"
33 )
34
35
36_CREATE_SCHEMA = """

Callers 6

checkFunction · 0.90
test_valid_pathMethod · 0.90
add_manpageMethod · 0.85

Calls 1

matchMethod · 0.80

Tested by 4

test_valid_pathMethod · 0.72