
    gP                    h   d Z ddlmZ ddlmZmZ ddlZddlmZ erddl	m
Z
 ddlmZ e G d d	e             Ze G d
 de             Ze G d de             Ze G d de             Zej                   G d de             Ze G d de             Ze G d de             Ze G d de             Zy)z
Errors, oh no!
    )annotations)TYPE_CHECKINGAnyN)frozen)Resource)URIc                  ,    e Zd ZU dZded<   ddZddZy)	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   refc                    | j                   |j                   urt        S t        j                  |       t        j                  |      k(  S N	__class__NotImplementedattrsastupleselfothers     K/var/www/openai/venv/lib/python3.12/site-packages/referencing/exceptions.py__eq__zNoSuchResource.__eq__   5    >>0!!}}T"emmE&:::    c                >    t        t        j                  |             S r   hashr   r   r   s    r   __hash__zNoSuchResource.__hash__"       EMM$'((r   Nr   objectreturnboolr"   int__name__
__module____qualname____doc____annotations__r   r    r   r   r
   r
      s     
H;
)r   r
   c                  ,    e Zd ZU dZded<   ddZddZy)	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]resourcec                    | j                   |j                   urt        S t        j                  |       t        j                  |      k(  S r   r   r   s     r   r   zNoInternalID.__eq__3   r   r   c                >    t        t        j                  |             S r   r   r   s    r   r   zNoInternalID.__hash__8   r   r   Nr    r$   r&   r,   r   r   r.   r.   &   s     ;
)r   r.   c                  ,    e Zd ZU dZded<   ddZddZy)	UnretrievablezO
    The given URI is not present in a registry, and retrieving it failed.
    r   r   c                    | j                   |j                   urt        S t        j                  |       t        j                  |      k(  S r   r   r   s     r   r   zUnretrievable.__eq__D   r   r   c                >    t        t        j                  |             S r   r   r   s    r   r   zUnretrievable.__hash__I   r   r   Nr    r$   r&   r,   r   r   r4   r4   <        
H;
)r   r4   c                  ,    e Zd ZU dZded<   ddZddZy)	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   contentsc                    | j                   |j                   urt        S t        j                  |       t        j                  |      k(  S r   r   r   s     r   r   z#CannotDetermineSpecification.__eq__X   r   r   c                >    t        t        j                  |             S r   r   r   s    r   r   z%CannotDetermineSpecification.__hash__]   r   r   Nr    r$   r&   r,   r   r   r9   r9   M   s     M;
)r   r9   c                  ,    e Zd ZU dZded<   ddZddZy)	Unresolvablez'
    A reference was unresolvable.
    r   r   c                    | j                   |j                   urt        S t        j                  |       t        j                  |      k(  S r   r   r   s     r   r   zUnresolvable.__eq__i   r   r   c                >    t        t        j                  |             S r   r   r   s    r   r   zUnresolvable.__hash__n   r   r   Nr    r$   r&   r,   r   r   r>   r>   a   r7   r   r>   c                  $    e Zd ZU dZded<   ddZy)PointerToNowherezK
    A JSON Pointer leads to a part of a document that does not exist.
    r/   r0   c                x    | j                   d| j                  j                  }| j                   dk(  r|dz  }|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   r0   r:   )r   msgs     r   __str__zPointerToNowhere.__str__z   sC    3DMM4J4J3MN88s?>C
 
r   Nr"   strr'   r(   r)   r*   r+   rG   r,   r   r   rB   rB   r   s     r   rB   c                  .    e Zd ZU dZded<   ded<   ddZy)	NoSuchAnchorz@
    An anchor does not exist within a particular resource.
    r/   r0   rI   anchorc                L    | j                   d| j                  j                  S )NrD   )rM   r0   r:   r   s    r   rG   zNoSuchAnchor.__str__   s%    {{o4T]]5K5K4NO	
r   NrH   rJ   r,   r   r   rL   rL      s     K
r   rL   c                  .    e Zd ZU dZded<   ded<   ddZy)	InvalidAnchorzu
    An anchor which could never exist in a resource was dereferenced.

    It is somehow syntactically invalid.
    r/   r0   rI   rM   c                <    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.)rM   r   s    r   rG   zInvalidAnchor.__str__   s*      &**	
r   NrH   rJ   r,   r   r   rP   rP      s     K
r   rP   )r*   
__future__r   typingr   r   r   referencing._attrsr   referencingr   referencing.typingr   KeyErrorr
   	Exceptionr.   r4   r9   r>   rB   rL   rP   r,   r   r   <module>rY      s    # %  %$& )X ) )& )9 ) )* )H ) )  )9 ) )& )9 ) )  |  $ 
< 
 
 
L 
 
r   