o
    ,wÖii  ã                   @   sP   U d Z ddlZe e¡Zi Zeed< dd„ Zdd„ Z	dd	„ Z
d
d„ Zdd„ ZdS )zZ
State management and query functions for tracking and discovering what
has been patched.
é    NÚsavedc                 C   s   | t v S )z©
    Check if a module has been replaced with a cooperative version.

    :param str mod_name: The name of the standard library module,
        e.g., ``'socket'``.

    )r   )Úmod_name© r   úQ/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/gevent/monkey/_state.pyÚis_module_patched   s   r   c                 C   s   t | ƒo	|t|  v S )a$  
    Check if an object in a module has been replaced with a
    cooperative version.

    :param str mod_name: The name of the standard library module,
        e.g., ``'socket'``.
    :param str item_name: The name of the attribute in the module,
        e.g., ``'create_connection'``.

    )r   r   )r   Ú	item_namer   r   r   Úis_object_patched   s   r   c                   C   s   t tƒS )aD  
    Check if this module has done any patching in the current process.
    This is currently only used in gevent tests.

    Not currently a documented, public API, because I'm not convinced
    it is 100% reliable in the event of third-party patch functions that
    don't use ``saved``.

    .. versionadded:: 21.1.0
    )Úboolr   r   r   r   r   Úis_anything_patched+   s   r
   c                 C   sZ   t  | i ¡}g }d }|D ]}||v r| || ¡ q|d u r"t| ƒ}| t||ƒ¡ q|S ©N)r   ÚgetÚappendÚ
__import__Úgetattr)ÚnameÚitemsÚdÚvaluesÚmoduleÚitemr   r   r   Ú_get_original8   s   r   c                 C   s   t  | ji ¡ ||¡ d S r   )r   Ú
setdefaultÚ__name__)r   Ú	attr_namer   r   r   r   Ú_saveE   s   r   )Ú__doc__ÚloggingÚ	getLoggerr   Úloggerr   ÚdictÚ__annotations__r   r   r
   r   r   r   r   r   r   Ú<module>   s   
