o
    e<                     @  s   d Z ddlmZ ddlmZmZ ddlZddlmZ ddl	m
Z
 er(ddlmZ eG dd	 d	eZeG d
d deZeG dd deZeG dd deZejG dd deZeG dd deZeG dd deZeG dd deZdS )z
Errors, oh no!
    )annotations)TYPE_CHECKINGAnyN)frozen)URI)Resourcec                   @  .   e Zd ZU dZded< ddd	ZdddZdS )NoSuchResourcez
    The given URI is not present in a registry.

    Unlike most exceptions, this class *is* intended to be publicly
    instantiable and *is* part of the public API of the package.
    r   refotherr   returnboolc                 C  $   | j |j urtS t| t|kS N	__class__NotImplementedattrsastupleselfr    r   FD:\Projects\ConvertPro\env\Lib\site-packages\referencing/exceptions.py__eq__      zNoSuchResource.__eq__intc                 C     t t| S r   hashr   r   r   r   r   r   __hash__!      zNoSuchResource.__hash__Nr   r   r   r   r   r   __name__
__module____qualname____doc____annotations__r   r    r   r   r   r   r	      
   
 
r	   c                   @  r   )NoInternalIDa  
    A resource has no internal ID, but one is needed.

    E.g. in modern JSON Schema drafts, this is the :kw:`$id` keyword.

    One might be needed if a resource was to-be added to a registry but no
    other URI is available, and the resource doesn't declare its canonical URI.
    Resource[Any]resourcer   r   r   r   c                 C  r   r   r   r   r   r   r   r   2   r   zNoInternalID.__eq__r   c                 C  r   r   r   r   r   r   r   r    7   r!   zNoInternalID.__hash__Nr"   r#   r$   r   r   r   r   r+   %   s
   
 	
r+   c                   @  r   )UnretrievablezO
    The given URI is not present in a registry, and retrieving it failed.
    r   r
   r   r   r   r   c                 C  r   r   r   r   r   r   r   r   C   r   zUnretrievable.__eq__r   c                 C  r   r   r   r   r   r   r   r    H   r!   zUnretrievable.__hash__Nr"   r#   r$   r   r   r   r   r.   ;   
   
 
r.   c                   @  s.   e Zd ZU dZded< dddZdd
dZdS )CannotDetermineSpecificationz
    Attempting to detect the appropriate `Specification` failed.

    This happens if no discernible information is found in the contents of the
    new resource which would help identify it.
    r   contentsr   r   r   c                 C  r   r   r   r   r   r   r   r   W   r   z#CannotDetermineSpecification.__eq__r   c                 C  r   r   r   r   r   r   r   r    \   r!   z%CannotDetermineSpecification.__hash__Nr"   r#   r$   r   r   r   r   r0   L   r*   r0   c                   @  r   )Unresolvablez'
    A reference was unresolvable.
    r   r
   r   r   r   r   c                 C  r   r   r   r   r   r   r   r   h   r   zUnresolvable.__eq__r   c                 C  r   r   r   r   r   r   r   r    m   r!   zUnresolvable.__hash__Nr"   r#   r$   r   r   r   r   r2   `   r/   r2   c                   @  s$   e Zd ZU dZded< d	ddZdS )
PointerToNowherezK
    A JSON Pointer leads to a part of a document that does not exist.
    r,   r-   r   strc                 C  s*   | j d| jj}| j dkr|d7 }|S )N does not exist within /z. The pointer '/' is a valid JSON Pointer but it points to an empty string property ''. If you intended to point to the entire resource, you should use '#'.)r
   r-   r1   )r   msgr   r   r   __str__y   s   
zPointerToNowhere.__str__Nr   r4   r%   r&   r'   r(   r)   r8   r   r   r   r   r3   q   s   
 r3   c                   @  ,   e Zd ZU dZded< ded< d
ddZd	S )NoSuchAnchorz@
    An anchor does not exist within a particular resource.
    r,   r-   r4   anchorr   c                 C  s   | j d| jjS )Nr5   )r=   r-   r1   r   r   r   r   r8      s   zNoSuchAnchor.__str__Nr9   r:   r   r   r   r   r<      s
   
 r<   c                   @  r;   )InvalidAnchorzu
    An anchor which could never exist in a resource was dereferenced.

    It is somehow syntactically invalid.
    r,   r-   r4   r=   r   c                 C  s   d| j  d| j  dS )Nz'#zo' is not a valid anchor, neither as a plain name anchor nor as a JSON Pointer. You may have intended to use '#/zD', as the slash is required *before each segment* of a JSON pointer.)r=   r   r   r   r   r8      s   
zInvalidAnchor.__str__Nr9   r:   r   r   r   r   r>      s
   
 r>   )r(   
__future__r   typingr   r   r   Zreferencing._attrsr   Zreferencing.typingr   Zreferencingr   KeyErrorr	   	Exceptionr+   r.   r0   r2   r3   r<   r>   r   r   r   r   <module>   s0    