
    $g                     v   d dl mZmZ d dlmZ d dlmZ d dlmZm	Z	m
Z
mZmZ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ddlmZmZmZ ddlmZmZmZmZm Z  dd	l!m"Z"m#Z#m$Z$mZm%Z% dd
l!m&Z' ddl(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z< ddl=m=Z=m>Z> ddl?m@Z@ ddlAmBZBmCZC g dZD G d ded          ZE G d d          ZFeeeee@f                  ZG G d d          ZH	 	 	 	 	 	 	 	 	 	 d=de2dedededeeeIef                  deeI         d ee+         d!ee3         d"ee+         d#eeG         d$eed                  d%eeegeJf                  d&e"eF         fd'ZKd(ed&eJfd)ZL	 	 	 	 	 	 	 	 	 d>de2dedededeeeIef                  deeI         d ee+         d!ee3         d#eeG         d$eed                  d*eJd&eFfd+ZM	 d?de2ded,eeeIef                  d&dfd-ZNde2d.e/d/ed&e*fd0ZOd1e/d2ed3ee         d&efd4ZPd5ed&eeI         fd6ZQd5ed7e1d8e)d&e"eeI                  fd9ZRd:ed7e1d;ed&efd<ZSdS )@    )ensure_futuregather)Mapping)isawaitable)AnyAsyncIterable	AwaitableCallableDictIterableListOptionalTupleTypeUnioncast)	TypedDict   )GraphQLErrorGraphQLFormattedErrorlocated_error)DocumentNode	FieldNodeFragmentDefinitionNodeOperationDefinitionNodeOperationType)AwaitableOrValuePath	Undefinedinspectis_iterable)is_awaitable)GraphQLAbstractTypeGraphQLFieldGraphQLFieldResolverGraphQLLeafTypeGraphQLListGraphQLNonNullGraphQLObjectTypeGraphQLOutputTypeGraphQLResolveInfoGraphQLSchemaGraphQLTypeResolverSchemaMetaFieldDefTypeMetaFieldDefTypeNameMetaFieldDefassert_valid_schemais_abstract_typeis_leaf_typeis_list_typeis_non_null_typeis_object_type   )collect_fieldscollect_sub_fields)MiddlewareManager)get_argument_valuesget_variable_values)
 assert_valid_execution_argumentsdefault_field_resolverdefault_type_resolverexecuteexecute_syncget_field_defExecutionResultExecutionContextFormattedExecutionResult
Middlewarec                   j    e Zd ZU dZee         ed<   eee	e
f                  ed<   ee	e
f         ed<   dS )rE   zFormatted execution resulterrorsdata
extensionsN)__name__
__module____qualname____doc__r   r   __annotations__r   r   strr        Y/var/www/html/netbox-4.1.3/venv/lib/python3.11/site-packages/graphql/execution/execute.pyrE   rE   e   sW         $$&''''
4S>
""""S#XrR   rE   F)totalc            
       R   e Zd ZU dZdZeeeef                  e	d<   ee
e                  e	d<   eeeef                  e	d<   	 	 	 ddeeeef                  dee
e                  deeeef                  fdZdefd	Zdee         fd
Zedefd            ZdedefdZdedefdZdS )rC   zThe result of GraphQL execution.

    - ``data`` is the result of a successful execution of the query.
    - ``errors`` is included when any errors occurred as a non-empty list.
    - ``extensions`` is reserved for adding non-standard properties.
    rI   rH   rJ   rI   rH   rJ   Nc                 0    || _         || _        || _        d S NrV   )selfrI   rH   rJ   s       rS   __init__zExecutionResult.__init__{   s     	$rR   returnc                 n    | j         j        }| j        dn	d| j         }| d| j        d| j        | dS )N z, extensions=z(data=z	, errors=))	__class__rK   rJ   rI   rH   )rY   nameexts      rS   __repr__zExecutionResult.__repr__   sO    ~&O+bb1R1R1RIIdiIIDKI3IIIIrR   c                 8    t          | j        | j        f          S rX   )iterrI   rH   )rY   s    rS   __iter__zExecutionResult.__iter__   s    TY,---rR   c                 p    d| j         i}| j        d | j        D             |d<   | j        
| j        |d<   |S )z>Get execution result formatted according to the specification.rI   Nc                     g | ]	}|j         
S rQ   )	formatted).0errors     rS   
<listcomp>z-ExecutionResult.formatted.<locals>.<listcomp>   s    "L"L"Lu5?"L"L"LrR   rH   rJ   rV   )rY   rh   s     rS   rh   zExecutionResult.formatted   sL     06ty.A	;""L"L"L"L"LIh?&&*oIl#rR   otherc                    t          |t                    rHd|vr|t          | j        | j                  k    S |t          | j        | j        | j                  k    S t          |t
                    r=t          |          dk    r|| j        | j        fk    S || j        | j        | j        fk    S t          || j                  o/|j        | j        k    o|j        | j        k    o|j        | j        k    S )NrJ   rI   rH   rV   r   )
isinstancedictrI   rH   rJ   tuplelenr_   rY   rl   s     rS   __eq__zExecutionResult.__eq__   s    eT"" 	5(($)DK H H HHHDYt{t     eU## 	F5zzQDK 888TYT_EEEudn-- 4
di'4+4  DO3		
rR   c                     | |k     S rX   rQ   rs   s     rS   __ne__zExecutionResult.__ne__   s    5=  rR   )NNN)rK   rL   rM   rN   	__slots__r   r   rP   r   rO   r   r   rZ   rb   r   re   propertyrE   rh   boolrt   rv   rQ   rR   rS   rC   rC   m   s~          /I
4S>
""""T,'((((c3h(((( *./3/3	% %tCH~&% l+,% T#s(^,	% % % %J# J J J J
.(3- . . . . 3    X
C 
D 
 
 
 
$!C !D ! ! ! ! ! !rR   rC   c                      e Zd ZU dZeed<   eeef         ed<   e	ed<   e	ed<   e
ed<   eee	f         ed<   eed<   eed	<   eed
<   ee         ed<   ee         ed<    ee          Zdedeeef         de	de	de
deee	f         ded	ed
edee         dee         deee	gef                  ddfdZe	 	 	 	 	 	 	 	 	 d1dedede	de	deeee	f                  dee         dee         d	ee         d
ee         dee         deee	gef                  deee         d f         fd            Zedeeee	f                  dee         defd            Zde
de	deee	                  fdZde de	dee!         deeee"         f         deeee	f                  f
dZ#de de	dee!         deeee"         f         deeee	f                  f
dZ$de%d ee"         de de!de&f
d!Z'de d"e	d ee"         de!dee	         f
d#Z(d$ed%e)ddfd&Z*d%e)d ee"         d'e&de!d(e	dee	         fd)Z+d%e,e)         d ee"         d'e&de!d(ee-e	         e.e	         f         deee	                  fd*Z/ed%e0d(e	de	fd+            Z1d%e2d ee"         d'e&de!d(e	dee	         fd,Z3d-e	d%e2d ee"         d'e&d(e	de fd.Z4d%e d ee"         d'e&de!d(e	deeee	f                  fd/Z5d%e d ee"         deeee"         f         fd0Z6dS )2rD   zData that must be available at all points during query execution.

    Namely, schema of the type system that is currently executing, and the fragments
    defined in the query document.
    schema	fragments
root_valuecontext_value	operationvariable_valuesfield_resolvertype_resolversubscribe_field_resolverrH   middleware_managerr"   r[   Nc                     || _         || _        || _        || _        || _        || _        || _        || _        |	| _        |
| _	        || _
        |r|| _        i | _        d S rX   )r{   r|   r}   r~   r   r   r   r   r   rH   r   r"   _subfields_cache)rY   r{   r|   r}   r~   r   r   r   r   r   rH   r   r"   s                rS   rZ   zExecutionContext.__init__   su     "$*".,*(@%"4 	- ,DIKrR   documentraw_variable_valuesoperation_name
middlewarec                    d}i }d}|
^t          |
t          t          f          r
t          |
 }n8t          |
t                    r|
}n t	          dt          |
           d          |j        D ]n}t          |t                    r3||rt          d          gc S |}0|j	        r|j	        j
        |k    r|}Jt          |t                    r|||j	        j
        <   o|s&|t          d| d          gS t          d          gS t          ||j        pd|pi d	
          }t          |t                    r|S  | |||||||pt          |pt          |	pt          g ||          S )a)  Build an execution context

        Constructs a ExecutionContext object from the arguments passed to execute, which
        we will pass throughout the other execution methods.

        Throws a GraphQLError if a valid execution context cannot be created.

        For internal use only.
        NzsMiddleware must be passed as a list or tuple of functions or objects, or as a single MiddlewareManager object. Got z	 instead.zBMust provide operation name if query contains multiple operations.zUnknown operation named ''.zMust provide an operation.rQ   2   )
max_errors)ro   listrq   r:   	TypeErrorr    definitionsr   r   r`   valuer   r<   variable_definitionsr>   r?   )clsr{   r   r}   r~   r   r   r   r   r   r   r"   r   r|   r   
definitioncoerced_variable_valuess                    rS   buildzExecutionContext.build   s   0 8<	79	:>!*tUm44 	%6
%C""J(9:: %/"";#J//; ; ;   #. 	> 	>J*&=>> >!)  (!J      !+II_ +)>.)P)P *IJ(>?? >3=	*//0 	@)$%S%S%S%STTUU !=>>??"5*0b%2	#
 #
 #
 -t44 	+**s#4422$>(>
 
 	
rR   rI   c                 t    |st          | d          S |                    d            t          | |          S )zBuild response.

        Given a completed execution context and data, build the (data, errors) response
        defined by the "Response" section of the GraphQL spec.
        Nc                 2    | j         pg | j        pg | j        fS rX   )	locationspathmessage)rj   s    rS   <lambda>z1ExecutionContext.build_response.<locals>.<lambda>F  s    u4"ej6FBV rR   )key)rC   sortrn   s     rS   build_responsezExecutionContext.build_response8  sQ      	/"4... 	VV 	 	
 	
 	
 tV,,,rR   c                 0   | j                             |j                  }|t          d|j        j         d|          t          | j         | j        | j        ||j                  }d} |j        t          j
        k    r| j        n| j        ||||          S )zbExecute an operation.

        Implements the "Executing operations" section of the spec.
        Nz$Schema is not configured to execute z operation.)r{   get_root_typer   r   r   r8   r|   r   selection_setr   MUTATIONexecute_fields_seriallyexecute_fields)rY   r   r}   	root_typeroot_fieldsr   s         rS   execute_operationz"ExecutionContext.execute_operationJ  s     K--i.ABB	;'-; ; ;   %KN #
 
 %"m&<<< (($
Z{	4 4 	4rR   parent_typesource_valuer   fieldsc                 ,   i }| j         |                                D ]s\  }}t          |||j                  }|                     ||||          }	|	t
          u r> |          r}dt          t          t          t          f                  dt          dt          t                   dt          t          t          f         ffd}
 |
t          t          |          ||	          } |	          rxdt          t          t          f         dt          dt          dt          t          t          f         fd} |t          t          t          t          f         |          ||	          }I|	t          t          t          t          f         |          |<   u|S )zExecute the given fields serially.

        Implements the "Executing selection sets" section of the spec
        for fields that must be executed serially.
        resultsresponse_nameresultr[   c                 L   K   |  d {V } |          r| d {V n|||<   |S rX   rQ   )r   r   r   awaited_resultsr"   s       rS   await_and_set_resultzFExecutionContext.execute_fields_serially.<locals>.await_and_set_result  sN      
 -4mmmmmmO(4V(<(<Hf& $M2 +*rR   c                     K   | d {V | |<   | S rX   rQ   )r   r   r   s      rS   
set_resultz<ExecutionContext.execute_fields_serially.<locals>.set_result  s#      
 4:\\\\\\GM*"NrR   )r"   itemsr   r`   execute_fieldr   r	   r   rP   r   r   r   )rY   r   r   r   r   r   r   field_nodes
field_pathr   r   r   r"   s               @rS   r   z(ExecutionContext.execute_fields_seriallyi  s    57(*0,,.. %	F %	F&M;dM;3CDDJ''\;
 F ""|G$$ F	+&tCH~6	+#&	+ -S1	+ #s(^		+ 	+ 	+ 	+ 	+ 	+ /.G,,mV  f%% F#!#s(^##&# &# #s(^	# # # # %*c3h11=&  @FT#s(^W--m<<rR   c                 ^   i | j         }g j        }|                                D ]W\  }}t          |||j                  }	|                     ||||	          }
|
t          ur|
|<    ||
          r ||           XsS dt          t          t          f         ffd} |            S )zExecute the given fields concurrently.

        Implements the "Executing selection sets" section of the spec
        for fields that may be executed in parallel.
        r[   c            	         K                        t           t          fd D               d {V                      S )Nc              3   (   K   | ]}|         V  d S rX   rQ   )ri   fieldr   s     rS   	<genexpr>zGExecutionContext.execute_fields.<locals>.get_results.<locals>.<genexpr>  s'      "P"Pe75>"P"P"P"P"P"PrR   )updatezipr   )awaitable_fieldsr   s   rS   get_resultsz4ExecutionContext.execute_fields.<locals>.get_results  sd      NN$ "P"P"P"P?O"P"P"PQQQQQQQ    NrR   )
r"   appendr   r   r`   r   r   r   rP   r   )rY   r   r   r   r   r"   append_awaitabler   r   r   r   r   r   r   s               @@rS   r   zExecutionContext.execute_fields  s     (&(+2*0,,.. 	4 	4&M;dM;3CDDJ''\;
 F Y&&)/&<'' 4$$]333   	N	4S> 	 	 	 	 	 	 	 {}}rR   	field_defr   c                     t          |d         j        j        ||j        ||| j        | j        | j        | j        | j        | j	        | j
                  S )zDBuild the GraphQLResolveInfo object.

        For internal use only.r   )r+   r`   r   typer{   r|   r}   r   r   r~   r"   )rY   r   r   r   r   s        rS   build_resolve_infoz#ExecutionContext.build_resolve_info  sW     "N%NKNON 
 
 	
rR   sourcec                     t           j        |d                   }|st          S |j        |j        p j        } j        r j                            |          }                     ||          	 t          |d          j
                  } ||fi |                               rdt          f fd} |            S                                                               rdt          f fd}	 |	            S S # t          $ rD}
t          |
                                          }                     |           Y d}
~
dS d}
~
ww xY w)ao  Resolve the field on the given source object.

        Implements the "Executing fields" section of the spec.

        In particular, this method figures out the value that the field returns by
        calling its resolve function, then calls complete_value to await coroutine
        objects, serialize scalars, or execute the sub-selection-set for objects.
        r   r[   c                  (  K   	                       d {V           }                     |           r|  d {V S | S # t          $ rD}t          |                                          }                    |           Y d }~d S d }~ww xY wrX   )complete_valuer"   	Exceptionr   as_listhandle_field_error)		completed	raw_errorrj   r   infor   r   return_typerY   s	      rS   await_resultz4ExecutionContext.execute_field.<locals>.await_result  s      
$$($7$7'dD,,,,,,% %	  ,,Y77 3)2??????2(($ $ $ $ -idllnn U U//{CCC#ttttt$s   ;A A 
B9BBc                     K   	  d {V S # t           $ rD} t          |                                           }                    |           Y d } ~ d S d } ~ ww xY wrX   r   r   r   r   )r   rj   r   r   r   r   rY   s     rS   await_completedz7ExecutionContext.execute_field.<locals>.await_completed#  sy      $%..$ $ $ $ -idllnn U U//{CCC#ttttt$    
A9AAN)rB   r{   r   r   resolver   r   get_field_resolverr   r;   r   r"   r   r   r   r   r   r   )rY   r   r   r   r   r   
resolve_fnargsr   r   r   rj   r   r   r   r   s   `  ``       @@@@rS   r   zExecutionContext.execute_field  s     "$+{KNKK	 	n&=$*=
" 	P0CCJOOJ&&y+{DQQ-	 'y+a.$BVWWD  Z5555F  (( &$C $ $ $ $ $ $ $ $ $ $ $ $|~~%++[$f I   ++ 
)$s $ $ $ $ $ $ $ $ $ $ '((( 	 	 	!)[$,,..IIE##E;77744444	s&   <AD AD D 
E,(9E''E,rj   r   c                 \    t          |          r|| j                            |           d S rX   )r5   rH   r   )rY   rj   r   s      rS   r   z#ExecutionContext.handle_field_error3  s6     K(( 	K 	5!!!trR   r   r   c                 .   t          |t                    r|t          |          rZ|                     t	          t
          |          j        ||||          }|%t          d|j        j	         d|j
         d          |S |	|t          u rdS t          |          r,|                     t	          t          |          ||||          S t          |          r)|                     t	          t"          |          |          S t%          |          r,|                     t	          t(          |          ||||          S t+          |          r,|                     t	          t.          |          ||||          S t          dt1          |           d          )a  Complete a value.

        Implements the instructions for completeValue as defined in the
        "Value completion" section of the spec.

        If the field type is Non-Null, then this recursively completes the value
        for the inner type. It throws a field error if that completion returns null,
        as per the "Nullability" section of the spec.

        If the field type is a List, then this recursively completes the value
        for the inner type on each item in the list.

        If the field type is a Scalar or Enum, ensures the completed value is a legal
        value of the type by calling the ``serialize`` method of GraphQL type
        definition.

        If the field is an abstract type, determine the runtime type of the value and
        then complete based on that type.

        Otherwise, the field type expects a sub-selection set, and will complete the
        value by evaluating all sub-selections.
        Nz*Cannot return null for non-nullable field .z2Cannot complete value of unexpected output type: 'r   )ro   r   r5   r   r   r(   of_typer   r   r`   
field_namer   r4   complete_list_valuer'   r3   complete_leaf_valuer&   r2   complete_abstract_valuer#   r6   complete_object_valuer)   r    )rY   r   r   r   r   r   r   s          rS   r   zExecutionContext.complete_valueA  s   > fi(( 	L K(( 	++^[119 I  C(-C C04C C C    >Vy004 $$ 	++[+..T4   $$ 	X++D+,N,NPVWWW K(( 	//(+66T4QW  
 +&& 	--&44k4v  
 *%%* * *
 
 	
rR   c                     t          |          sht          |t                    r.dt          t                   dt          f fd} ||          S t	          dj        j         dj         d          t          t          t                   |          }j
         j        g j        }g j        }t          |          D ]\  }	}
                    |	d          } |
          r,dt          d	t          dt          f fd
} ||
|          }n	                      ||
          } |          r)dt          d	t          dt          f fd} |||          }nR# t"          $ rE}t%          ||                                          }                     |           d}Y d}~nd}~ww xY w |          r ||	            ||           sS dt*          t                   ffd} |            S )zwComplete a list value.

        Complete a list value by completing each item in the list with the inner type.
        async_resultr[   c                 ^   K   d | 2              d {V }                     |          S )Nc                 "   K   g | 3 d {V }|
6 S rX   rQ   )ri   items     rS   rk   zXExecutionContext.complete_list_value.<locals>.async_iterable_to_list.<locals>.<listcomp>  s.      "G"G"G"G"G"G"G"G$4"G"G"G"Gs   )r   )r   sync_resultr   r   r   r   rY   s     rS   async_iterable_to_listzDExecutionContext.complete_list_value.<locals>.async_iterable_to_list  sR       #H"G,"G"G"G"G"G"G"G"G"GK33#[$k  rR   z3Expected Iterable, but did not find one for field 'r   r   Nr   	item_pathc                   K   	 	                     ||  d {V           } |          r| d {V S |S # t          $ rD}t          ||                                          }	                    |           Y d }~d S d }~ww xY wrX   )r   r   r   r   r   )
r   r   r   r   rj   r   r   r"   	item_typerY   s
        rS   r   z=ExecutionContext.complete_list_value.<locals>.await_completed  s      $$($7$7%{D)4ZZZZZZ% %	 (<	22 3)2??????2(($ $ $ $ -%{I4E4E4G4G! ! //yAAA#ttttt$s   19 9 
B9BBc                    K   	 |  d {V S # t           $ rD}t          ||                                          }                    |           Y d }~d S d }~ww xY wrX   r   )r   r   r   rj   r   r   rY   s       rS   r   z=ExecutionContext.complete_list_value.<locals>.await_completed  s      ,-1zzzzzz 1#, , , ,(5$-{I<M<M<O<O)" )" !% 7 7y I I I'+ttttt,r   c                  t   K   t          t          fdD               d {V           D ]
\  } }|| <   S )Nc              3   (   K   | ]}|         V  d S rX   rQ   )ri   indexcompleted_resultss     rS   r   zVExecutionContext.complete_list_value.<locals>.get_completed_results.<locals>.<genexpr>  s)      NN5'.NNNNNNrR   )r   r   )r   r   awaitable_indicesr   s     rS   get_completed_resultszCExecutionContext.complete_list_value.<locals>.get_completed_results  s{      !$!NNNN<MNNN      " " 2 2v ,2!%(($$rR   )r!   ro   r   r   r   r   r`   r   r   r   r   r"   r   	enumerateadd_keyr   r   r   r   r   r   r   )rY   r   r   r   r   r   r   r   append_resultr   r   r   r   completed_itemr   rj   r   r   r   r"   r   s   `````            @@@@rS   r   z$ExecutionContext.complete_list_value  s!    6"" 	&-00 
6"/"4          .-f555A%*A A-1_A A A   hsmV,,
  '	('),3'))0$V,, 0	* 0	*KE4 UD11I|D!! '*$ $ $ $ $ $ $ $ $ $ $ $ $ "1y!A!A*%)%8%8!;i& &N $|N33 T, , ,QT , , , , , , , , *9)S)S  * * *))[)BSBSBUBUVVE++E9===%)NNNNNN*
 |N++ (  '''M.))))  	%$$	%T#Y 	% 	% 	% 	% 	% 	% 	% %$&&&s   $AE22
G<;F<<Gc           
          |                      |          }|t          u s|?t          dt          |            dt          |           dt          |                     |S )zComplete a leaf value.

        Complete a Scalar or Enum by serializing to a valid value, returning null if
        serialization is not possible.
        Nz
Expected `z.serialize(z+)` to return non-nullable value, returned: )	serializer   r   r    )r   r   serialized_results      rS   r   z$ExecutionContext.complete_leaf_value  s     (11&99	))->-FYW[11 Y Ygfoo Y Y<CDU<V<VY Y   ! rR   c           	      t    j         p j        } |                                         r2t          t                    dt
          f fd} |            S t          t          t                                                   	                                        S )zComplete an abstract value.

        Complete a value of an abstract type by determining the runtime object type of
        that value, then complete the value for that type.
        r[   c            	         K                                             d {V                     }                     |           r|  d {V S | S rX   )r   ensure_valid_runtime_typer"   )r   r   r   r   r   r   runtime_typerY   s    rS   await_complete_object_valuezMExecutionContext.complete_abstract_value.<locals>.await_complete_object_value#  s      2222*******##     $$U++ '!&;;;;;;&rR   )
resolve_typer   r"   r   r	   r   r   rP   r   r   )	rY   r   r   r   r   r   resolve_type_fnr  r  s	   ``````  @rS   r   z(ExecutionContext.complete_abstract_value  s     &2Hd6H&vt[AA\** 	1	<88Ls            $ /.000HSM<88))**k;f  
 
 	
rR   runtime_type_namec                    |6t          d|j         d|j        j         d|j         d|j         d	|          t	          |          rt          d          t          |t                    sNt          d|j         d|j        j         d|j         dt          |           dt          |           d	|          | j        	                    |          }|t          d|j         d
| d|          t	          |          st          d|j         d| d	|          t          t          |          }| j                            ||          s!t          d|j         d|j         d	|          |S )NzAbstract type 'z7' must resolve to an Object type at runtime for field 'r   z'. Either the 'zn' type should provide a 'resolve_type' function or each possible type should provide an 'is_type_of' function.z{Support for returning GraphQLObjectType from resolve_type was removed in GraphQL-core 3.2, please return type name instead.z' with value z, received 'r   z' was resolved to a type 'z(' that does not exist inside the schema.z%' was resolved to a non-object type 'zRuntime Object type 'z' is not a possible type for ')r   r`   r   r   r6   ro   rP   r    r{   get_typer   r)   is_sub_type)rY   r  r   r   r   r   r  s          rS   r   z*ExecutionContext.ensure_valid_runtime_typeB  s]    $-+"2 - -#/4- -7;- - !, 0- - -    +,, 	Q  
 +S11 	P+"2 P P#/4P P7;P P FOOP P 299J1K1KP P P    {++,=>>Q+"2 Q Q&Q Q Q   l++ 	@+"2 @ @*;@ @ @   -|<<{&&{LAA 	3(9 3 3).3 3 3   rR   c                 T                                    j        rm                    |                                         r/dt          t          t
          f         f fd} |            S st                                                   S )z9Complete an Object value by executing all sub-selections.r[   c                  j   K    d {V st                                                   S rX   )invalid_return_type_errorr   )r   
is_type_ofr   r   r   rY   sub_field_nodess   rS   execute_subfields_asynczGExecutionContext.complete_object_value.<locals>.execute_subfields_async  s]      !+++++++ 7'    ..#VT?  rR   )collect_subfieldsr  r"   r   rP   r   r  r   )	rY   r   r   r   r   r   r  r  r  s	   ``` `` @@rS   r   z&ExecutionContext.complete_object_value  s     00kJJ
 ! 	R$//==J  ,, 1tCH~             /.000 R/V[QQQ"";oNNNrR   c                 0   | j         }t          |          dk    r|t          |d                   fn%t          |gt	          t          |          R           }|                    |          }|'t          | j        | j        | j	        ||          }|||<   |S )a.  Collect subfields.

        A cached collection of relevant subfields with regard to the return type is
        kept in the execution context as ``_subfields_cache``. This ensures the
        subfields are not repeatedly calculated, which saves overhead when resolving
        lists of values.
        r7   r   )
r   rr   idrq   mapgetr9   r{   r|   r   )rY   r   r   cacher   r  s         rS   r  z"ExecutionContext.collect_subfields  s     % ;1$$ "[^,,--;c"k&:&:;;<< 	
  ))C.."0$ O )E#JrR   )	NNNNNNNNN)7rK   rL   rM   rN   r,   rO   r   rP   r   r   r   r%   r-   r   r   r   r:   staticmethoddefault_is_awaitabler"   r
   ry   rZ   classmethodr   rF   r   r   rC   r   r   r   r)   r   r   r   r   r$   r+   r   r   r*   r   r   r'   r   r   r   r&   r   r#   r   r   r   r  rQ   rR   rS   rD   rD      s7          C//0000OOO&&&&#s(^###((((&&&&2222 !23333< 455LLL 334L 	L
 L +L c3hL -L +L #7L \"L %%67L xt45L 
L L L L< 
 !8<(,9=7;CG+/8<R
 R
R
 R
 	R

 R
 &d38n5R
 !R
 !!56R
   34R
 #++?"@R
 Z(R
 xt45R
 
tL!#55	6R
 R
 R
 [R
h -tCH~&-04\0B-	- - - \-"404>A4	"3'	(4 4 4 4>4&4 4 tn	4
 S$y/)*4 
$sCx.	)4 4 4 4l+&+ + tn	+
 S$y/)*+ 
$sCx.	)+ + + +Z

 )_
 '	

 
 

 
 
 
6J&J J )_	J
 J 
#	J J J JX ' 
	   S
&S
 )_S
 !	S

 S
 S
 
#	S
 S
 S
 S
ji' !23i' )_i' !	i'
 i' mC((3-78i' 
$s)	$i' i' i' i'V ! !# !# ! ! ! \!0
(0
 )_0
 !	0

 0
 0
 
#	0
 0
 0
 0
d;; ); )_	;
 !; ; 
; ; ; ;z"O&"O )_"O !	"O
 "O "O 
$sCx.	)"O "O "O "OH!,!;?	?!	c4	?"	#! ! ! ! ! !rR   rD   Nr{   r   r}   r~   r   r   r   r   r   r   execution_context_classr"   r[   c                    t          | ||           |
t          }
|
                    | |||||||||	|          }t          |t                    rt          d|          S |j        |j        	 |j        }|	                    ||          |
                              rdt          ffd} |            S 	            S # t          $ r+}                    |            d          cY d}~S d}~ww xY w)a  Execute a GraphQL operation.

    Implements the "Executing requests" section of the GraphQL specification.

    Returns an ExecutionResult (if all encountered resolvers are synchronous),
    or a coroutine object eventually yielding an ExecutionResult.

    If the arguments to this function do not result in a legal execution context,
    a GraphQLError will be thrown immediately explaining the invalid input.
    Nrn   r[   c                     K   	   d {V           S # t           $ r+}                     |             d           cY d } ~ S d } ~ ww xY wrX   )r   r   )rj   r   rH   r   s    rS   r   zexecute.<locals>.await_result  s|      8)>,,,,,,???# 8 8 8MM%((()>$777777778s    
A AAA)r=   rD   r   ro   r   rC   rH   r   r   r   r"   r   r   r   )r{   r   r}   r~   r   r   r   r   r   r   r  r"   exe_contextr   r   rj   r   rH   r   s                   @@@rS   r@   r@     sx   2 %VXGGG&"2 *//  K +t$$ >D==== F /N.)	..y*EE##F++ 		"8 8 8 8 8 8 8 8 8  <>>!		" ~ff---	  , , ,e~dF++++++++,s   2A
C
 

C? C:4C?:C?_valuec                     dS )zGReplacement for isawaitable if everything is assumed to be synchronous.FrQ   )r  s    rS   assume_not_awaitabler    s    5rR   
check_syncc                     t          |
          r|
n
|
rdnt          }t          | |||||||d||	|          }t          |          r0t	          |                                           t          d          |S )a`  Execute a GraphQL operation synchronously.

    Also implements the "Executing requests" section of the GraphQL specification.

    However, it guarantees to complete synchronously (or throw an error) assuming
    that all field resolvers are also synchronous.

    Set check_sync to True to still run checks that no awaitable values are returned.
    Nz3GraphQL execution failed to complete synchronously.)callabler  r@   r   r   cancelRuntimeError)r{   r   r}   r~   r   r   r   r   r   r  r  r"   r   s                rS   rA   rA      s    0 J	<

 :dd&:   F  6 Rf$$&&&PQQQMrR   r   c                     |st          d          t          |            |$t          |t                    st          d          dS dS )zCheck that the arguments are acceptable.

    Essential assertions before executing to provide developer feedback for improper use
    of the GraphQL library.

    For internal use only.
    zMust provide document.NzVariable values must be provided as a dictionary with variable names as keys. Perhaps look to see if an unparsed JSON string was provided.)r   r1   ro   rp   )r{   r   r   s      rS   r=   r=   S  sh      20111   ':6I4+P+P'8
 
 	
 ('''rR   r   
field_nodec                     |j         j        }|dk    r| j        |k    rt          S |dk    r| j        |k    rt          S |dk    rt
          S |j                            |          S )a  Get field definition.

    This method looks up the field on the given type definition. It has special casing
    for the three introspection fields, ``__schema``, ``__type`, and ``__typename``.
    ``__typename`` is special because it can always be queried as a field, even in
    situations where no other fields are allowed, like on a Union. ``__schema`` and
    ``__type`` could get automatically added to the query type, but that would require
    mutating type definitions, which would cause issues.

    For internal use only.
    __schema__type
__typename)r`   r   
query_typer.   r/   r0   r   r  )r{   r   r%  r   s       rS   rB   rB   n  sr     &JZF$5$D$D!!	x		F$5$D$D	|	#	###!!*---rR   r   r   r   c                 T    t          d| j         dt          |           d|          S )z1Create a GraphQLError for an invalid return type.zExpected value of type 'z' but got: r   )r   r`   r    )r   r   r   s      rS   r  r    s8     R;#3RRRRR  rR   r   c                     t          | t                    r|                     d          S | j        j        D ]"}t          | d|j         dd          }|r|c S #dS )z3Get the ``__typename`` property of the given value.r)  _N)ro   r   r  r_   __mro__getattrrK   )r   r   r)  s      rS   get_typenamer0    sw    %!! 'yy&&&&  U$@$@$@$@$GG
 		4rR   r   abstract_typec                    t          |           }t          |t                    r|S |j                            |          }|j        }g j        }g j        }|D ]_}|j        rV|                    | |          }	 ||	          r* |t          t          |	                      ||           T|	r	|j
        c S `r#dt          t                   ffd}
 |
            S dS )a  Default type resolver function.

    If a resolve_type function is not given, then a default resolve behavior is used
    which attempts two strategies:

    First, See if the provided value has a ``__typename`` field defined, if so, use that
    value as name of the resolved type.

    Otherwise, test each possible type for the abstract type by calling
    :meth:`~graphql.type.GraphQLObjectType.is_type_of` for the object
    being coerced, returning the first type that matches.
    r[   c                  l   K   t            d {V } t          |           D ]\  }}|r	|j        c S d S rX   )r   r   r`   )is_type_of_resultsis_type_of_resulttype_awaitable_is_type_of_resultsawaitable_typess      rS   r  z'default_type_resolver.<locals>.get_type  se      '-/K'L!L!L!L!L!L!L,/0BO,T,T & &(!5$ & :%%%&4rR   N)r0  ro   rP   r{   get_possible_typesr"   r   r  r   r	   r`   r   )r   r   r1  	type_namepossible_typesr"   append_awaitable_resultsappend_awaitable_typesr6  r5  r  r7  r8  s              @@rS   r?   r?     s:     U##I)S!!  [33MBBN$L46 ;B/1O,3 " " 	" % 0 0 = =|-.. "((i9J)K)KLLL&&u----" "z!!!# 		 	 	 	 	 	 	 	 xzz4rR   r   r   c                     |j         }t          | t                    r|                     |          nt	          | |d          }t          |          r	 ||fi |S |S )a  Default field resolver.

    If a resolve function is not given, then a default resolve behavior is used which
    takes the property of the source object of the same name as the field and returns
    it as the result, or if it's a function, returns the result of calling that function
    while passing along args and context.

    For dictionaries, the field names are used as keys, for all other objects they are
    used as attribute names.
    N)r   ro   r   r  r/  r!  )r   r   r   r   r   s        rS   r>   r>     sq     J fg&&	/

:VZ.. 

  #uT""T"""LrR   )
NNNNNNNNNN)	NNNNNNNNFrX   )Tasyncior   r   collections.abcr   r    r   typingr   r   r	   r
   r   r   r   r   r   r   r   r   r   ImportErrortyping_extensionsrj   r   r   r   languager   r   r   r   r   pyutilsr   r   r   r!   r"   r  r   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r8   r9   r   r:   valuesr;   r<   __all__rE   rC   rF   rD   rP   ry   r@   r  rA   r=   rB   r  r0  r?   r>   rQ   rR   rS   <module>rH     s"   ) ) ) ) ) ) ) ) # # # # # #                                 ,        , , ,++++++++, G F F F F F F F F F                                                                          , ? > > > > > > > ) ) ) ) ) ) < < < < < < < <  B    y    =! =! =! =! =! =! =! =!@ eE4)::;<
T T T T T T T Tt 04$(5937?C'+BF48Q. Q.Q.Q. Q. 	Q.
 d38n-Q. SMQ. 12Q. /0Q. '';<Q. $Q. &d+=&>?Q. 8SE4K01Q. o&Q. Q. Q. Q.h      04$(5937'+BF0 000 0 	0
 d38n-0 SM0 120 /00 $0 &d+=&>?0 0 0 0 0 0l 59
 


 "$sCx.1
 
	
 
 
 
6..(9.GP.. . . .2",/>B9o   	 	 	 	 	 	11(19L1hsm$1 1 1 1h3 .@ # RU      s   9 AA