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

Function target_spec_matches_path

tools/docs_and_notebooks_check.py:300–320  ·  view source on GitHub ↗
(rel_path: str, spec: TargetSpec)

Source from the content-addressed store, hash-verified

298
299
300def target_spec_matches_path(rel_path: str, spec: TargetSpec) -> bool:
301 rel_path = rel_path.replace("\\", "/")
302
303 kind = spec["kind"]
304 normalized = spec["normalized"]
305
306 if kind == "invalid":
307 return False
308
309 if kind == "file":
310 return rel_path == normalized
311
312 if kind == "dir":
313 return rel_path == normalized or rel_path.startswith(normalized + "/")
314
315 if kind == "glob":
316 # Intentionally use simple shell-style matching here so patterns like
317 # docs/**/*.md behave the way users generally expect across platforms.
318 return fnmatch.fnmatchcase(rel_path, normalized)
319
320 return False
321
322
323def target_matches(rel_path: str, specs: list[TargetSpec] | None) -> bool:

Callers 2

target_matchesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected