
    i4                       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y)-    )annotations)Unioncast)LiteralN   )is_dict)	ErrorType)BadRequestErrorAuthenticationErrorPermissionDeniedErrorNotFoundErrorConflictErrorUnprocessableEntityErrorRateLimitErrorInternalServerErrorc                      e Zd Zy)AnthropicErrorN__name__
__module____qualname__     N/home/work/apex_v16/venv/lib/python3.12/site-packages/anthropic/_exceptions.pyr   r          r   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bodyc               N    t         |   |       || _        || _        || _        y )N)super__init__r!   r   r#   )selfr   r!   r#   	__class__s       r   r&   zAPIError.__init__,   s%    !	r   )r   r   r!   r    r#   r"   returnNoner   r   r   __annotations__r&   __classcell__r(   s   @r   r   r      s#    L
 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   c               v    t         |   |xs d|j                  |       || _        |j                  | _        y )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   s:    W$WYaYiYiptu #//r   )r2   r1   r#   r"   r   
str | Noner)   r*   r+   r.   s   @r   r0   r0   3   s    _c 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   r8   
request_idzErrorType | Nonetypec               h   t         |   ||j                  |       || _        |j                  | _        |j
                  j                  d      | _        d | _        t        |      rK|j                  d      }t        |      r.t        t        t        d f   |j                  d            | _        y y y )Nr7   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"2> #//"**..|<	4=HHW%Eu~ y$!769JK	  r   )r   r   r2   r1   r#   r"   r)   r*   )r   r   r   __doc__r,   r&   r-   r.   s   @r   r:   r:   =   s*    F

L 
Lr   r:   c                  &     e Zd Zddd fdZ xZS )APIConnectionErrorzConnection error.r5   c               *    t         |   ||d        y )Nr7   r%   r&   )r'   r   r!   r(   s      r   r&   zAPIConnectionError.__init__S   s    '5r   )r   r   r!   r    r)   r*   r   r   r   r&   r-   r.   s   @r   rC   rC   R   s    )< 6 6r   rC   c                        e Zd Zd fdZ xZS )APITimeoutErrorc                (    t         |   d|       y )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   s     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<   y)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<   y)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<   y)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<   y)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<   y)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<   y)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<   y)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<   y)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<   y)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<   y)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<   y)DeadlineExceededErrori  zLiteral[504]r4   NrK   r   r   r   rZ   rZ      rL   r   rZ   c                      e Zd Zy)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LX L*6 6

( 
$n $$. $$N $$N $$N $$> $$~ $$^ $$n $$n $$N $	. 	r   