MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / validate_requested_targets

Function validate_requested_targets

tools/docs_and_notebooks_check.py:342–369  ·  view source on GitHub ↗

Validate CLI target selectors against the current scan universe. Returns: matched_paths: repo-relative file paths matched by any selector unmatched_targets: raw target strings that matched nothing

(
    repo_root: Path,
    cfg: ToolConfig,
    targets: list[str] | None,
)

Source from the content-addressed store, hash-verified

340
341
342def validate_requested_targets(
343 repo_root: Path,
344 cfg: ToolConfig,
345 targets: list[str] | None,
346) -> tuple[list[str], list[str]]:
347 """
348 Validate CLI target selectors against the current scan universe.
349
350 Returns:
351 matched_paths: repo-relative file paths matched by any selector
352 unmatched_targets: raw target strings that matched nothing
353 """
354 if not targets:
355 return [], []
356
357 specs = compile_target_specs(targets, repo_root)
358 candidates = iter_scan_candidate_paths(repo_root, cfg)
359
360 matched_paths = sorted({rel for rel in candidates if target_matches(rel, specs)})
361
362 unmatched_targets: list[str] = []
363 for spec in specs or []:
364 if spec["kind"] == "invalid":
365 unmatched_targets.append(spec["raw"])
366 elif not any(target_spec_matches_path(rel, spec) for rel in candidates):
367 unmatched_targets.append(spec["raw"])
368
369 return matched_paths, unmatched_targets
370
371
372def print_target_match_summary(matched_paths: list[str], requested_targets: list[str] | None) -> None:

Callers 1

mainFunction · 0.85

Calls 4

compile_target_specsFunction · 0.85
target_matchesFunction · 0.85
target_spec_matches_pathFunction · 0.85

Tested by

no test coverage detected