
    wi9                    2   d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ d dlm	Z	 d dlm
Z
  ej        dd          Zej        Z G d	 d
e	          Zee
eef         df         Ze
eeef         Zeeeef         df         ZddZej        	 ddd            ZdS )    )annotationsN)	Generator)MutableMapping)
NamedTuple)Union_UnsetUNSETc                  (    e Zd ZU ded<   dZded<   dS )Varstrname defaultN)__name__
__module____qualname____annotations__r        e/root/.openclaw/workspace/chatterbox_venv_py311/lib/python3.11/site-packages/pre_commit/envcontext.pyr   r      s,         IIIGr   r   .partsSubstitutionTenvMutableMapping[str, str]returnr   c                F    d                     fd| D                       S )Nr   c              3     K   | ];}t          |t                    r                     |j        |j                  n|V  <d S N)
isinstancer   getr   r   ).0partr   s     r   	<genexpr>zformat_env.<locals>.<genexpr>   s]         -7tS,A,AK	4<(((t     r   )join)r   r   s    `r   
format_envr%      s?    77         r   patchPatchesT_envMutableMapping[str, str] | NoneGenerator[None]c              #    K   |t           j        n|}t          |          }| D ]S\  }}|t          u r|                    |d           %t          |t                    rt          ||          ||<   N|||<   T	 dV  |                                 |	                    |           dS # |                                 |	                    |           w xY w)a  In 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)
osenvirondictr	   popr   tupler%   clearupdate)r&   r(   r   beforekvs         r   
envcontextr6       s       "**$C#YYF  1::GGAt5!! 	6**CFFCFF		

6 			

6s   9B( (+C)r   r   r   r   r   r   r   )r&   r'   r(   r)   r   r*   )
__future__r   
contextlibenumr,   collections.abcr   r   typingr   r   Enumr   r	   r   r0   r   r   ValueTr'   r%   contextmanagerr6   r   r   r   <module>r?      sO   " " " " " "      				 % % % % % % * * * * * *            	8W	%	%    *   
 eCHos*+	sFM)	*sF{#S()     15      r   