o
    Nrf                     @   sf  d dl Z edd dD ZG dd deZdd ZG d	d
 d
e jj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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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S )/    Nc                 c   s    | ]}|  V  qd S N)lower.0fragment r   V/var/www/html/software/conda/envs/catlas/lib/python3.10/site-packages/docker/errors.py	<genexpr>   s    
r	   )zno such imagez+not found: does not exist or no pull accesszrepository does not existz3was found but does not match the specified platformc                   @   s   e Zd ZdZdS )DockerExceptionz
    A base class from which all other exceptions inherit.

    If you want to catch all errors that the Docker SDK might raise,
    catch this base exception.
    N)__name__
__module____qualname____doc__r   r   r   r   r
      s    r
   c                    s   | j }z| d }W n ty   |jpd }Y nw t}|jdkr9|p&d  t fddt	D r7t
}nt}|| ||d| )zH
    Create a suitable APIError from requests.exceptions.HTTPError.
    message i  c                 3   s    | ]}| v V  qd S r   r   r   Zexplanation_msgr   r   r	   "   s    z7create_api_error_from_http_exception.<locals>.<genexpr>)responseexplanation)r   json
ValueErrortextstripAPIErrorstatus_coder   any&_image_not_found_explanation_fragmentsImageNotFoundNotFound)er   r   clsr   r   r   $create_api_error_from_http_exception   s   
r    c                       sR   e Zd ZdZd fdd	Z fddZedd Zd	d
 Zdd Z	dd Z
  ZS )r   z%
    An HTTP error from the API.
    Nc                    s   t  | || _|| _d S r   )super__init__r   r   )selfr   r   r   	__class__r   r   r"   .   s   
zAPIError.__init__c                    sx   t   }|  r| jj d| jj d| jj }n|  r.| jj d| jj d| jj }| jr:| d| j d}|S )Nz Client Error for : z Server Error for z ("z"))	r!   __str__is_client_errorr   r   urlreasonis_server_errorr   )r#   r   r$   r   r   r'   5   s$   


zAPIError.__str__c                 C   s   | j d ur	| j jS d S r   )r   r   r#   r   r   r   r   I   s   
zAPIError.status_codec                 C   s   |   p|  S r   )r(   r+   r,   r   r   r   is_errorN   s   zAPIError.is_errorc                 C   (   | j d u rdS d| j   kodk S   S )NFi    r   r,   r   r   r   r(   Q      
zAPIError.is_client_errorc                 C   r.   )NFr/   iX  r0   r,   r   r   r   r+   V   r1   zAPIError.is_server_error)NN)r   r   r   r   r"   r'   propertyr   r-   r(   r+   __classcell__r   r   r$   r   r   *   s    
r   c                   @      e Zd ZdS )r   Nr   r   r   r   r   r   r   r   \       r   c                   @   r4   )r   Nr5   r   r   r   r   r   `   r6   r   c                   @   r4   )InvalidVersionNr5   r   r   r   r   r7   d   r6   r7   c                   @   r4   )InvalidRepositoryNr5   r   r   r   r   r8   h   r6   r8   c                   @   r4   )InvalidConfigFileNr5   r   r   r   r   r9   l   r6   r9   c                   @   r4   )InvalidArgumentNr5   r   r   r   r   r:   p   r6   r:   c                   @   r4   )DeprecatedMethodNr5   r   r   r   r   r;   t   r6   r;   c                   @      e Zd Zdd Zdd ZdS )TLSParameterErrorc                 C   
   || _ d S r   msgr#   r@   r   r   r   r"   y      
zTLSParameterError.__init__c                 C   s
   | j d S )Nz. TLS configurations should map the Docker CLI client configurations. See https://docs.docker.com/engine/articles/https/ for API details.r?   r,   r   r   r   r'   |   rB   zTLSParameterError.__str__Nr   r   r   r"   r'   r   r   r   r   r=   x       r=   c                   @   r4   )NullResourceNr5   r   r   r   r   rE      r6   rE   c                       s    e Zd ZdZ fddZ  ZS )ContainerErrorzK
    Represents a container that has exited with a non-zero exit code.
    c              	      sZ   || _ || _|| _|| _|| _|d urd| nd}t d| d| d| |  d S )Nr&   r   z	Command 'z' in image 'z ' returned non-zero exit status )	containerexit_statuscommandimagestderrr!   r"   )r#   rG   rH   rI   rJ   rK   errr$   r   r   r"      s   zContainerError.__init__)r   r   r   r   r"   r3   r   r   r$   r   rF      s    rF   c                   @   s   e Zd Zdd ZdS )StreamParseErrorc                 C   r>   r   r?   )r#   r*   r   r   r   r"      rB   zStreamParseError.__init__N)r   r   r   r"   r   r   r   r   rM      s    rM   c                       s   e Zd Z fddZ  ZS )
BuildErrorc                    s   t  | || _|| _d S r   )r!   r"   r@   	build_log)r#   r*   rO   r$   r   r   r"      s   
zBuildError.__init__)r   r   r   r"   r3   r   r   r$   r   rN      s    rN   c                   @   r4   )ImageLoadErrorNr5   r   r   r   r   rP      r6   rP   c                 C   s^   dd t |D }|  dg}t|dkr|d n|d |d| td|S )	Nc                 S   s   g | ]}d | d qS )'r   )r   kr   r   r   
<listcomp>   s    z2create_unexpected_kwargs_error.<locals>.<listcomp>z()    z#got an unexpected keyword argument z!got unexpected keyword arguments z, r   )sortedlenappendjoin	TypeError)namekwargsZquoted_kwargsr   r   r   r   create_unexpected_kwargs_error   s   
r\   c                   @   r<   )MissingContextParameterc                 C   r>   r   param)r#   r_   r   r   r   r"      rB   z MissingContextParameter.__init__c                 C   s   d| j  S )Nzmissing parameter: r^   r,   r   r   r   r'      s   zMissingContextParameter.__str__NrC   r   r   r   r   r]      rD   r]   c                   @   r<   )ContextAlreadyExistsc                 C   r>   r   rZ   r#   rZ   r   r   r   r"      rB   zContextAlreadyExists.__init__c                 C      d| j  dS )Nzcontext z already existsra   r,   r   r   r   r'         zContextAlreadyExists.__str__NrC   r   r   r   r   r`      rD   r`   c                   @   r<   )ContextExceptionc                 C   r>   r   r?   rA   r   r   r   r"      rB   zContextException.__init__c                 C   s   | j S r   r?   r,   r   r   r   r'      s   zContextException.__str__NrC   r   r   r   r   re      rD   re   c                   @   r<   )ContextNotFoundc                 C   r>   r   ra   rb   r   r   r   r"      rB   zContextNotFound.__init__c                 C   rc   )Nz	context 'z' not foundra   r,   r   r   r   r'      rd   zContextNotFound.__str__NrC   r   r   r   r   rf      rD   rf   )requests	frozensetr   	Exceptionr
   r    
exceptions	HTTPErrorr   r   r   r7   r8   r9   r:   r;   r=   r   rE   rF   RuntimeErrorrM   rN   rP   r\   r]   r`   re   rf   r   r   r   r   <module>   s2    
	2