
    !j(                       d Z ddlmZmZ ddlmZmZ ddlmZ	 	 ddl
mZ n# e$ r	 ddl
mZ Y nw xY wddlmZ  G d	 d
e          Z G d de          Z G d de          Z edd          Z G d de          Z G d de          ZdS )z
minio.error
~~~~~~~~~~~~~~~~~~~

This module provides custom exception classes for MinIO library
and API specific errors.

:copyright: (c) 2015, 2016, 2017 by MinIO, Inc.
:license: Apache 2.0, see LICENSE for more details.

    )absolute_importannotations)TypeTypeVar)ElementTree)BaseHTTPResponse)HTTPResponse   )findtextc                      e Zd ZdZdS )MinioExceptionzBase Minio exception.N)__name__
__module____qualname____doc__     U/lsinfo/ai/hellotax_ai/base_platform/venv/lib/python3.11/site-packages/minio/error.pyr   r   ,   s        r   r   c                  *     e Zd ZdZd	 fdZd Z xZS )
InvalidResponseErrorz5Raised to indicate that non-xml response from server.codeintcontent_type
str | Nonebodyc                    || _         || _        || _        t                                          d| d| d|            d S )Nz-non-XML response from server; Response code: z, Content-Type: , Body: )_code_content_type_bodysuper__init__)selfr   r   r   	__class__s       r   r"   zInvalidResponseError.__init__3   sj    
)
:D : :): :37: :	
 	
 	
 	
 	
r   c                H    t          |           | j        | j        | j        ffS N)typer   r   r    r#   s    r   
__reduce__zInvalidResponseError.__reduce__<   s!    DzzDJ(:DJGGGr   )r   r   r   r   r   r   r   r   r   r   r"   r)   __classcell__r$   s   @r   r   r   0   sY        ??
 
 
 
 
 
H H H H H H Hr   r   c                  <     e Zd ZdZd	 fdZed
d            Z xZS )ServerErrorz?Raised to indicate that S3 service returning HTTP server error.messagestrstatus_coder   c                X    || _         t                                          |           d S r&   )_status_coder!   r"   )r#   r/   r1   r$   s      r   r"   zServerError.__init__C   s)    '!!!!!r   returnc                    | j         S )zGet HTTP status code.)r3   r(   s    r   r1   zServerError.status_codeG   s       r   )r/   r0   r1   r   )r4   r   )r   r   r   r   r"   propertyr1   r+   r,   s   @r   r.   r.   @   sc        II" " " " " " ! ! ! X! ! ! ! !r   r.   AS3Error)boundc                       e Zd ZdZ	 	 dd fdZd Zedd            Zedd            Zedd            Z	e
dd            ZddZ xZS )r8   z]
    Raised to indicate that error response is received
    when executing S3 operation.
    Nr   r   r/   resource
request_idhost_idresponser   bucket_nameobject_namec	                ,   || _         || _        || _        || _        || _        || _        || _        || _        | j        r
d| j        z   nd}	| j        r
d| j        z   nd}
t                      	                    d| d| d| d| d| |	 |
            d S )	Nz, bucket_name:  z, object_name: zS3 operation failed; code: z, message: z, resource: z, request_id: z, host_id: )
r   _message	_resource_request_id_host_id	_response_bucket_name_object_namer!   r"   )r#   r   r/   r;   r<   r=   r>   r?   r@   bucket_messageobject_messager$   s              r   r"   zS3Error.__init__V   s    
!%!''  )!222&( 	  )!222&( 	 	B$ B B7 B B!B B1;B BB!/B1?B B	
 	
 	
 	
 	
r   c           	         t          |           | j        | j        | j        | j        | j        | j        | j        | j        ffS r&   )	r'   r   rC   rD   rE   rF   rG   rH   rI   r(   s    r   r)   zS3Error.__reduce__x   sB    DzzDJt~ ,dmT^ -t/@B B 	Br   r4   c                    | j         S )zGet S3 error code.)r   r(   s    r   r   zS3Error.code}   s     zr   c                    | j         S )zGet S3 error message.)rC   r(   s    r   r/   zS3Error.message   s     }r   c                    | j         S )zGet HTTP response.)rG   r(   s    r   r>   zS3Error.response   s     ~r   clsType[A]r7   c                B   t          j        |j                                                  } | t	          |d          t	          |d          t	          |d          t	          |d          t	          |d          t	          |d          t	          |d          |          S )	z/Create new object with values from XML element.CodeMessageResource	RequestIdHostId
BucketNameKey)r?   r@   r>   )ET
fromstringdatadecoder   )rP   r>   elements      r   fromxmlzS3Error.fromxml   s     - 4 4 6 677sWf%%Wi((Wj))Wk**Wh'' ,77 %00	
 	
 	
 		
r   r0   c           
     j    t          ||| j        | j        | j        | j        | j        | j                  S )z*Make a copy with replace code and message.)r8   rD   rE   rF   rG   rH   rI   )r#   r   r/   s      r   copyzS3Error.copy   s;    NMN	
 	
 		
r   )NN)r   r   r/   r   r;   r   r<   r   r=   r   r>   r   r?   r   r@   r   )r4   r   )r4   r   )rP   rQ   r>   r   r4   r7   )r   r0   r/   r0   r4   r8   )r   r   r   r   r"   r)   r6   r   r/   r>   classmethodr_   ra   r+   r,   s   @r   r8   r8   P   s          '+&* 
  
  
  
  
  
  
DB B B
    X    X    X 
 
 
 [

 
 
 
 
 
 
 
r   c                  *     e Zd ZdZd fdZd Z xZS )MinioAdminExceptionz-Raised to indicate admin API execution error.r   r0   r   c                r    || _         || _        t                                          d| d|            d S )Nzadmin request failed; Status: r   )r   r    r!   r"   )r#   r   r   r$   s      r   r"   zMinioAdminException.__init__   sJ    

ATAA4AA	
 	
 	
 	
 	
r   c                <    t          |           | j        | j        ffS r&   )r'   r   r    r(   s    r   r)   zMinioAdminException.__reduce__   s    DzzDJ
333r   )r   r0   r   r0   r*   r,   s   @r   rd   rd      sR        77
 
 
 
 
 
4 4 4 4 4 4 4r   rd   N)r   
__future__r   r   typingr   r   	xml.etreer   rZ   urllib3.responser   ImportErrorr	   xmlr   	Exceptionr   r   r.   r7   r8   rd   r   r   r   <module>rn      s  &
 
 4 3 3 3 3 3 3 3                 ' ' ' ' ' 'B1111111 B B BAAAAAAAAB               Y      H H H H H> H H H 
! 
! 
! 
! 
!. 
! 
! 
! GCy!!!V
 V
 V
 V
 V
n V
 V
 V
r4 4 4 4 4) 4 4 4 4 4s   ! //