INNER CODE UNIT · Python
gather_repo_and_sources
zachlagden/Pi-hole-Optimized-Blocklists · .github/triage/triage/__main__.py:37
def gather_repo_and_sources(evidence: Evidence, repo_root: Path) -> None:
domain, apex = evidence.domain, evidence.apex
evidence.custom = custom_matches(repo_root, domain)
evidence.whitelist = whitelist_matches(repo_root, domain)
targets = set(self_and_parents(domain)) | {apex}
sources = load_sources(repo_root)
evidence.sources = attempt(evidence, "source scan", lambda: scan_sources(sources, targets), [])
evidence.coverage = build_coverage(domain, evidence.sources, evidence.custom, evidence.whitelist)
if apex != domain:
evidence.apex_coverage = build_coverage(
apex, evidence.sources, custom_matches(repo_root, apex), whitelist_matches(repo_root, apex)
)
def gather_reputation(evidence: Evidence, vt_key: str | None) -> None:
names = [evidence.domain] + ([evidence.apex] if evidence.apex != evidence.domain else [])
if vt_key:
evidence.virustotal = [attempt(evidence, f"VirusTotal {name}", lambda n=name: reputation.virustotal(n, vt_key), None) for name in names]