U e @sddlmZddlZddlmZddlmZddl m Z ddl m Z ddl m Z ddl mZddl mZdd l mZdd l mZdd lmZd d ddddddZd ddddZd ddddZdS)) annotationsN)Any)output)InvalidConfigError)InvalidManifestError) load_config) load_manifest)LOCAL)META)Storer zdict[tuple[str, str], str]zset[tuple[str, str]]zdict[str, Any]None)store all_repos unused_reposreporeturnc Cs|dtkrdS|dtkrR|dD]*}|d}|||d|tjfq$n|d|df}||}|dkrxdSzttj |tj }Wnt k rYdSX||dd|D} |dD]H}|d| krq|d| |dd}|||d||dfqdS)NrhooksZadditional_dependenciesrevcSsi|]}|d|qS)id).0hookrrD/opt/hc_python/lib/python3.8/site-packages/pre_commit/commands/gc.py ,sz$_mark_used_repos..r) r r getdiscard db_repo_nameCZLOCAL_REPO_VERSIONrospathjoinZ MANIFEST_FILEr) r rrrrdepskeyrmanifestZby_idrrr_mark_used_reposs<         r$int)r rc Cs|}|}dd|D}dd|D}dd|D}t|}|D]P}z t|}Wn"tk rx||YqFYqFX|dD]} t|||| qqF|||D]\} } || | || | fqt |S)NcSsg|]}tj|s|qSrrrexistsrprrr @s z_gc_repos..cSsg|]}tj|r|qSrr&r(rrrr*As cSsi|]\}}}||f|qSrr)rrrefrrrrrCsz_gc_repos..repos) Zselect_all_configsZselect_all_repossetrrappendr$Zdelete_configsZ delete_repolen) r Zconfigsr,Z dead_configsZ live_configsrrZ config_pathconfigrrr+rrr _gc_repos;s$      r1c Cs0|t|}W5QRXt|ddS)Nz repo(s) removed.r)Zexclusive_lockr1rZ write_line)r Z repos_removedrrrgcUs r2) __future__ros.pathrtypingrZpre_commit.constants constantsrZ pre_commitrZpre_commit.clientlibrrrrr r Zpre_commit.storer r$r1r2rrrrs           *