
    .Ph&                     ^   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dZdS )ChecksumMismatchz.A checksum didn't match the expected contents.Nreturnc           	      h   t          |          dk    rt          j        |          }t          |          dk    rt          j        |          }|| _        || _        || _        | j        #t                              | 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   s       N/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/dulwich/errors.pyr   zChecksumMismatch.__init__#   s    x==B'11Hs88r>>"3''C 
:DxDDsDD    
 MxMMsMMeMM        Nr   N__name__
__module____qualname____doc__r    r   r   r   r       s3        88      r   r   c                   &    e Zd ZU dZee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                 P    t                               | | d| j                    d S )Nz
 is not a )r   r   r   r   shaargskwargss       r   r   zWrongObjectException.__init__B   s.    4C!C!C4>!C!CDDDDDr   r   )r   r   r   r   str__annotations__r   r   r   r   r   r   7   sE           NNNE E E E E E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   r1   r1   X   r,   r   r1   c                       e Zd ZdZddZdS )MissingCommitErrorz8Indicates that a commit was not found in the repository.r   Nc                 P    || _         t                              | | d           d S )Nz is not in the revision store)r    r   r   r   s       r   r   zMissingCommitError.__init__a   s.    4C!F!F!FGGGGGr   r   r   r   r   r   r4   r4   ^   s4        BBH H H H H Hr   r4   c                       e Zd ZdZddZdS )ObjectMissingz-Indicates that a requested object is missing.r   Nc                 B    t                               | | d           d S )Nz is not in the packr   r   r   s       r   r   zObjectMissing.__init__i   s'    4C!<!<!<=====r   r   r   r   r   r   r7   r7   f   s.        77> > > > > >r   r7   c                       e Zd ZdZddZdS )ApplyDeltaErrorz'Indicates that applying a delta failed.r   Nc                 0    t          j        | g|R i | d S r   r9   r   r!   r"   s      r   r   zApplyDeltaError.__init__p   )    41$111&11111r   r   r   r   r   r   r;   r;   m   s.        112 2 2 2 2 2r   r;   c                       e Zd ZdZddZdS )NotGitRepositoryz+Indicates that no Git repository was found.r   Nc                 0    t          j        | g|R i | d S r   r9   r=   s      r   r   zNotGitRepository.__init__w   r>   r   r   r   r   r   r   r@   r@   t   s.        552 2 2 2 2 2r   r@   c                        e Zd ZdZddZd ZdS )GitProtocolErrorzGit protocol exception.r   Nc                 0    t          j        | g|R i | d S r   r9   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   r   )r   r   r   r   r   rJ   r   r   r   rC   rC   {   sB        !!2 2 2 2I I I I Ir   rC   c                       e Zd ZdZdS )SendPackErrorz#An error occurred during send_pack.Nr   r   r   r   r   r   r   rL   rL      s        ----r   rL   c                   ,     e Zd ZdZdd fdZd Z xZS )HangupExceptionzHangup exception.Nr   c                     |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   rZ   	__class__s     r   r   zHangupException.__init__   sx     	VGG		VVVVV     GGTUUU(r   c                 \    t          | t          |                    o| j        |j        k    S r   )rF   rG   rZ   rH   s     r   rJ   zHangupException.__eq__   s(    $U,,X1BeFX1XXr   r   r   )r   r   r   r   r   rJ   __classcell__r[   s   @r   rO   rO      s^        	) 	) 	) 	) 	) 	) 	)Y Y Y Y Y Y Yr   rO   c                   $     e Zd ZdZd fdZ xZS )UnexpectedCommandErrorz,Unexpected command received in a proto line.r   Nc                 d    |d}nd| }t                                          d|            d S )Nz	flush-pktzcommand zProtocol got unexpected )rX   r   )r   commandr[   s     r   r   zUnexpectedCommandError.__init__   sC    ?!GG***G=G==>>>>>r   r   )r   r   r   r   r   r]   r^   s   @r   r`   r`      sC        66? ? ? ? ? ? ? ? ? ?r   r`   c                       e Zd ZdZdS )FileFormatExceptionz?Base class for exceptions relating to reading git file formats.NrM   r   r   r   rd   rd      s        IIIIr   rd   c                       e Zd ZdZdS )PackedRefsExceptionz.Indicates an error parsing a packed-refs file.NrM   r   r   r   rf   rf      s        8888r   rf   c                       e Zd ZdZdS )ObjectFormatExceptionz%Indicates an error parsing an object.NrM   r   r   r   rh   rh      s        ////r   rh   c                       e Zd ZdZdS )NoIndexPresentzNo index is present.NrM   r   r   r   rj   rj      s        r   rj   c                       e Zd ZdZdS )CommitErrorz,An error occurred while performing a commit.NrM   r   r   r   rl   rl      s        6666r   rl   c                       e Zd ZdZdS )RefFormatErrorzIndicates an invalid ref name.NrM   r   r   r   rn   rn      s        ((((r   rn   c                       e Zd ZdZdS )	HookErrorz)An error occurred while executing a hook.NrM   r   r   r   rp   rp      s        3333r   rp   )r   r	   r   r   r   r&   r*   r.   r1   r4   r7   r;   r@   rC   rL   rO   r`   rd   rf   rh   rj   rl   rn   rp   r   r   r   <module>rq      s  . ? >     y   .E E E E E9 E E E    )       '       &       '   H H H H H H H H> > > > >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   