o
    tBh3%                     @   s   d dl mZ d dlmZmZmZmZmZmZm	Z	 zd dlm
Z
 W n ey/   d dlm
Z
 Y nw e	rFd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
 d
e
ddZG dd deZdedefddZdedefddZdS )    )exc_info)Any
CollectionDictListOptionalUnionTYPE_CHECKING)	TypedDict   )Node)SourceLocationFormattedSourceLocation)Source)GraphQLErrorGraphQLErrorExtensionsGraphQLFormattedErrorc                   @   sB   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    r   r   r/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/graphql/error/graphql_error.pyr      s   
 r   F)totalc                       sd  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dZdefddZdefddZdedefddZdedefddZedefddZ  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                    sT  t  | || _|rt|tst|}|pd | _|| _|r&t|ts&|g}|p)d | _|r4dd |D ng } | _ sH|rH|d }	|	jrH|	j| _|sS|rSdd |D }|pVd | _	|rf rf fdd|D }
ndd |D }
|
ppd | _
|r|j| _|jr|j| _n|jr|j| _|d u rt|dd }t|tr|}|pi | _| jst d | _d S d S )	Nc                 S   s   g | ]}|j r|j qS r   )loc).0noder   r   r   
<listcomp>   s    z)GraphQLError.__init__.<locals>.<listcomp>r   c                 S      g | ]}|j qS r   )startr'   r&   r   r   r   r)          c                    s   g | ]}  |qS r   )get_location)r'   posr"   r   r   r)      s    
c                 S   s   g | ]	}|j |jqS r   )r"   r.   r+   r,   r   r   r   r)      s    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__r0   r   r2   s   sN   








zGraphQLError.__init__c                 C   sz   ddl m}m} | jg}| jr!| jD ]}|jr|||j qn| jr8| jr8| j}| jD ]
}|||| q-d	|S )Nr   )print_locationprint_source_locationz

)
language.print_locationr?   r@   r   r!   r&   appendr"   r   join)r:   r?   r@   outputr(   r"   locationr   r   r   __str__   s   


zGraphQLError.__str__c                 C   sn   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   rB   r   r   r>   r   rC   )r:   argsr   r   r   __repr__   s   zGraphQLError.__repr__otherc                    sZ   t  toj jkot fddjD p,t  to,d v o,t fdd D S )Nc                 3   s,    | ]}|d krt |t  |kV  qdS r$   N)r8   r'   slotrL   r:   r   r   	<genexpr>   s    z&GraphQLError.__eq__.<locals>.<genexpr>r   c                 3   s6    | ]}|d kr|j v ot| |kV  qdS rM   )	__slots__r8   getrN   rP   r   r   rQ      s    )r3   r   r>   allrR   r9   r:   rL   r   rP   r   __eq__   s   


	zGraphQLError.__eq__c                 C   s
   | |k S )Nr   rU   r   r   r   __ne__   s   
zGraphQLError.__ne__c                 C   sT   d| j pdi}| jdurdd | jD |d< | jdur | 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                 S   r*   r   )	formatted)r'   rE   r   r   r   r)      r-   z*GraphQLError.formatted.<locals>.<listcomp>r   r   r   )r   r   r   r   )r:   rX   r   r   r   rX      s   




zGraphQLError.formatted)NNNNNN)r   r   r   r   r   r   r   r   r   r   r   	Exceptionr   rR   __hash__r2   rF   rK   r   boolrV   rW   propertyr   rX   __classcell__r   r   r=   r   r   /   sb   
 

	9
r   errorr%   c                 C   s   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.)r3   r   	TypeErrorr   r^   r   r   r   print_error   s   
rb   c                 C   s   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.
    r_   )r3   r   r`   rX   ra   r   r   r   format_error   s   
	rc   N)sysr   typingr   r   r   r   r   r   r	   r
   ImportErrortyping_extensionslanguage.astr   language.locationr   r   language.sourcer   __all__r   r   r   rY   r   rb   rc   r   r   r   r   <module>   s$    $ B