
    hT                        d Z ddlmZ dZddlZddlm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 )"z_Errors for the library.

All exceptions defined by the library
should be defined in this file.
    )absolute_importz$jcgregorio@google.com (Joe Gregorio)N)_helpersc                       e Zd ZdZdS )ErrorzBase error for this module.N__name__
__module____qualname____doc__     |/home/visionen/pythonvenv/lib/python3.11/site-packages/google_api_python_client-2.181.0-py3.11.egg/googleapiclient/errors.pyr   r      s        %%Dr   r   c                   l    e Zd ZdZ ej        d          dd            Zed             Zd Z	d Z
e
ZdS )		HttpErrorz$HTTP data was invalid or unexpected.   Nc                     || _         t          |t                    st          d          || _        || _        d| _        |                                 | _        d S )NzHTTP content should be bytes )	resp
isinstancebytes	TypeErrorcontenturierror_details_get_reasonreason)selfr   r   r   s       r   __init__zHttpError.__init__&   sW    	'5)) 	<:;;;&&((r   c                     | j         j        S )z6Return the HTTP status code from the response content.)r   statusr   s    r   status_codezHttpError.status_code0   s     yr   c                    | j         j        }	 	 t          j        | j                            d                    n/# t          j        $ r | j                            d          Y nw xY wt          t                    r@d         d         }t          fddD             d          }|rd         |         | _
        nct          t                    rGt                    dk    r4d         }|d         d         }d|d         v r|d         d         | _
        n| _
        n# t          t          t          f$ r Y nw xY w|d}|                                S )	z=Calculate the reason for the error from the response content.zutf-8errormessagec              3   0   K   | ]}|d          v |V  dS )r$   Nr   ).0kwdatas     r   	<genexpr>z(HttpError._get_reason.<locals>.<genexpr>A   s>        g.. .... r   )detaildetailserrorsr%   r   r   r,   )r   r   jsonloadsr   decodeJSONDecodeErrorr   dictnextr   listlen
ValueErrorKeyErrorr   strip)r   r   error_detail_keywordfirst_errorr)   s       @r   r   zHttpError._get_reason5   s   !	4z$,"5"5g">">??' 4 4 4|**7334 $%% *gy1'+   "L  
 ( ($ ( M)-g7K)LD&D$'' *CIIMM"1g$W-i8G 444)4W)=i)HD&%)"Hi0 	 	 	D	>F||~~s-   ,= D% )A)&D% (A))B;D% %D?>D?c           	          | j         r(d| j        j        d| j        d| j        d| j         d	S | j        r d| j        j        d| j        d| j        dS d| j        j        d| j        dS )Nz<HttpError z when requesting z returned "z". Details: ""> ")r   r   r    r   r   r!   s    r   __repr__zHttpError.__repr__W   s     	K 	K	   """	  X 	K 	K	    	K -1I,<,<,<dkkkJJr   N)r   r	   r
   r   util
positionalr   propertyr"   r   r>   __str__r   r   r   r   r   #   s        ..T_Q) ) ) )     X      DK K K" GGGr   r   c                       e Zd ZdZdS )InvalidJsonErrorz&The JSON returned could not be parsed.Nr   r   r   r   rE   rE   k   s        00Dr   rE   c                       e Zd ZdZdS )UnknownFileTypez File type unknown or unexpected.Nr   r   r   r   rG   rG   q           **Dr   rG   c                       e Zd ZdZdS )UnknownLinkTypez Link type unknown or unexpected.Nr   r   r   r   rJ   rJ   w   rH   r   rJ   c                       e Zd ZdZdS )UnknownApiNameOrVersionz)No API with that name and version exists.Nr   r   r   r   rL   rL   }   s        33Dr   rL   c                       e Zd ZdZdS )UnacceptableMimeTypeErrorz4That is an unacceptable mimetype for this operation.Nr   r   r   r   rN   rN      s        >>Dr   rN   c                       e Zd ZdZdS )MediaUploadSizeErrorz+Media is larger than the method can accept.Nr   r   r   r   rP   rP      s        55Dr   rP   c                       e Zd ZdZdS )ResumableUploadErrorz'Error occurred during resumable upload.Nr   r   r   r   rR   rR      s        11Dr   rR   c                       e Zd ZdZdS )InvalidChunkSizeErrorz!The given chunksize is not valid.Nr   r   r   r   rT   rT      s        ++Dr   rT   c                       e Zd ZdZdS )InvalidNotificationErrorz$The channel Notification is invalid.Nr   r   r   r   rV   rV      s        ..Dr   rV   c                   P    e Zd ZdZ ej        d          dd            Zd ZeZdS )
BatchErrorz'Error occurred during batch operations.   Nc                 0    || _         || _        || _        d S r?   )r   r   r   )r   r   r   r   s       r   r   zBatchError.__init__   s    	r   c                 r    t          | j        dd           
d| j        z  S d| j        j        d| j        dS )Nr    z<BatchError "%s">z<BatchError r=   r<   )getattrr   r   r    r!   s    r   r>   zBatchError.__repr__   sF    49h--5&$+66 6 .2Y-=-=-=t{{{KKr   )NN)	r   r	   r
   r   r@   rA   r   r>   rC   r   r   r   rX   rX      sX        11T_Q   
L L L GGGr   rX   c                   P     e Zd ZdZ ej        d          d fd	            Z xZS )UnexpectedMethodErrorz;Exception raised by RequestMockBuilder on unexpected calls.   Nc                 ^    t          t          |                               d|z             dS ))Constructor for an UnexpectedMethodError.zReceived unexpected call %sN)superr^   r   )r   methodId	__class__s     r   r   zUnexpectedMethodError.__init__   s:     	#T**33)H4	
 	
 	
 	
 	
r   r?   )r   r	   r
   r   r@   rA   r   __classcell__rd   s   @r   r^   r^      sZ        EET_Q
 
 
 
 
 
 
 
 
 
r   r^   c                   "     e Zd ZdZ fdZ xZS )UnexpectedBodyErrorz<Exception raised by RequestMockBuilder on unexpected bodies.c                 f    t          t          |                               d|d|d           dS )ra   zExpected: [z] - Provided: []N)rb   rh   r   )r   expectedprovidedrd   s      r   r   zUnexpectedBodyError.__init__   sC    !4((11119888D	
 	
 	
 	
 	
r   )r   r	   r
   r   r   re   rf   s   @r   rh   rh      s>        FF
 
 
 
 
 
 
 
 
r   rh   )r   
__future__r   
__author__r.   googleapiclientr   r@   	Exceptionr   r   rE   rG   rJ   rL   rN   rP   rR   rT   rV   rX   r^   rh   r   r   r   <module>rq      s   
 ' & & & & &3
  , , , , , ,	 	 	 	 	I 	 	 	E E E E E E E EP	 	 	 	 	u 	 	 		 	 	 	 	e 	 	 		 	 	 	 	e 	 	 		 	 	 	 	e 	 	 		 	 	 	 	 	 	 		 	 	 	 	5 	 	 		 	 	 	 	9 	 	 		 	 	 	 	E 	 	 		 	 	 	 	u 	 	 	       $
 
 
 
 
E 
 
 

 
 
 
 
% 
 
 
 
 
r   