
    osj	                        d dl mZ d dlZd dlZd dlZd dlZd dlZd dlmZ d dl	m
Z
 dgZ G d dej                  j                        Z G d d	ej                  j                        Zdd
ZddZy)    )annotationsN)Sequence)
ModuleTypealias_httpxc                  0    e Zd ZU ded<   ddZddZd	dZy)
_AliasLoader%importlib.machinery.ModuleSpec | None_original_specc                    || _         y N)
_real_name)self	real_names     @/root/.hermes/venv/lib/python3.12/site-packages/httpx2/_alias.py__init__z_AliasLoader.__init__   s	    #    c                f    t        j                  | j                        }|j                  | _        |S r   )	importlibimport_moduler   __spec__r
   )r   specmodules      r   create_modulez_AliasLoader.create_module   s'    ((9$oor   c                &    | j                   |_        y r   )r
   r   )r   r   s     r   exec_modulez_AliasLoader.exec_module   s    --r   N)r   strreturnNone)r   zimportlib.machinery.ModuleSpecr   r   )r   r   r   r   )__name__
__module____qualname____annotations__r   r   r    r   r   r   r      s    99$
.r   r   c                  0    e Zd ZddZ	 	 d	 	 	 	 	 	 	 ddZy)_AliasFinderc                     || _         || _        y r   )_alias_real)r   aliasreals      r   r   z_AliasFinder.__init__   s    
r   Nc                d   || j                   k7  r|j                  | j                   dz         sy | j                  |j                  | j                         z   }|t        j
                  vr t        j                  j                  |      y t        j                  j                  |t        |            S )N.)r'   
startswithr(   removeprefixsysmodulesr   util	find_spec	machinery
ModuleSpecr   )r   fullnamepathtargetr   s        r   r2   z_AliasFinder.find_spec"   s     t{{"8+>+>t{{S?P+QJJ!6!6t{{!CC	CKK'INN,D,DY,O,W""--hY8OPPr   )r)   r   r*   r   r   r   )NN)r5   r   r6   zSequence[str] | Noner7   zModuleType | Noner   r	   )r   r    r!   r   r2   r#   r   r   r%   r%      s?     &*$(	QQ #Q "	Q
 
/Qr   r%   c                D    t         j                  j                         }|||urt          d  d      t	         fdt         j
                  D              s4t         j
                  j                  dt         |j                               |t         j                   <   y )Nz? was already imported; call `alias_httpx()` before any `import z`.c              3  `   K   | ]%  }t        |t              xr |j                  k(   ' y wr   )
isinstancer%   r'   ).0finderr)   s     r   	<genexpr>z_alias.<locals>.<genexpr>5   s)     gvz&,/JFMMU4JJgs   +.r   )	r/   r0   getRuntimeErrorany	meta_pathinsertr%   r   )r)   r   existings   `  r   r'   r'   0   s    {{u%H 6eW$cdicjjlmnngY\YfYfggQUFOO DECKKr   c                 D    ddl } ddl}t        d|       t        d|        y)az  
    Make `import httpx` resolve to `httpx2`, and `import httpcore` to `httpcore2`, process-wide.

    Intended for applications migrating from `httpx`, so that dependencies still
    importing `httpx` or `httpcore` share the `httpx2` classes. Libraries should never call this.

    Must be called before anything imports `httpx` or `httpcore`. Calling it again is a no-op.
    r   Nhttpxhttpcore)	httpcore2httpx2r'   )rG   rH   s     r   r   r   :   s     
7F
:y!r   )r)   r   r   r   r   r   )r   r   )
__future__r   r   importlib.abcimportlib.machineryimportlib.utilr/   collections.abcr   typesr   __all__abcLoaderr   MetaPathFinderr%   r'   r   r#   r   r   <module>rS      s\    "     
 $ /.9=='' .Q9==// Q& "r   