o
    ùT·j  ã                   @  s  d dl mZ d dlZd dlmZmZmZ d dlZddlm	Z	m
Z
 G dd„ deƒZdEd
d„ZdFdd„ZdFdd„ZdFdd„ZdFdd„ZdGdd„ZdHdd„ZdIdd „ZdId!d"„ZdId#d$„ZdJd&d'„ZdJd(d)„ZdKd+d,„ZdLd.d/„ZdMd1d2„ZdNd4d5„ZdOd7d8„ZdPd<d=„ZdQd@dA„ZdRdCdD„ZdS )Sé    )ÚannotationsN)ÚAnyÚProtocolÚcasté   )ÚDEFAULT_TIMEOUTÚDEFAULT_CONNECTION_LIMITSc                   @  sn   e Zd ZU ded< ded< ded< ded< d	ed
< ded< ded< ded< ded< ded< ded< ded< dS )Ú_LegacyHttpxModuleztype[httpx2.Auth]ÚAuthztype[httpx2.Client]ÚClientztype[httpx2.AsyncClient]ÚAsyncClientztype[httpx2.URL]ÚURLztype[httpx2.Response]ÚResponseztype[httpx2.Timeout]ÚTimeoutztype[httpx2.Limits]ÚLimitsztype[httpx2.TimeoutException]ÚTimeoutExceptionztype[httpx2.RequestError]ÚRequestErrorztype[httpx2.HTTPStatusError]ÚHTTPStatusErrorztype[httpx2.StreamConsumed]ÚStreamConsumedztype[httpx2.RequestNotRead]ÚRequestNotReadN)Ú__name__Ú
__module__Ú__qualname__Ú__annotations__© r   r   úQ/home/dinkstrade/pdmp-scanner/venv/lib/python3.10/site-packages/openai/_httpx2.pyr	      s   
 r	   Úreturnú_LegacyHttpxModule | Nonec                  C  s"   t j d¡} | d urtt| ƒS d S )NÚhttpx)ÚsysÚmodulesÚgetr   r	   ©Úmoduler   r   r   Ú_loaded_legacy_httpx   s   r$   ÚvalueÚobjectÚboolc                 C  ó   t | tjƒS ©N)Ú
isinstanceÚhttpx2r   ©r%   r   r   r   Úis_httpx2_sync_client   ó   r-   c                 C  r(   r)   )r*   r+   r   r,   r   r   r   Úis_httpx2_async_client#   r.   r/   c                 C  ó   t ƒ }|d uot| |jƒS r)   )r$   r*   r   ©r%   r#   r   r   r   Úis_legacy_httpx_sync_client'   ó   r2   c                 C  r0   r)   )r$   r*   r   r1   r   r   r   Úis_legacy_httpx_async_client,   r3   r4   ústr | httpx2.URLú
httpx2.URLc                 C  sF   t | tjƒr| S tƒ }| }|d urt ||jƒrt t|ƒ¡S t | ¡S r)   )r*   r+   r   r$   Ústr)r%   r#   Úlegacy_valuer   r   r   Únormalize_httpx_url1   s   
r9   ú!tuple[type[httpx2.Response], ...]c                  C  ó"   t ƒ } | d u rtjfS tj| jfS r)   )r$   r+   r   r"   r   r   r   Úhttp_response_types=   ó   r<   úfloat | httpx2.Timeout | Nonec                 C  s2   t ƒ }|d urt| |jƒrtjdi |  ¡ ¤ŽS | S ©Nr   )r$   r*   r   r+   Úas_dictr1   r   r   r   Únormalize_httpx_timeoutB   ó   rA   c                 C  s   t | ƒS r)   )rA   r,   r   r   r   Únormalize_httpx2_timeoutI   s   rC   c                 C  s2   t ƒ }|d urt| tjƒr|jdi |  ¡ ¤ŽS | S r?   )r$   r*   r+   r   r@   r1   r   r   r   Únormalize_legacy_httpx_timeoutM   rB   rD   úhttpx2.Authc                 C  s(   t ƒ }|d urt| ƒ|ju rt ¡ S | S r)   )r$   Útyper
   r+   r1   r   r   r   Únormalize_httpx2_authT   ó   rG   c                 C  s(   t ƒ }|d urt| ƒtju r| ¡ S | S r)   )r$   rF   r+   r
   r1   r   r   r   Únormalize_legacy_httpx_auth[   rH   rI   ú)tuple[type[httpx2.TimeoutException], ...]c                  C  r;   r)   )r$   r+   r   r"   r   r   r   Útimeout_exceptionsb   r=   rK   ú%tuple[type[httpx2.RequestError], ...]c                  C  r;   r)   )r$   r+   r   r"   r   r   r   Úrequest_exceptionsg   r=   rM   ú(tuple[type[httpx2.HTTPStatusError], ...]c                  C  r;   r)   )r$   r+   r   r"   r   r   r   Ústatus_exceptionsl   r=   rO   ú'tuple[type[httpx2.StreamConsumed], ...]c                  C  r;   r)   )r$   r+   r   r"   r   r   r   Ústream_consumed_exceptionsq   r=   rQ   ú'tuple[type[httpx2.RequestNotRead], ...]c                  C  r;   r)   )r$   r+   r   r"   r   r   r   Úrequest_not_read_exceptionsv   r=   rS   Úkwargsúdict[str, Any]ÚNonec                 C  sh   t |  dt¡ƒ| d< |  dt¡}tƒ }|d ur(t||jƒr(tj|j|j	|j
d�}|| d< |  dd¡ d S )NÚtimeoutÚlimits)Úmax_connectionsÚmax_keepalive_connectionsÚkeepalive_expiryÚfollow_redirectsT)rC   r!   r   r   r$   r*   r   r+   rY   rZ   r[   Ú
setdefault)rT   rX   r#   r   r   r   Ú_set_httpx2_defaults{   s   ýr^   r   úhttpx2.Clientc                  K  ó   t | ƒ tjdi | ¤ŽS )z<Create an HTTPX2 client with the SDK's recommended defaults.Nr   )r^   r+   r   ©rT   r   r   r   ÚDefaultHttpx2ClientŠ   ó   rb   úhttpx2.AsyncClientc                  K  r`   )zBCreate an async HTTPX2 client with the SDK's recommended defaults.Nr   )r^   r+   r   ra   r   r   r   ÚDefaultAsyncHttpx2Client�   rc   re   )r   r   )r%   r&   r   r'   )r%   r5   r   r6   )r   r:   )r%   r>   r   r>   )r%   rE   r   rE   )r   rJ   )r   rL   )r   rN   )r   rP   )r   rR   )rT   rU   r   rV   )rT   r   r   r_   )rT   r   r   rd   ) Ú
__future__r   r   Útypingr   r   r   r+   Ú
_constantsr   r   r	   r$   r-   r/   r2   r4   r9   r<   rA   rC   rD   rG   rI   rK   rM   rO   rQ   rS   r^   rb   re   r   r   r   r   Ú<module>   s4    


















