
    $g3%                        d dl mZ d dlmZmZmZmZmZmZm	Z	 	 d dlm
Z
 n# e$ r	 d dlm
Z
 Y nw xY we	rddlmZ ddlmZmZ ddlmZ g dZeeef         Z G d	 d
e
d          Z G d de          ZdedefdZdedefdZdS )    )exc_info)Any
CollectionDictListOptionalUnionTYPE_CHECKING)	TypedDict   )Node)SourceLocationFormattedSourceLocation)Source)GraphQLErrorGraphQLErrorExtensionsGraphQLFormattedErrorc                   d    e Zd ZU dZeed<   ed         ed<   eeeef                  ed<   e	ed<   dS )r   zFormatted GraphQL errormessager   	locationspath
extensionsN)
__name__
__module____qualname____doc__str__annotations__r   r	   intr        [/var/www/html/netbox-4.1.3/venv/lib/python3.11/site-packages/graphql/error/graphql_error.pyr   r      s`         !! LLL -....
 uS#X
 '&&&&&r!   r   F)totalc                   0    e Zd ZU dZeed<   	 eed                  ed<   	 eeeee	f                           ed<   	 eed                  ed<   	 ed         ed	<   	 ee
e	                  ed
<   	 ee         ed<   	 ee         ed<   	 dZej        Z	 	 	 	 	 	 ddedee
d         ddf         d	ed         d
ee
e	                  dee
eee	f                           dee         dee         ddf fdZdefdZdefdZdedefdZdedefdZedefd            Z xZS )r   a3  GraphQL Error

    A GraphQLError describes an Error found during the parse, validate, or execute
    phases of performing a GraphQL operation. In addition to a message, it also includes
    information about the locations in a GraphQL document and/or execution result that
    correspond to the Error.
    r   r   r   r   r   nodesr   source	positionsoriginal_errorr   )r   r%   r&   r'   r   r   r(   r   Nreturnc                    t                                          |           || _        |r$t          |t                    st	          |          }|pd | _        || _        |rt          |t                    s|g}|pd | _        |rd |D             ng }| _        s|r|d         }	|	j        r|	j        | _        |s|rd |D             }|pd | _	        |rrfd|D             }
nd |D             }
|
pd | _
        |r]|j        | _        |j        r|j        | _        n|j        r|j        | _        |(t          |dd           }t          |t                    r|}|pi | _        | j        st#                      d         | _        d S d S )Nc                 *    g | ]}|j         	|j         S r    )loc).0nodes     r"   
<listcomp>z)GraphQLError.__init__.<locals>.<listcomp>   s!    444$484TX444r!   r   c                     g | ]	}|j         
S r    )startr-   r,   s     r"   r/   z)GraphQLError.__init__.<locals>.<listcomp>   s    ===s===r!   c                 :    g | ]}                     |          S r    )get_location)r-   posr&   s     r"   r/   z)GraphQLError.__init__.<locals>.<listcomp>   s4     ; ; ;-0##C((; ; ;r!   c                 L    g | ]!}|j                             |j                  "S r    )r&   r4   r1   r2   s     r"   r/   z)GraphQLError.__init__.<locals>.<listcomp>   s*    VVV00;;VVVr!   r   r   )super__init__r   
isinstancelistr   r(   r%   r&   r'   r   __traceback__	__cause____context__getattrdictr   r   )selfr   r%   r&   r'   r   r(   r   node_locationsr,   r   original_extensions	__class__s      `        r"   r8   zGraphQLError.__init__s   s    	!!! 	
4.. 	::DLD	,  	E400 	GE]d
8=E44%44442 	
  	). 	) #Cz )!j 	>^ 	>==n===I"*d 	W 	W; ; ; ;4=; ; ;II WV~VVVI"*d 		5!/!=D' >!/!9+ >#1#= !&-nlD&Q&Q#1488 5!4J$*! 	/!)AD	/ 	/r!   c                 @   ddl m}m} | j        g}| j        r5| j        D ],}|j        r#|                     ||j                             -n>| j        r7| j        r0| j        }| j        D ]!}|                     |||                     "d	                    |          S )Nr   )print_locationprint_source_locationz

)
language.print_locationrE   rF   r   r%   r,   appendr&   r   join)r@   rE   rF   outputr.   r&   locations          r"   __str__zGraphQLError.__str__   s    SSSSSSSS,: 	G
 < <8 <MM..":":;;;< [ 	GT^ 	G[F N G G33FHEEFFFF{{6"""r!   c                 N   t          | j                  g}| j        r|                    d| j                   | j        r|                    d| j                   | j        r|                    d| j                   | j        j         dd                    |           dS )Nz
locations=zpath=zextensions=(z, ))	reprr   r   rH   r   r   rC   r   rI   )r@   argss     r"   __repr__zGraphQLError.__repr__   s    T\""#> 	9KK7T^778889 	/KK-	--...? 	;KK9do99:::.)>>DIIdOO>>>>r!   otherc                      t          t                    o0 j        j        k    o t           fd j        D                       p4t          t
                    odv ot           fdD                       S )Nc              3   h   K   | ],}|d k    t          |          t          |          k    V  -dS r(   N)r>   r-   slotrS   r@   s     r"   	<genexpr>z&GraphQLError.__eq__.<locals>.<genexpr>   sT        +++ d##wud';';;++++ r!   r   c              3      K   | ]:}|d k    |j         v o&t          |                              |          k    V  ;dS rV   )	__slots__r>   getrW   s     r"   rY   z&GraphQLError.__eq__.<locals>.<genexpr>   s`        +++ &Q74+>+>%))D//+Q++++ r!   )r9   r   rC   allr[   r?   r@   rS   s   ``r"   __eq__zGraphQLError.__eq__   s    ul++ %/1      N    
 ud## U"     !    	
r!   c                     | |k     S )Nr    r^   s     r"   __ne__zGraphQLError.__ne__   s    5=  r!   c                     d| j         pdi}| j        d | j        D             |d<   | j        
| j        |d<   | j        r
| j        |d<   |S )zGet error formatted according to the specification.

        Given a GraphQLError, format it according to the rules described by the
        "Response Format, Errors" section of the GraphQL Specification.
        r   zAn unknown error occurred.Nc                     g | ]	}|j         
S r    )	formatted)r-   rK   s     r"   r/   z*GraphQLError.formatted.<locals>.<listcomp>   s    %X%X%XXh&8%X%X%Xr!   r   r   r   )r   r   r   r   )r@   rd   s     r"   rd   zGraphQLError.formatted   sl     t|C'C,
	 >%%X%X%X%X%XIk"9  $	If? 	6&*oIl#r!   )NNNNNN)r   r   r   r   r   r   r   r   r	   r   r   	Exceptionr   r[   __hash__r8   rL   rR   r   boolr_   ra   propertyr   rd   __classcell__)rC   s   @r"   r   r   /   sf          LLL?-.//// 4c3h(
)))) DL!!!!AX 
3(((( Y''''J/00008	I !H
 :>%)/36:.27;7/ 7/7/ Z'567/ "	7/
 JsO,7/ z%S/237/ !+7/ 347/ 
7/ 7/ 7/ 7/ 7/ 7/r# # # # #"?# ? ? ? ?
C 
D 
 
 
 
&!C !D ! ! ! ! 0    X    r!   r   errorr)   c                 h    t          | t                    st          d          t          |           S )zPrint a GraphQLError to a string.

    Represents useful location information about the error's position in the source.

    .. deprecated:: 3.2
       Please use ``str(error)`` instead. Will be removed in v3.3.
    Expected a GraphQLError.)r9   r   	TypeErrorr   rj   s    r"   print_errorro      s1     e\** 42333u::r!   c                 X    t          | t                    st          d          | j        S )a  Format a GraphQL error.

    Given a GraphQLError, format it according to the rules described by the "Response
    Format, Errors" section of the GraphQL Specification.

    .. deprecated:: 3.2
       Please use ``error.formatted`` instead. Will be removed in v3.3.
    rl   )r9   r   rm   rd   rn   s    r"   format_errorrq      s-     e\** 42333?r!   N)sysr   typingr   r   r   r   r   r	   r
   r   ImportErrortyping_extensionslanguage.astr   language.locationr   r   language.sourcer   __all__r   r   r   re   r   ro   rq   r    r!   r"   <module>rz      s         N N N N N N N N N N N N N N N N N N,        , , ,++++++++,  )######        )(((((
M
M
M c3h ' ' ' ' 'IU ' ' ' '&~ ~ ~ ~ ~9 ~ ~ ~B
| 
 
 
 
 
 )>      s   ! //