0i9(ddlmZddlZddlZddlZddlmZddlmZddlm Z ddlm Z ejddZ e jZ Gd d e Zee eefd fZe ee efZeeeefd fZdd Zej* d dd Zy)) annotationsN) Generator)MutableMapping) NamedTuple)Union_UnsetUNSETc&eZdZUded<dZded<y)VarstrnamedefaultN)__name__ __module__ __qualname____annotations__rD/opt/hc_python/lib/python3.12/site-packages/pre_commit/envcontext.pyr r s IGSrr .c8djfd|DS)Nrc3K|]<}t|tr&j|j|jn|>ywN) isinstancer getr r).0partenvs r zformat_env..s:D-7tS,A 4<<(tKsAA)join)partsrs `r format_envr"s! 77 rc#vK|tjn|}t|}|D]E\}}|tur|j |d!t |t rt||||<A|||<G d|j|j|y#|j|j|wxYww)aIn this context, `os.environ` is modified according to `patch`. `patch` is an iterable of 2-tuples (key, value): `key`: string `value`: - string: `environ[key] == value` inside the context. - UNSET: `key not in environ` inside the context. - template: A template is a tuple of strings and Var which will be replaced with the previous environment N) osenvirondictr poprtupler"clearupdate)patch_envrbeforekvs r envcontextr0 s "**$C #YF1 : GGAt  5 !6*CFCF    6  6sA*B9-B1"B9#B66B9)r! SubstitutionTrzMutableMapping[str, str]returnr r)r+PatchesTr,zMutableMapping[str, str] | Noner2zGenerator[None]) __future__r contextlibenumr$collections.abcrrtypingrrEnumrr r r(r r1ValueTr3r"contextmanagerr0rrrr<s" %* 8W % * eCHos*+ sFM) * sF{#S( ) 15-r