
    d                      ^   d Z ddl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 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 )-z8Dulwich-related exception classes and utility functions.    Nc                       e Zd ZdZddZdS )ChecksumMismatchz.A checksum didn't match the expected contents.Nc                    t          |          dk    rt          j        |          }t          |          dk    rt          j        |          }|| _        || _        || _        | j        1t                              | d                    ||                     d S t                              | d                    |||                     d S )N   z&Checksum mismatch: Expected {}, got {}z*Checksum mismatch: Expected {}, got {}; {})	lenbinasciihexlifyexpectedgotextra	Exception__init__format)selfr
   r   r   s       R/home/feoh/.local/pipx/venvs/poetry/lib/python3.11/site-packages/dulwich/errors.pyr   zChecksumMismatch.__init__#   s    x==B'11Hs88r>>"3''C 
:8??#NN    
 <CCHcSXYY        N__name__
__module____qualname____doc__r    r   r   r   r       s.        88     r   r   c                   $    e Zd ZU dZee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_namec                 n    t                               | d                    || j                             d S )Nz{} is not a {})r   r   r   r   r   shaargskwargss       r   r   zWrongObjectException.__init__B   s1    4!1!8!8dn!M!MNNNNNr   N)r   r   r   r   str__annotations__r   r   r   r   r   r   7   s?           NNNO O O O Or   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   s        FFIIIr   r%   c                       e Zd ZdZdZdS )NotTreeErrorz:Indicates that the sha requested does not point to a tree.treeNr'   r   r   r   r)   r)   L           DDIIIr   r)   c                       e Zd ZdZdZdS )NotTagErrorz9Indicates that the sha requested does not point to a tag.tagNr'   r   r   r   r-   r-   R   s        CCIIIr   r-   c                       e Zd ZdZdZdS )NotBlobErrorz:Indicates that the sha requested does not point to a blob.blobNr'   r   r   r   r0   r0   X   r+   r   r0   c                       e Zd ZdZd ZdS )MissingCommitErrorz7Indicates that a commit was not found in the repositoryc                 P    || _         t                              | d|z             d S )Nz%s is not in the revision store)r   r   r   r   s       r   r   zMissingCommitError.__init__a   s+    4!BS!HIIIIIr   Nr   r   r   r   r3   r3   ^   s.        AAJ J J J Jr   r3   c                       e Zd ZdZd ZdS )ObjectMissingz-Indicates that a requested object is missing.c                 B    t                               | d|z             d S )Nz%s is not in the packr   r   r   s       r   r   zObjectMissing.__init__i   s$    4!83!>?????r   Nr   r   r   r   r6   r6   f   s.        77@ @ @ @ @r   r6   c                       e Zd ZdZd ZdS )ApplyDeltaErrorz'Indicates that applying a delta failed.c                 0    t          j        | g|R i | d S r   r8   r   r    r!   s      r   r   zApplyDeltaError.__init__p   )    41$111&11111r   Nr   r   r   r   r:   r:   m   s)        112 2 2 2 2r   r:   c                       e Zd ZdZd ZdS )NotGitRepositoryz+Indicates that no Git repository was found.c                 0    t          j        | g|R i | d S r   r8   r<   s      r   r   zNotGitRepository.__init__w   r=   r   Nr   r   r   r   r?   r?   t   s)        552 2 2 2 2r   r?   c                       e Zd ZdZd Zd ZdS )GitProtocolErrorzGit protocol exception.c                 0    t          j        | g|R i | d S r   r8   r<   s      r   r   zGitProtocolError.__init__~   r=   r   c                 \    t          | t          |                    o| j        |j        k    S r   )
isinstancetyper    r   others     r   __eq__zGitProtocolError.__eq__   s&    $U,,Hej1HHr   N)r   r   r   r   r   rI   r   r   r   rB   rB   {   s=        !!2 2 2I I I I Ir   rB   c                       e Zd ZdZdS )SendPackErrorz#An error occurred during send_pack.Nr   r   r   r   r   r   r   rK   rK      s        ----r   rK   c                   *     e Zd ZdZd fd	Zd Z xZS )HangupExceptionzHangup exception.Nc                     |r?t                                          d                    d |D                                  n!t                                          d           || _        d S )N
c                 :    g | ]}|                     d d          S )zutf-8surrogateescape)decode).0lines     r   
<listcomp>z,HangupException.__init__.<locals>.<listcomp>   s'    VVVT[[*;<<VVVr   z5The remote server unexpectedly closed the connection.)superr   joinstderr_lines)r   rY   	__class__s     r   r   zHangupException.__init__   s     		GG		VVVVV     GGG   )r   c                 \    t          | t          |                    o| j        |j        k    S r   )rE   rF   rY   rG   s     r   rI   zHangupException.__eq__   s(    $U,,X1BeFX1XXr   r   )r   r   r   r   r   rI   __classcell__rZ   s   @r   rN   rN      sY        ) ) ) ) ) )Y Y Y Y Y Y Yr   rN   c                   "     e Zd ZdZ fdZ xZS )UnexpectedCommandErrorz,Unexpected command received in a proto line.c                 d    |d}nd|z  }t                                          d|z             d S )Nz	flush-pktz
command %szProtocol got unexpected %s)rW   r   )r   commandrZ   s     r   r   zUnexpectedCommandError.__init__   sG    ?!GG"W,G(72	
 	
 	
 	
 	
r   )r   r   r   r   r   r\   r]   s   @r   r_   r_      s>        66
 
 
 
 
 
 
 
 
r   r_   c                       e Zd ZdZdS )FileFormatExceptionz?Base class for exceptions relating to reading git file formats.NrL   r   r   r   rc   rc      s        IIIIr   rc   c                       e Zd ZdZdS )PackedRefsExceptionz.Indicates an error parsing a packed-refs file.NrL   r   r   r   re   re      s        8888r   re   c                       e Zd ZdZdS )ObjectFormatExceptionz%Indicates an error parsing an object.NrL   r   r   r   rg   rg      s        ////r   rg   c                       e Zd ZdZdS )NoIndexPresentzNo index is present.NrL   r   r   r   ri   ri      s        r   ri   c                       e Zd ZdZdS )CommitErrorz,An error occurred while performing a commit.NrL   r   r   r   rk   rk      s        6666r   rk   c                       e Zd ZdZdS )RefFormatErrorzIndicates an invalid ref name.NrL   r   r   r   rm   rm      s        ((((r   rm   c                       e Zd ZdZdS )	HookErrorz)An error occurred while executing a hook.NrL   r   r   r   ro   ro      s        3333r   ro   )r   r   r   r   r   r%   r)   r-   r0   r3   r6   r:   r?   rB   rK   rN   r_   rc   re   rg   ri   rk   rm   ro   r   r   r   <module>rp      s  , ? >     y   .O O O O O9 O O O    )       '       &       '   J J J J J J J J@ @ @ @ @I @ @ @2 2 2 2 2i 2 2 22 2 2 2 2y 2 2 2I I I I Iy I I I. . . . .$ . . .Y Y Y Y Y& Y Y Y(

 

 

 

 

- 

 

 

J J J J J) J J J9 9 9 9 9- 9 9 90 0 0 0 0/ 0 0 0    Y   7 7 7 7 7) 7 7 7) ) ) ) )Y ) ) )4 4 4 4 4	 4 4 4 4 4r   