o
    Uh&                     @   s`  d Z ddl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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S )-z8Dulwich-related exception classes and utility functions.    Nc                   @   s   e Zd ZdZddddZdS )ChecksumMismatchz.A checksum didn't match the expected contents.Nreturnc              	   C   s   t |dkrt|}t |dkrt|}|| _|| _|| _| jd u r2t| d| d|  d S t| d| d| d|  d S )N   zChecksum mismatch: Expected z, got z; )lenbinasciihexlifyexpectedgotextra	Exception__init__)selfr   r	   r
    r   b/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/dulwich/errors.pyr   #   s    


zChecksumMismatch.__init__Nr   N__name__
__module____qualname____doc__r   r   r   r   r   r       s    r   c                   @   s$   e Zd ZU dZeed< dddZdS )WrongObjectExceptionzBaseclass for all the _ is not a _ exceptions on objects.

    Do not instantiate directly.

    Subclasses should define a type_name attribute that indicates what
    was expected if they were raised.
    	type_namer   Nc                 O   s   t | | d| j  d S )Nz
 is not a )r   r   r   r   shaargskwargsr   r   r   r   B      zWrongObjectException.__init__r   )r   r   r   r   str__annotations__r   r   r   r   r   r   7   s   
 r   c                   @      e Zd ZdZdZdS )NotCommitErrorz<Indicates that the sha requested does not point to a commit.commitNr   r   r   r   r   r   r   r   r   r!   F       r!   c                   @   r    )NotTreeErrorz:Indicates that the sha requested does not point to a tree.treeNr#   r   r   r   r   r%   L   r$   r%   c                   @   r    )NotTagErrorz9Indicates that the sha requested does not point to a tag.tagNr#   r   r   r   r   r'   R   r$   r'   c                   @   r    )NotBlobErrorz:Indicates that the sha requested does not point to a blob.blobNr#   r   r   r   r   r)   X   r$   r)   c                   @      e Zd ZdZdddZdS )MissingCommitErrorz8Indicates that a commit was not found in the repository.r   Nc                 O   s   || _ t| | d d S )Nz is not in the revision store)r   r   r   r   r   r   r   r   a   s   zMissingCommitError.__init__r   r   r   r   r   r   r,   ^       r,   c                   @   r+   )ObjectMissingz-Indicates that a requested object is missing.r   Nc                 O   s   t | | d d S )Nz is not in the packr   r   r   r   r   r   r   i   s   zObjectMissing.__init__r   r   r   r   r   r   r.   f   r-   r.   c                   @   r+   )ApplyDeltaErrorz'Indicates that applying a delta failed.r   Nc                 O      t j| g|R i | d S r   r/   r   r   r   r   r   r   r   p   r   zApplyDeltaError.__init__r   r   r   r   r   r   r0   m   r-   r0   c                   @   r+   )NotGitRepositoryz+Indicates that no Git repository was found.r   Nc                 O   r1   r   r/   r2   r   r   r   r   w   r   zNotGitRepository.__init__r   r   r   r   r   r   r3   t   r-   r3   c                   @   s"   e Zd ZdZdddZdd ZdS )	GitProtocolErrorzGit protocol exception.r   Nc                 O   r1   r   r/   r2   r   r   r   r   ~   r   zGitProtocolError.__init__c                 C      t | t|o| j|jkS r   )
isinstancetyper   r   otherr   r   r   __eq__      zGitProtocolError.__eq__r   )r   r   r   r   r   r:   r   r   r   r   r4   {   s    
r4   c                   @      e Zd ZdZdS )SendPackErrorz#An error occurred during send_pack.Nr   r   r   r   r   r   r   r   r=          r=   c                       s,   e Zd ZdZdd	 fddZdd Z  ZS )
HangupExceptionzHangup exception.Nr   c                    s8   |rt  ddd |D  nt  d || _d S )N
c                 S   s   g | ]}| d dqS )zutf-8surrogateescape)decode).0liner   r   r   
<listcomp>   s    z,HangupException.__init__.<locals>.<listcomp>z5The remote server unexpectedly closed the connection.)superr   joinstderr_lines)r   rI   	__class__r   r   r      s   
zHangupException.__init__c                 C   r5   r   )r6   r7   rI   r8   r   r   r   r:      r;   zHangupException.__eq__r   r   )r   r   r   r   r   r:   __classcell__r   r   rJ   r   r@      s    r@   c                       s"   e Zd ZdZd fddZ  ZS )UnexpectedCommandErrorz,Unexpected command received in a proto line.r   Nc                    s.   |d u rd}nd| }t  d|  d S )Nz	flush-pktzcommand zProtocol got unexpected )rG   r   )r   commandrJ   r   r   r      s   
zUnexpectedCommandError.__init__r   )r   r   r   r   r   rL   r   r   rJ   r   rM      s    rM   c                   @   r<   )FileFormatExceptionz?Base class for exceptions relating to reading git file formats.Nr>   r   r   r   r   rO      r?   rO   c                   @   r<   )PackedRefsExceptionz.Indicates an error parsing a packed-refs file.Nr>   r   r   r   r   rP      r?   rP   c                   @   r<   )ObjectFormatExceptionz%Indicates an error parsing an object.Nr>   r   r   r   r   rQ      r?   rQ   c                   @   r<   )NoIndexPresentzNo index is present.Nr>   r   r   r   r   rR      r?   rR   c                   @   r<   )CommitErrorz,An error occurred while performing a commit.Nr>   r   r   r   r   rS      r?   rS   c                   @   r<   )RefFormatErrorzIndicates an invalid ref name.Nr>   r   r   r   r   rT      r?   rT   c                   @   r<   )	HookErrorz)An error occurred while executing a hook.Nr>   r   r   r   r   rU      r?   rU   )r   r   r   r   r   r!   r%   r'   r)   r,   r.   r0   r3   r4   r=   r@   rM   rO   rP   rQ   rR   rS   rT   rU   r   r   r   r   <module>   s.   
