o
    ¹3ÇO¢  ã                   @   sü   d Z eZg d¢ZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd	„ d	eƒZG d
d„ deƒZ	G dd„ deƒZ
G dd„ de
ƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ de
ƒZdd„ Zd S )!zlazr.restfulclient errors.)Ú
BadRequestÚConflictÚClientErrorÚCredentialsErrorÚCredentialsFileErrorÚ	HTTPErrorÚMethodNotAllowedÚNotFoundÚPreconditionFailedÚRestfulErrorÚResponseErrorÚServerErrorÚUnauthorizedÚUnexpectedResponseErrorc                   @   ó   e Zd ZdZdS )r
   z2Base error for the lazr.restfulclient API library.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r   r   ú;/usr/lib/python3/dist-packages/lazr/restfulclient/errors.pyr
   (   ó    r
   c                   @   r   )r   z&Base credentials/authentication error.Nr   r   r   r   r   r   ,   r   r   c                   @   r   )r   zError in credentials file.Nr   r   r   r   r   r   0   r   r   c                   @   ó   e Zd ZdZdd„ ZdS )r   zError in response.c                 C   s   t  | ¡ || _|| _d S )N)r
   Ú__init__ÚresponseÚcontent)Úselfr   r   r   r   r   r   7   s   

zResponseError.__init__N)r   r   r   r   r   r   r   r   r   r   4   ó    r   c                   @   r   )r   z$An unexpected response was received.c                 C   s   d| j j| j jf S )Nú%s: %s)r   ÚstatusÚreason)r   r   r   r   Ú__str__@   s   zUnexpectedResponseError.__str__N©r   r   r   r   r!   r   r   r   r   r   =   r   r   c                   @   r   )r   z+An HTTP non-2xx response code was received.c                 C   s8   d  dd„ t| j ¡ ƒD ƒ¡}d| jj| jj|| jf S )z9Show the error code, response headers, and response body.Ú
c                 S   s   g | ]}d | ‘qS )r   r   )Ú.0Úpairr   r   r   Ú
<listcomp>I   s    ÿz%HTTPError.__str__.<locals>.<listcomp>zIHTTP Error %s: %s
Response headers:
---
%s
---
Response body:
---
%s
---
)ÚjoinÚsortedr   Úitemsr   r    r   )r   Úheadersr   r   r   r!   G   s   
ÿÿþzHTTPError.__str__Nr"   r   r   r   r   r   D   r   r   c                   @   r   )r   z.An exception representing a client-side error.Nr   r   r   r   r   r   Q   r   r   c                   @   r   )r   z4An exception representing an authentication failure.Nr   r   r   r   r   r   U   r   r   c                   @   r   )r   z1An exception representing a nonexistent resource.Nr   r   r   r   r   r   Y   r   r   c                   @   r   )r   zœAn exception raised when you use an unsupported HTTP method.

    This is most likely because you tried to delete a resource that
    can't be deleted.
    Nr   r   r   r   r   r   ]   r   r   c                   @   r   )r   z:An exception representing a problem with a client request.Nr   r   r   r   r   r   e   r   r   c                   @   r   )r   z9An exception representing a conflict with another client.Nr   r   r   r   r   r   i   r   r   c                   @   r   )r	   zëAn exception representing the failure of a conditional PUT/PATCH.

    The most likely explanation is that another client changed this
    object while you were working on it, and your version of the
    object is now out of date.
    Nr   r   r   r   r   r	   m   r   r	   c                   @   r   )r   z.An exception representing a server-side error.Nr   r   r   r   r   r   u   r   r   c                 C   sj   t tttttdœ}| jd dkrdS | | jt¡}|tu r0| jd dkr't	}n	| jd dkr0t
}|| |ƒS )zäTurn an HTTP response into an HTTPError subclass.

    :return: None if the response code is 1xx, 2xx or 3xx. Otherwise,
    an instance of an appropriate HTTPError subclass (or HTTPError
    if nothing else is appropriate.
    )i�  i‘  i”  i•  i™  iœ  éd   é   Né   é   )r   r   r   r   r   r	   r   Úgetr   r   r   )r   r   Úhttp_errors_by_status_codeÚclsr   r   r   Ú	error_fory   s    ú	
r2   N)r   ÚtypeÚ__metaclass__Ú__all__Ú	Exceptionr
   r   r   r   r   r   r   r   r   r   r   r   r	   r   r2   r   r   r   r   Ú<module>   s$   	