
    i4                    N   d dl mZ d dlmZmZ d dlmZ d dlZddlm	Z	 ddl
mZ g dZ G d	 d
e          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d d e          Z G d! d"e          Z G d# d$e          Z G d% d&e          Z G d' d(e          Z G d) d*e          Z G d+ d,e          ZdS )-    )annotations)Unioncast)LiteralN   )is_dict)	ErrorType)BadRequestErrorAuthenticationErrorPermissionDeniedErrorNotFoundErrorConflictErrorUnprocessableEntityErrorRateLimitErrorInternalServerErrorc                      e Zd ZdS )AnthropicErrorN__name__
__module____qualname__     R/root/projects/qq-shell/venv/lib/python3.11/site-packages/anthropic/_exceptions.pyr   r              Dr   r   c                  B     e Zd ZU ded<   ded<   ded<   	 d
 fd	Z xZS )APIErrorstrmessagehttpx.Requestrequestobject | NonebodyreturnNonec               t    t                                          |           || _        || _        || _        d S )N)super__init__r!   r   r#   )selfr   r!   r#   	__class__s       r   r(   zAPIError.__init__,   s4    !!!			r   )r   r   r!   r    r#   r"   r$   r%   r   r   r   __annotations__r(   __classcell__r*   s   @r   r   r      se         LLL         r   r   c                  <     e Zd ZU ded<   ded<   ddd fdZ xZS )APIResponseValidationErrorhttpx.Responseresponseintstatus_codeNr   r#   r"   r   
str | Noner$   r%   c                   t                                          |pd|j        |           || _        |j        | _        d S )Nz1Data returned by API invalid for expected schema.r#   )r'   r(   r!   r2   r4   )r)   r2   r#   r   r*   s       r   r(   z#APIResponseValidationError.__init__7   sE    W$WYaYiptuuu #/r   )r2   r1   r#   r"   r   r6   r$   r%   r+   r.   s   @r   r0   r0   3   sd         _c 0 0 0 0 0 0 0 0 0 0 0 0r   r0   c                  N     e Zd ZU dZded<   ded<   ded<   ded	<   d fdZ xZS )APIStatusErrorz<Raised when an API response has a status code of 4xx or 5xx.r1   r2   r3   r4   r6   
request_idzErrorType | Nonetyper   r   r#   r"   r$   r%   c                  t                                          ||j        |           || _        |j        | _        |j                            d          | _        d | _        t          |          r`|                    d          }t          |          r>t          t          t          d f         |                    d                    | _        d S d S d S )Nr8   z
request-iderrorr<   )r'   r(   r!   r2   r4   headersgetr;   r<   r   r   r   r	   )r)   r   r2   r#   r>   r*   s        r   r(   zAPIStatusError.__init__E   s    ("2>>> #/"*..|<<	4== 	LHHW%%Eu~~ L y$!769J9JKK				L 	LL Lr   )r   r   r2   r1   r#   r"   r$   r%   )r   r   r   __doc__r,   r(   r-   r.   s   @r   r:   r:   =   s         FF
L 
L 
L 
L 
L 
L 
L 
L 
L 
Lr   r:   c                  &     e Zd Zddd
 fd	Z xZS )APIConnectionErrorzConnection error.r5   r   r   r!   r    r$   r%   c               P    t                                          ||d            d S )Nr8   r'   r(   )r)   r   r!   r*   s      r   r(   zAPIConnectionError.__init__S   s(    '55555r   )r   r   r!   r    r$   r%   r   r   r   r(   r-   r.   s   @r   rC   rC   R   sJ        )< 6 6 6 6 6 6 6 6 6 6 6 6r   rC   c                        e Zd Zd fdZ xZS )APITimeoutErrorr!   r    r$   r%   c                N    t                                          d|           d S )NzRequest timed out or interrupted. This could be due to a network timeout, dropped connection, or request cancellation. See https://docs.anthropic.com/en/api/errors#long-requests for more details.)r   r!   rE   )r)   r!   r*   s     r   r(   zAPITimeoutError.__init__X   s7     Z 	 	
 	
 	
 	
 	
r   )r!   r    r$   r%   rF   r.   s   @r   rH   rH   W   s=        
 
 
 
 
 
 
 
 
 
r   rH   c                      e Zd ZU dZded<   dS )r
   i  zLiteral[400]r4   Nr   r   r   r4   r,   r   r   r   r
   r
   _   #          #K######r   r
   c                      e Zd ZU dZded<   dS )r   i  zLiteral[401]r4   NrK   r   r   r   r   r   c   rL   r   r   c                      e Zd ZU dZded<   dS )r   i  zLiteral[403]r4   NrK   r   r   r   r   r   g   rL   r   r   c                      e Zd ZU dZded<   dS )r   i  zLiteral[404]r4   NrK   r   r   r   r   r   k   rL   r   r   c                      e Zd ZU dZded<   dS )r   i  zLiteral[409]r4   NrK   r   r   r   r   r   o   rL   r   r   c                      e Zd ZU dZded<   dS )RequestTooLargeErrori  zLiteral[413]r4   NrK   r   r   r   rR   rR   s   rL   r   rR   c                      e Zd ZU dZded<   dS )r   i  zLiteral[422]r4   NrK   r   r   r   r   r   w   rL   r   r   c                      e Zd ZU dZded<   dS )r   i  zLiteral[429]r4   NrK   r   r   r   r   r   {   rL   r   r   c                      e Zd ZU dZded<   dS )ServiceUnavailableErrori  zLiteral[503]r4   NrK   r   r   r   rV   rV      rL   r   rV   c                      e Zd ZU dZded<   dS )OverloadedErrori  zLiteral[529]r4   NrK   r   r   r   rX   rX      rL   r   rX   c                      e Zd ZU dZded<   dS )DeadlineExceededErrori  zLiteral[504]r4   NrK   r   r   r   rZ   rZ      rL   r   rZ   c                      e Zd ZdS )r   Nr   r   r   r   r   r      r   r   r   ) 
__future__r   typingr   r   typing_extensionsr   httpx_utilsr   types.shared.error_typer	   __all__	Exceptionr   r   r0   r:   rC   rH   r
   r   r   r   r   rR   r   r   rV   rX   rZ   r   r   r   r   <module>rd      s   # " " " " "         % % % % % %        . . . . . .	 	 		 	 	 	 	Y 	 	 	    ~   ,0 0 0 0 0 0 0 0L L L L LX L L L*6 6 6 6 6 6 6 6

 
 
 
 
( 
 
 
$ $ $ $ $n $ $ $$ $ $ $ $. $ $ $$ $ $ $ $N $ $ $$ $ $ $ $N $ $ $$ $ $ $ $N $ $ $$ $ $ $ $> $ $ $$ $ $ $ $~ $ $ $$ $ $ $ $^ $ $ $$ $ $ $ $n $ $ $$ $ $ $ $n $ $ $$ $ $ $ $N $ $ $	 	 	 	 	. 	 	 	 	 	r   