Viewing File: /opt/hc_python/lib/python3.12/site-packages/pre_commit/__pycache__/envcontext.cpython-312.pyc

�

i0i9��(�ddlmZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
Z
ejdd�ZejZ
Gd	�d
e	�Zee
eefdfZe
eeefZeeeefdfZdd�Zej*	d					dd
��Zy)�)�annotationsN)�	Generator)�MutableMapping)�
NamedTuple)�Union�_Unset�UNSETc�&�eZdZUded<dZded<y)�Var�str�name��defaultN)�__name__�
__module__�__qualname__�__annotations__r���D/opt/hc_python/lib/python3.12/site-packages/pre_commit/envcontext.pyrrs��

�I��G�S�rr.c�8��dj�fd�|D��S)Nrc3��K�|]<}t|t�r&�j|j|j�n|���>y�w�N)�
isinstancer�getr
r)�.0�part�envs  �r�	<genexpr>zformat_env.<locals>.<genexpr>s:�������D�-7�t�S�,A�����	�	�4�<�<�(�t�K��s�AA)�join)�partsrs `r�
format_envr"s!���
�7�7�����rc#�vK�|�tjn|}t|�}|D]E\}}|tur|j	|d��!t|t�rt||�||<�A|||<�G	d��|j�|j|�y#|j�|j|�wxYw�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)�patch�_envr�before�k�vs      r�
envcontextr0 s�������"�*�*�$�C�
�#�Y�F����1���:��G�G�A�t��
��5�
!���6�*�C��F��C��F�
��
��	�	���
�
�6���	�	�	���
�
�6��s�A*B9�-B�1"B9�#B6�6B9)r!�
SubstitutionTrzMutableMapping[str, str]�returnrr)r+�PatchesTr,zMutableMapping[str, str] | Noner2zGenerator[None])�
__future__r�
contextlib�enumr$�collections.abcrr�typingrr�Enumrr	rr(rr1�ValueTr3r"�contextmanagerr0rrr�<module>r<s���"���	�%�*���	����8�W�	%�������*��
�e�C��H�o�s�*�+�
�	�s�F�M�)�	*����s�F�{�#�S�(�)������15����-�����r
Back to Directory File Manager