MCPcopy Create free account
hub / github.com/NVIDIA/SkillEvaluator / doc_reference_pattern

Function doc_reference_pattern

scripts/select_docs_tests.py:34–46  ·  view source on GitHub ↗

Match the ways a test names a path the classifier calls documentation. The patterns come from the classifier's own lists, so a path added there is covered here without a second edit.

()

Source from the content-addressed store, hash-verified

32
33
34def doc_reference_pattern() -> re.Pattern[str]:
35 """Match the ways a test names a path the classifier calls documentation.
36
37 The patterns come from the classifier's own lists, so a path added there is
38 covered here without a second edit.
39 """
40 alternatives = sorted({re.escape(PurePosixPath(path.decode()).name) for path in DOC_FILES})
41 for directory in sorted({PurePosixPath(prefix.decode()).name for prefix in DOC_PREFIXES}):
42 name = re.escape(directory)
43 # ``"docs/page.mdx"`` as one string, or ``root / "docs" / "page.mdx"``.
44 alternatives.append(rf"(?<![\w.-]){name}/")
45 alternatives.append(rf"""["']{name}["']""")
46 return re.compile("|".join(alternatives))
47
48
49def _is_test_file(path: Path) -> bool:

Callers 1

select_docs_testsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected