MCPcopy Index your code
hub / github.com/openai/plugins / collect

Function collect

plugins/ngs-analysis/scripts/ngs_run_utils.py:482–504  ·  view source on GitHub ↗
(root_label: str | None, root: Path, root_patterns: list[str])

Source from the content-addressed store, hash-verified

480 seen: set[Path] = set()
481
482 def collect(root_label: str | None, root: Path, root_patterns: list[str]) -> None:
483 prefix = "" if not root_label else f"{root_label}/"
484 for pattern in root_patterns:
485 for path in root.glob(pattern):
486 if path.is_file() and path not in seen:
487 seen.add(path)
488 artifacts.append(
489 {
490 "path": f"{prefix}{path.relative_to(root)}",
491 "bytes": path.stat().st_size,
492 "modified_at": datetime.fromtimestamp(path.stat().st_mtime)
493 .astimezone()
494 .isoformat(timespec="seconds"),
495 "sha256": sha256_file(path)
496 if path.stat().st_size <= MAX_AUTO_CHECKSUM_BYTES
497 else "",
498 "sha256_skipped_reason": (
499 None
500 if path.stat().st_size <= MAX_AUTO_CHECKSUM_BYTES
501 else f"file exceeds {MAX_AUTO_CHECKSUM_BYTES} bytes auto-checksum threshold"
502 ),
503 }
504 )
505
506 collect(None, run_dir, patterns)
507 if extra_roots:

Callers 1

build_artifact_indexFunction · 0.85

Calls 3

sha256_fileFunction · 0.85
statMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected