
    Cj{                       S SK r S SKrS SKrS SKrS SKJr  S SKJr  S SKJ	r	J
r
  S SKJrJrJrJrJrJrJrJrJrJrJrJrJr  S SKrS SKJr  S SKJrJrJrJ r J!r!J"r"  SS	K#J$r$J%r%  SS
K&J'r'  SSK(J)r)J*r*  SSK+J,r,  SSK-J.r.  SSK/J0r0J1r1  SSK/J2r3  SSK4J5r5  \Rl                  " \75      r8 " S S5      r9 " S S5      r: " S S5      r;\" S\S\4   S9r<\\</\<4   r= " S S\;5      r>g)    N)Future)Queue)EventThread)AnyAsyncGeneratorCallableDict	GeneratorListLiteralOptionalTupleTypeVarUnioncastoverload)
fail_after)ExecutionResultGraphQLSchemaIntrospectionQuerybuild_ast_schemaparsevalidate   )GraphQLRequestsupport_deprecated_request)AsyncTransport)TransportConnectionFailedTransportQueryError)LocalSchemaTransport)	Transport)build_client_schemaget_introspection_query_ast)parse_result)str_first_elementc                   t   \ rS rSrSrSSSSSSSSSSS.
S\\\\4      S	\\	   S
\\\
\4      S\S\\   S\\\\4      S\S\S\S\4S jjr\S\4S j5       rS\SS4S jrS\SS4S jr\S\R2                  4S j5       r\SSSS.S\S\\   S\\   S\S   S\S\\\4   4S jj5       r\SSS .S\S\\   S\\   S\S!   S\S\4S" jj5       r\SSS .S\S\\   S\\   S\S\S\\\\4   \4   4S# jj5       rSSSS.S\S\\   S\\   S\S\S\\\\4   \4   4S$ jjr\SSSS.S%\\   S\\   S\\   S\S   S\S\\\\4      4S& jj5       r \SSS .S%\\   S\\   S\\   S\S!   S\S\\   4S' jj5       r \SSS .S%\\   S\\   S\\   S\S\S\\\\\4      \\   4   4S( jj5       r SSSS.S%\\   S\\   S\\   S\S\S\\\\\4      \\   4   4S) jjr \SSSS.S\S\\   S\\   S\S   S\S\\\4   4S* jj5       r!\SSS .S\S\\   S\\   S\S!   S\S\4S+ jj5       r!\SSS .S\S\\   S\\   S\S\S\\\\4   \4   4S, jj5       r!SSSS.S\S\\   S\\   S\S\S\\\\4   \4   4S- jjr!\SSSS.S%\\   S\\   S\\   S\S   S\S\\\\4      4S. jj5       r"\SSS .S%\\   S\\   S\\   S\S!   S\S\\   4S/ jj5       r"\SSS .S%\\   S\\   S\\   S\S\S\\\\\4      \\   4   4S0 jj5       r"SSSS.S%\\   S\\   S\\   S\S\S\\\\\4      \\   4   4S1 jjr"\SSSS.S\S\\   S\\   S\S   S\S\\\4   4S2 jj5       r#\SSS .S\S\\   S\\   S\S!   S\S\4S3 jj5       r#\SSS .S\S\\   S\\   S\S\S\\\\4   \4   4S4 jj5       r#SSSS.S\S\\   S\\   S\S\S\\\\4   \4   4S5 jjr#\SSSS.S%\\   S\\   S\\   S\S   S\S\\\\4      4S6 jj5       r$\SSS .S%\\   S\\   S\\   S\S!   S\S\\   4S7 jj5       r$\SSS .S%\\   S\\   S\\   S\S\S\\\\\4      \\   4   4S8 jj5       r$SSSS.S%\\   S\\   S\\   S\S\S\\\\\4      \\   4   4S9 jjr$\SSSS.S\S\\   S\\   S\S   S\S\%\\\4   S4   4S: jj5       r&\SSS .S\S\\   S\\   S\S!   S\S\%\S4   4S; jj5       r&\SSS .S\S\\   S\\   S\S\S\\%\\\4   S4   \%\S4   4   4S< jj5       r&SSSS.S\S\\   S\\   S\S\S\\%\\\4   S4   \%\S4   4   4S= jjr&\SSSS.S\S\\   S\\   S\S   S\S\'\\\4   SS4   4S> jj5       r(\SSS .S\S\\   S\\   S\S!   S\S\'\SS4   4S? jj5       r(\SSS .S\S\\   S\\   S\S\S\\'\\\4   SS4   \'\SS4   4   4S@ jj5       r(SSSS.S\S\\   S\\   S\S\S\\'\\\4   SS4   \'\SS4   4   4SA jjr(SKSB jr)SC r*SD r+SE r,SF r-SG r.SH r/SI r0SJr1g)LClient/   a  The Client class is the main entrypoint to execute GraphQL requests
on a GQL transport.

It can take sync or async transports as argument and can either execute
and subscribe to requests itself with the
:func:`execute <gql.client.Client.execute>` and
:func:`subscribe <gql.client.Client.subscribe>` methods
OR can be used to get a sync or async session depending on the
transport type.

To connect to an :ref:`async transport <async_transports>` and get an
:class:`async session <gql.client.AsyncClientSession>`,
use :code:`async with client as session:`

To connect to a :ref:`sync transport <sync_transports>` and get a
:class:`sync session <gql.client.SyncClientSession>`,
use :code:`with client as session:`
NF
   r   )
schemaintrospection	transportfetch_schema_from_transportintrospection_argsexecute_timeoutserialize_variablesparse_resultsbatch_interval	batch_maxr+   r,   r-   r.   r/   r0   r1   r2   r3   r4   c       
            U(       a  U(       a   S5       e[        U5      n[        U[        5      (       a  [        U5      n[	        U5      nU(       a5  U(       a.  U(       a   S5       e[        U5      R                  S:X  a   S5       eU(       a  U(       d  [        U5      nXl        X l	        Uc   S5       eX0l
        X@l        Uc  0 OUU l        X`l        Xpl        Xl        Xl        Xl        g)a  Initialize the client with the given parameters.

:param schema: an optional GraphQL Schema for local validation
        See :ref:`schema_validation`
:param transport: The provided :ref:`transport <Transports>`.
:param fetch_schema_from_transport: Boolean to indicate that if we want to fetch
        the schema from the transport using an introspection query.
:param introspection_args: arguments passed to the
        :meth:`gql.utilities.get_introspection_query_ast` method.
:param execute_timeout: The maximum time in seconds for the execution of a
        request before a TimeoutError is raised. Only used for async transports.
        Passing None results in waiting forever for a response.
:param serialize_variables: whether the variable values should be
    serialized. Used for custom scalars and/or enums. Default: False.
:param parse_results: Whether gql will try to parse the serialized output
        sent by the backend. Can be used to deserialize custom scalars or enums.
:param batch_interval: Time to wait in seconds for batching requests together.
        Batching is disabled (by default) if 0.
:param batch_max: Maximum number of requests in a single batch.
z9Cannot provide introspection and schema at the same time.z>Cannot fetch the schema from transport if is already provided.AppSyncWebsocketsTransportzfetch_schema_from_transport=True is not allowed for AppSyncWebsocketsTransport because only subscriptions are allowed on the realtime endpoint.NzAYou need to provide either a transport or a schema to the Client.)r#   
isinstancestrr   r   type__name__r!   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   )selfr+   r,   r-   r.   r/   r0   r1   r2   r3   r4   type_def_asts               \/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/gql/client.py__init__Client.__init__C   s   F KJK(7Ffc"" =L%l3F4POP I//3OO SO ),V4I 06 <I !	ON	O!;D 2M($,B2D 	
  /#6 *,"    returnc                      U R                   S:g  $ )Nr   )r3   r;   s    r=   batching_enabledClient.batching_enabled   s    ""a''r@   requestc                     U R                   (       d   S5       e[        U R                   UR                  5      nU(       a  US   eg):meta private:z@Cannot validate the document locally, you need to pass a schema.r   N)r+   r   document)r;   rF   validation_errorss      r=   r   Client.validate   sI     KK	NM	N %T[['2B2BC#A&& r@   execution_resultc                    UR                   (       aA  [        S[        UR                   5       S3UR                   UR                  UR                  S9e[        [        UR                  5      U l        [        U R                  5      U l	        g )NzError while fetching schema: zT
If you don't need the schema, you can try with: "fetch_schema_from_transport=False"errorsdata
extensions)
rO   r    r&   rP   rQ   r   r   r,   r#   r+   )r;   rL   s     r=    _build_schema_from_introspection'Client._build_schema_from_introspection   s     ""%3()9)@)@AB C::
 (..%**+66
 
 ""46F6K6KL)$*<*<=r@   c                  4    [         R                  " 5          [         R                  " SSS9  [        R                  " 5       n SSS5        U $ ! , (       d  f       W $ = f! [
         a/    [        R                  " 5       n [        R                  " U 5         U $ f = f)zfGet the current asyncio event loop.

Or create a new event loop if there isn't one (in a new Thread).
ignorezThere is no current event loop)messageN)warningscatch_warningsfilterwarningsasyncioget_event_loopRuntimeErrornew_event_loopset_event_looploops    r=   _get_event_loopClient._get_event_loop   s    	)((*''&F --/	 +  +* 	  	)))+D""4(		)s.   A +AA 
AA A 5BB.r1   r%   get_execution_resultr%   rd   kwargsc                    g N r;   rF   r1   r%   rd   re   s         r=   execute_syncClient.execute_sync        r@   r1   r%   Tc                    g rg   rh   ri   s         r=   rj   rk           r@   c                    g rg   rh   ri   s         r=   rj   rk           25r@   c                j    U  nUR                   " U4UUUS.UD6sSSS5        $ ! , (       d  f       g= frH   rc   Nexecuter;   rF   r1   r%   rd   re   sessions          r=   rj   rk      s:     W??$7)%9	
  TT   $
2requestsc                    g rg   rh   r;   ry   r1   r%   rd   re   s         r=   execute_batch_syncClient.execute_batch_sync         #r@   c                    g rg   rh   r{   s         r=   r|   r}          !$r@   c                    g rg   rh   r{   s         r=   r|   r}          >Ar@   c                j    U  nUR                   " U4UUUS.UD6sSSS5        $ ! , (       d  f       g= frs   execute_batchr;   ry   r1   r%   rd   re   rw   s          r=   r|   r}   !  s<     W(($7)%9	
  TTrx   c                   #    g 7frg   rh   ri   s         r=   execute_asyncClient.execute_async4  
         c                   #    g 7frg   rh   ri   s         r=   r   r   ?  
      r   c                   #    g 7frg   rh   ri   s         r=   r   r   J  
      25r   c                   #    U  ISh  vN nUR                   " U4UUUS.UD6I Sh  vN sSSS5      ISh  vN   $  N4 N N	! , ISh  vN  (       d  f       g= f7frH   Nrc   rt   rv   s          r=   r   r   U  sS      47 $7)%9	
   44 444P   A>AAA AAAA AAA
AAAc                   #    g 7frg   rh   r{   s         r=   execute_batch_asyncClient.execute_batch_asynch  
       #r   c                   #    g 7frg   rh   r{   s         r=   r   r   s  
      !$r   c                   #    g 7frg   rh   r{   s         r=   r   r   ~        >Ar   c                   #    U  ISh  vN nUR                   " U4UUUS.UD6I Sh  vN sSSS5      ISh  vN   $  N4 N N	! , ISh  vN  (       d  f       g= f7fr   r   r   s          r=   r   r     sU      47 ..$7)%9	
   44 444r   c                    g rg   rh   ri   s         r=   ru   Client.execute  rl   r@   c                    g rg   rh   ri   s         r=   ru   r     ro   r@   c                    g rg   rh   ri   s         r=   ru   r     rq   r@   c          	         [        U R                  [        5      (       aT  U R                  5       nUR	                  5       (       a   S5       eUR                  U R                  " U4UUUS.UD65      nU$ U R                  " U4UUUS.UD6$ )a  Execute the provided request against the remote server using
the transport provided during init.

This function **WILL BLOCK** until the result is received from the server.

Either the transport is sync and we execute the query synchronously directly
OR the transport is async and we execute the query in the asyncio loop
(blocking here until answer).

This method will:

 - connect using the transport to get a session
 - execute the GraphQL request on the transport session
 - close the session and close the connection to the server

 If you have multiple requests to send, it is better to get your own session
 and execute the requests in your session.

 The extra arguments passed in the method will be passed to the transport
 execute method.
zpCannot run client.execute(query) if an asyncio loop is running. Use 'await client.execute_async(query)' instead.rc   )r7   r-   r   ra   
is_runningrun_until_completer   rj   )r;   rF   r1   r%   rd   re   r`   rP   s           r=   ru   r     s    > dnnn55'')D(( D(
 **""(;!-)=	
 D K $$$7)%9	
  r@   c                    g rg   rh   r{   s         r=   r   Client.execute_batch  r~   r@   c                    g rg   rh   r{   s         r=   r   r     r   r@   c                    g rg   rh   r{   s         r=   r   r     r   r@   c          	         [        U R                  [        5      (       aT  U R                  5       nUR	                  5       (       a   S5       eUR                  U R                  " U4UUUS.UD65      nU$ U R                  " U4UUUS.UD6$ )a  Execute multiple GraphQL requests in a batch against the remote server using
the transport provided during init.

This function **WILL BLOCK** until the result is received from the server.

Either the transport is sync and we execute the query synchronously directly
OR the transport is async and we execute the query in the asyncio loop
(blocking here until answer).

This method will:

 - connect using the transport to get a session
 - execute the GraphQL requests on the transport session
 - close the session and close the connection to the server

 If you want to perform multiple executions, it is better to use
 the context manager to keep a session active.

 The extra arguments passed in the method will be passed to the transport
 execute method.
zvCannot run client.execute_batch(query) if an asyncio loop is running. Use 'await client.execute_batch(query)' instead.rc   )r7   r-   r   ra   r   r   r   r|   )r;   ry   r1   r%   rd   re   r`   rP   s           r=   r   r     s    > dnnn55'')D(( D(
 **(((;!-)=	
 D K **$7)%9	
  r@   c                    g rg   rh   ri   s         r=   subscribe_asyncClient.subscribe_asyncV       03r@   c                    g rg   rh   ri   s         r=   r   r   a       14r@   c                    g rg   rh   ri   s         r=   r   r   l       r@   c                  #    U  ISh  vN nUR                   " U4UUUS.UD6nU  Sh  vN nU7v   M   N- N
 SSS5      ISh  vN    g! , ISh  vN  (       d  f       g= f7fr   )	subscribe)	r;   rF   r1   r%   rd   re   rw   	generatorresults	            r=   r   r   y  se      47))$7)%9	
 I !* f 	 44444s[   A(7A(A;9;AA(;AA(A
A(A%AA%!A(c                    g rg   rh   ri   s         r=   r   Client.subscribe  r   r@   c                    g rg   rh   ri   s         r=   r   r     rq   r@   c                    g rg   rh   ri   s         r=   r   r     r   r@   c             +     #    U R                  5       nUR                  5       (       a   S5       eU R                  " U4UUUS.UD6n  [        R                  " UR                  5       US9nUR                  U5      n	U	v   M:  ! [         a     g[        [        [        4 aT    [        R                  " UR                  5       US9  WR                  5         UR                  UR                  5       5        e f = f7f)zlExecute a GraphQL subscription with a python generator.

We need an async transport for this functionality.
ztCannot run client.subscribe(query) if an asyncio loop is running. Use 'await client.subscribe_async(query)' instead.rc   r_   N)ra   r   r   rZ   ensure_future	__anext__r   StopAsyncIterationKeyboardInterrupt	ExceptionGeneratorExitaclosecancelshutdown_asyncgens)
r;   rF   r1   r%   rd   re   r`   async_generatorgenerator_taskr   s
             r=   r   r     s      ##%??$$ 	
B	
$   
 3%!5	

 
 		 ")!6!6#--/d"
 ++" 
   " 	!9m< 		!!/"8"8":F!!###D$;$;$=> 		s%   AC9;B 
C6C9A(C66C9c                   #    [        U R                  [        5      (       d   S5       eU   U(       a  [        SSU 0UD6U l        O[        U S9U l        U R                  R                  5       I Sh  vN    U R                  (       a3  U R                  (       d"  U R                  R                  5       I Sh  vN   U R                  $  NU N! [         a%    U R                  R                  5       I Sh  vN    e f = f7f)a  Connect asynchronously with the underlying async transport to
produce a session.

That session will be a permanent auto-reconnecting session
if :code:`reconnecting=True`.

If you call this method, you should call the
:meth:`close_async <gql.client.Client.close_async>` method
for cleanup.

:param reconnecting: if True, create a permanent reconnecting session
:param \**kwargs: additional arguments for the
    :meth:`ReconnectingAsyncClientSession init method
    <gql.client.ReconnectingAsyncClientSession.__init__>`.
zBOnly a transport of type AsyncTransport can be used asynchronouslyclientr   Nrh   )r7   r-   r   ReconnectingAsyncClientSessionrw   AsyncClientSessionconnectr.   r+   fetch_schemar   close)r;   reconnectingre   s      r=   connect_asyncClient.connect_async  s     " NNN
 
 	PO	P 
 	9PPPDL-T:DLll""$$$	//ll//111 || 	%
 2 	 ,,$$&&&	sH   A.C<0C1C<6?C
 5C6C
 :C<C
 
'C91C42C99C<c                 T   #    U R                   R                  5       I Sh  vN   g N7f)zBClose the async transport and stop the optional reconnecting task.N)rw   r   rC   s    r=   close_asyncClient.close_async  s      ll  """s   (&(c                 >   #    U R                  5       I S h  vN $  N7frg   )r   rC   s    r=   
__aenter__Client.__aenter__"  s     ''))))s   c                 @   #    U R                  5       I S h  vN   g  N7frg   )r   )r;   exc_typeexctbs       r=   	__aexit__Client.__aexit__%  s        s   c                    [        U R                  [        5      (       a   S5       e[        U S5      (       d  [	        U S9U l        [        U R
                  [        5      (       d   eU R
                  R                  5          U R                  (       a+  U R                  (       d  U R
                  R                  5         U R
                  $ ! [         a    U R
                  R                  5         e f = f)zConnect synchronously with the underlying sync transport to
produce a session.

If you call this method, you should call the
:meth:`close_sync <gql.client.Client.close_sync>` method
for cleanup.
zSOnly a sync transport can be used. Use 'async with Client(...) as session:' insteadrw   r   )r7   r-   r   hasattrSyncClientSessionrw   r   r.   r+   r   r   r   rC   s    r=   connect_syncClient.connect_sync(  s     dnnn== 	
@	
=
 tY'',D9DL$,,(9::::	//))+ ||  	 LL 	s   <C
 
&C0c                 z    [        U R                  [        5      (       d   eU R                  R                  5         g)zClose the sync session and the sync transport.

If batching is enabled, this will block until the remaining queries in the
batching queue have been processed.
N)r7   rw   r   r   rC   s    r=   
close_syncClient.close_syncJ  s,     $,,(9::::r@   c                 "    U R                  5       $ rg   )r   rC   s    r=   	__enter__Client.__enter__T  s      ""r@   c                 $    U R                  5         g rg   )r   )r;   argss     r=   __exit__Client.__exit__W  s    r@   )r3   r4   r0   r.   r,   r/   r2   r+   r1   rw   r-   )F)2r:   
__module____qualname____firstlineno____doc__r   r   r8   r   r   r"   r   boolr
   intfloatr>   propertyrD   r   r   r   rR   staticmethodrZ   AbstractEventLoopra   r   r   r   rj   r   r|   r   r   ru   r   r   r   r   r   r   r   r   r   r   r   r   r   __static_attributes__rh   r@   r=   r(   r(   /   s   , 7;6:@D,1-179$)# !T# sM123T#   23	T#
 E)^";<=T# &*T# %TNT# "%U
"34T# "T# T# T# T#l ($ ( (' '4 '> />	>& W66  " 
 /2'*/2 &d^	
 tn &en  
c3h  
 /2'* &d^	
 tn &dm  
  
 /2'*55 &d^	5
 tn5 #5 5 
tCH~.	/5 5 /3'+%* &d^	
 tn #  
tCH~.	/& 
 /3'+/2#~&# &d^	#
 tn# &en# # 
d38n	# # 
 /3'+$~&$ &d^	$
 tn$ &dm$ $ 
o	$ $ 
 /3'+A~&A &d^	A
 tnA #A A 
tDcN#T/%::	;A A /3'+%*~& &d^	
 tn #  
tDcN#T/%::	;& 
 /2'*/2 &d^	
 tn &en  
c3h  
 /2'* &d^	
 tn &dm  
  
 /2'*55 &d^	5
 tn5 #5 5 
tCH~.	/5 5 /3'+%* &d^	
 tn #  
tCH~.	/& 
 /3'+/2#~&# &d^	#
 tn# &en# # 
d38n	# # 
 /3'+$~&$ &d^	$
 tn$ &dm$ $ 
o	$ $ 
 /3'+A~&A &d^	A
 tnA #A A 
tDcN#T/%::	;A A /3'+%*~& &d^	
 tn #  
tDcN#T/%::	;& 
 /2'*/2 &d^	
 tn &en  
c3h  
 /2'* &d^	
 tn &dm  
  
 /2'*55 &d^	5
 tn5 #5 5 
tCH~.	/5 5 /3'+%*:: &d^	:
 tn: #: : 
tCH~.	/:x 
 /3'+/2#~&# &d^	#
 tn# &en# # 
d38n	# # 
 /3'+$~&$ &d^	$
 tn$ &dm$ $ 
o	$ $ 
 /3'+A~&A &d^	A
 tnA #A A 
tDcN#T/%::	;A A /3'+%*:~&: &d^	:
 tn: #: : 
tDcN#T/%::	;:x 
 /2'*/233 &d^	3
 tn3 &en3 3 
S#X,	-3 3 
 /2'*44 &d^	4
 tn4 &dm4 4 
-	.4 4 
 /2'*

 &d^	

 tn
 #
 
 
tCH~t+,n_d=R.SS

 
  /3'+%* &d^	
 tn #  
tCH~t+,n_d=R.SS
0 
 /2'*/244 &d^	4
 tn4 &en4 4 
4S>4-	.4 4 
 /2'*55 &d^	5
 tn5 &dm5 5 
?D$.	/5 5 
 /2'*

 &d^	

 tn
 #
 
 
$sCx.$,-y$PT9T/UU

 
  /3'+%*<< &d^	<
 tn< #< < 
$sCx.$,-y$PT9T/UU
<|)V#
*! D#r@   r(   c                      \ rS rSrSrS\4S jrSSS.S\S\\	   S	\\	   S
\
S\4
S jjr\SSSS.S\S\\	   S	\\	   S\S   S
\
S\\\
4   4S jj5       r\SSS.S\S\\	   S	\\	   S\S   S
\
S\4S jj5       r\SSS.S\S\\	   S	\\	   S\	S
\
S\\\\
4   \4   4S jj5       rSSSS.S\S\\	   S	\\	   S\	S
\
S\\\\
4   \4   4S jjrSSSS.S\\   S\\	   S	\\	   S\\	   S
\
S\\   4S jjr\SSSS.S\\   S\\	   S	\\	   S\S   S
\
S\\\\
4      4S jj5       r\SSS.S\\   S\\	   S	\\	   S\S   S
\
S\\   4S jj5       r\SSS.S\\   S\\	   S	\\	   S\	S
\
S\\\\\
4      \\   4   4S jj5       rSSSS.S\\   S\\	   S	\\	   S\	S
\
S\\\\\
4      \\   4   4S jjrS%S jrS\S\4S jrS  rS! rS%S" jr\S# 5       rS$rg)&r   i[  zAn instance of this class is created when using :code:`with` on the client.

It contains the sync method execute to send queries
on a sync transport using the same session.
r   c                     Xl         gz;:param client: the :class:`client <gql.client.Client>` usedNr   r;   r   s     r=   r>   SyncClientSession.__init__b      r@   Nrm   rF   r1   r%   re   rA   c                   [        X5      nU R                  R                  (       ar  U R                  R                  U5        UR                  bJ  U(       d  Uc@  U R                  R
                  (       a%  UR                  U R                  R                  5      nU R                  R                  (       a"  U R                  U5      nUR                  5       nOU R                  R                  " U40 UD6nU R                  R                  (       ah  U(       d  Uc^  U R                  R                  (       aC  [        U R                  R                  UR                  UR                  UR                   S9Ul        U$ )aK  Execute the provided request synchronously using
the sync transport, returning an ExecutionResult object.

:param request: GraphQL request as a
                :class:`GraphQLRequest <gql.GraphQLRequest>` object.
:param serialize_variables: whether the variable values should be
    serialized. Used for custom scalars and/or enums.
    By default use the serialize_variables argument of the client.
:param parse_result: Whether gql will deserialize the result.
    By default use the parse_results argument of the client.

The extra arguments are passed to the transport execute method.operation_name)r   r   r+   r   variable_valuesr1   serialize_variable_valuesrD   _execute_futurer   r-   ru   r2   parse_result_fnrI   rP   r   r;   rF   r1   r%   re   future_resultr   s          r=   _executeSyncClientSession._executef  s   . -W= ;;KK  ) &&2&'/DKK4S4S%??@R@RSG;;'' 009M"))+F ^^++F ;; 49R9R-KK&&$$KK#*#9#9	 r@   .rc   rd   Fc                    g rg   rh   ri   s         r=   ru   SyncClientSession.execute  rl   r@   Tc                    g rg   rh   ri   s         r=   ru   r    ro   r@   c                    g rg   rh   ri   s         r=   ru   r    rq   r@   c                   U R                   " U4UUS.UD6nUR                  (       a=  [        [        UR                  5      UR                  UR                  UR
                  S9eUR                  c   S5       eU(       a  U$ UR                  $ )a  Execute the provided request synchronously using
the sync transport.

Raises a TransportQueryError if an error has been returned in
    the ExecutionResult.

:param request: GraphQL query as :class:`GraphQLRequest <gql.GraphQLRequest>`.
:param serialize_variables: whether the variable values should be
    serialized. Used for custom scalars and/or enums.
    By default use the serialize_variables argument of the client.
:param parse_result: Whether gql will deserialize the result.
    By default use the parse_results argument of the client.
:param get_execution_result: return the full ExecutionResult instance instead of
    only the "data" field. Necessary if you want to get the "extensions" field.

The extra arguments are passed to the transport execute method.rm   rN   <Transport returned an ExecutionResult without data or errorsr  rO   r    r&   rP   rQ   r;   rF   r1   r%   rd   re   r   s          r=   ru   r    s    6 
 3%
 	
 ==%!&--0}}[[!,,	  KK#	JI	J#  M{{r@   r1   r%   validate_documentry   r  c                   U R                   R                  (       a  U(       a$  U H  nU R                   R                  U5        M      U(       d  Uc_  U R                   R                  (       aD  U Vs/ s H7  nUR                  b%  UR                  U R                   R                  5      OUPM9     nnU R                  R                  " U40 UD6nU R                   R                  (       aq  U(       d  Ucg  U R                   R                  (       aL  U HF  n[        U R                   R                  WR                  UR                  UR                  S9Ul        MH     U$ s  snf )ao  Execute multiple GraphQL requests in a batch, using
the sync transport, returning a list of ExecutionResult objects.

:param requests: List of requests that will be executed.
:param serialize_variables: whether the variable values should be
    serialized. Used for custom scalars and/or enums.
    By default use the serialize_variables argument of the client.
:param parse_result: Whether gql will deserialize the result.
    By default use the parse_results argument of the client.
:param validate_document: Whether we still need to validate the document.

The extra arguments are passed to the transport execute method.r   r   r+   r   r1   r   r   r-   r   r2   r  rI   rP   r   	r;   ry   r1   r%   r  re   reqresultsr   s	            r=   _execute_batch SyncClientSession._execute_batch  s   . ;; #CKK((- $ ##+0O0O  (  ( ..: 55dkk6H6HI !  (   ....xB6B ;; 49R9R%F"1**'*'9'9	#FK & -s   0>Ec                    g rg   rh   r{   s         r=   r   SyncClientSession.execute_batch.  r~   r@   c                    g rg   rh   r{   s         r=   r   r  9  r   r@   c                    g rg   rh   r{   s         r=   r   r  D  r   r@   c                   U R                   " U4UUS.UD6nU He  nUR                  (       a=  [        [        UR                  5      UR                  UR                  UR
                  S9eUR                  b  M`   S5       e   U(       a  U$ [        [        [        [        [        4      U Vs/ s H  owR                  PM     sn5      $ s  snf )a)  Execute multiple GraphQL requests in a batch, using
the sync transport. This method sends the requests to the server all at once.

Raises a TransportQueryError if an error has been returned in any
  ExecutionResult.

:param requests: List of requests that will be executed.
:param serialize_variables: whether the variable values should be
    serialized. Used for custom scalars and/or enums.
    By default use the serialize_variables argument of the client.
:param parse_result: Whether gql will deserialize the result.
    By default use the parse_results argument of the client.
:param get_execution_result: return the full ExecutionResult instance instead of
    only the "data" field. Necessary if you want to get the "extensions" field.

The extra arguments are passed to the transport execute method.rm   rN   r  r  rO   r    r&   rP   rQ   r   r   r
   r8   r   r;   ry   r1   r%   rd   re   r  r   s           r=   r   r  O  s    6 %%
 3%
 	
 F}})%fmm4!==%00	  'NMN'   NDc3h(W*MW6;;W*MNN*Ms   -C	
c                    SnU(       Gd{  / nU R                   R                  5       nUc  GOZUR                  U5        U R                   R                  5       U R                  R
                  S-
  :  a*  [        R                  " U R                  R                  5        [        U R                  R
                  S-
  5       HV  nU R                   R                  5       (       a    O6U R                   R                  5       nUc  Sn  OUR                  U5        MX     U VVs/ s H  u  pTUPM	     nnnU VVs/ s H  u  pGUPM	     nnn U R                  USSSS9n	[        X5       H  u  pUR                  U5        M     U(       d  GM{  U R                   R#                  5         gs  snnf s  snnf ! [         a&  n
U H  nUR                  U
5        M      Sn
A
GM  Sn
A
ff = f)zLmain loop of the thread used to wait for requests
to execute them in a batchFNr   Tr  )batch_queuegetappendqsizer   r4   timesleepr3   rangeemptyr  r   set_exceptionzip
set_result_batch_thread_stopped_eventset)r;   	stop_looprequests_and_futuresrequest_and_future_rF   ry   futurefuturesr  r   r   s               r=   _batch_loopSyncClientSession._batch_loop  s    	 IK @D@P@P@T@T@V!) ''(:; %%'$++*?*?!*CC

4;;556 4;;00145##))++%)%5%5%9%9%;"%- $I$++,>? 6 3GG2FJG2FHG/CD/C)!v/CGD
151D1D(-!&&+	 2E 2 #&g"7!!&) #8S )Z 	((,,.+ HD  %F((- &s$   F!3F'F- -
G7GGc                     [        U S5      (       d   S5       eU R                  (       a   S5       e[        5       nU R                  R	                  X45        U$ )If batching is enabled, this method will put a request in the batching queue
instead of executing it directly so that the requests could be put in a batch.
r  Batching is not enabledz Batching thread has been stopped)r   _batch_thread_stop_requestedr   r  putr;   rF   r0  s      r=   r   !SyncClientSession._execute_future  sU     t]++F-FF+44X6XX4g./r@   c                    U R                   R                  (       aX  [        5       U l        SU l        [        5       U l        [        U R                  SS9U l	        U R                  R                  5         U R                  R                  5         g)zUConnect the transport and initialize the batch threading loop if batching
is enabled.FT)targetdaemonN)r   rD   r   r  r7  r   r*  r   r2  _batch_threadstartr-   r   rC   s    r=   r   SyncClientSession.connect  sd     ;;''&+gD05D-/4wD,!'t/?/?!MD$$& r@   c                     [        U S5      (       a<  SU l        U R                  R                  S5        U R                  R                  5         U R                  R                  5         g)zClose the transport and cleanup the batching thread if batching is enabled.

Will wait until all the remaining requests in the batch processing queue
have been executed.
r*  TN)r   r7  r  r8  r*  waitr-   r   rC   s    r=   r   SyncClientSession.close  sT     4677 15D-  & ,,113r@   c                     [        S0 U R                  R                  D6nU R                  R	                  [        U5      5      nU R                  R                  U5        gzFetch the GraphQL schema explicitly using introspection.

Don't use this function and instead set the fetch_schema_from_transport
attribute to TrueNrh   r$   r   r/   r-   ru   r   rR   r;   introspection_queryrL   s      r=   r   SyncClientSession.fetch_schema  sQ    
 : 
kk,,
  >>11.AT2UV445EFr@   c                 .    U R                   R                  $ rg   r   r-   rC   s    r=   r-   SyncClientSession.transport      {{$$$r@   )r>  r7  r*  r  r   rA   N)r:   r   r   r   r   r(   r>   r   r   r   r   r   r  r   r   r
   r8   ru   r   r   r  r   r2  r   r   r   r   r   r   r-   r   rh   r@   r=   r   r   [  s   v  /3'+88 &d^	8
 tn8 8 
8t 
 /2'*/2 &d^	
 tn &en  
c3h  
 /2'* &d^	
 tn &dm  
  
 /2'*55 &d^	5
 tn5 #5 5 
tCH~.	/5 5 /3'+%*22 &d^	2
 tn2 #2 2 
tCH~.	/2p /3'+,07~&7 &d^	7
 tn7 $D>7 7 
o	7r 
 /3'+/2#~&# &d^	#
 tn# &en# # 
d38n	# # 
 /3'+$~&$ &d^	$
 tn$ &dm$ $ 
o	$ $ 
 /3'+A~&A &d^	A
 tnA #A A 
tDcN#T/%::	;A A /3'+%*3O~&3O &d^	3O
 tn3O #3O 3O 
tDcN#T/%::	;3Oj3/j 
 !"
G % %r@   r   c                   ~   \ rS rSrSrS\4S jrSSS.S\S\\	   S	\\	   S
\
S\\S4   4
S jjr\SSSS.S\S\\	   S	\\	   S\S   S
\
S\\\\
4   S4   4S jj5       r\SSS.S\S\\	   S	\\	   S\S   S
\
S\\S4   4S jj5       r\SSS.S\S\\	   S	\\	   S\	S
\
S\\\\\
4   S4   \\S4   4   4S jj5       rSSSS.S\S\\	   S	\\	   S\	S
\
S\\\\\
4   S4   \\S4   4   4S jjrSSS.S\S\\	   S	\\	   S
\
S\4
S jjr\SSSS.S\S\\	   S	\\	   S\S   S
\
S\\\
4   4S jj5       r\SSS.S\S\\	   S	\\	   S\S   S
\
S\4S jj5       r\SSS.S\S\\	   S	\\	   S\	S
\
S\\\\
4   \4   4S jj5       rSSSS.S\S\\	   S	\\	   S\	S
\
S\\\\
4   \4   4S jjrSSSS.S\\   S\\	   S	\\	   S\\	   S
\
S\\   4S jjr\SSSS.S\\   S\\	   S	\\	   S\S   S
\
S\\\\
4      4S jj5       r\SSS.S\\   S\\	   S	\\	   S\S   S
\
S\\   4S  jj5       r\SSS.S\\   S\\	   S	\\	   S\	S
\
S\\\\\
4      \\   4   4S! jj5       rSSSS.S\\   S\\	   S	\\	   S\	S
\
S\\\\\
4      \\   4   4S" jjrS,S# jrS\S\R6                  4S$ jrS% rS& rS' rS( r S,S) jr!\"S* 5       r#S+r$g)-r   i  zAn instance of this class is created when using :code:`async with` on a
:class:`client <gql.client.Client>`.

It contains the async methods (execute, subscribe) to send queries
on an async transport using the same session.
r   c                     Xl         gr   r   r   s     r=   r>   AsyncClientSession.__init__   r   r@   Nrm   rF   r1   r%   re   rA   c               "  #    [        X5      nU R                  R                  (       ar  U R                  R                  U5        UR                  bJ  U(       d  Uc@  U R                  R
                  (       a%  UR                  U R                  R                  5      nU R                  R                  " U40 UD6nXPl	         U  Sh  vN nU R                  R                  (       ah  U(       d  Uc^  U R                  R                  (       aC  [        U R                  R                  UR                  UR                  UR                  S9Ul        U7v   M   N
 UR                  5       I Sh  vN    g! UR                  5       I Sh  vN    f = f7f)a  Coroutine to subscribe asynchronously to the provided request
asynchronously using the async transport,
returning an async generator producing ExecutionResult objects.

* Validate the query with the schema if provided.
* Serialize the variable_values if requested.

:param request: GraphQL request as a
                :class:`GraphQLRequest <gql.GraphQLRequest>` object.
:param serialize_variables: whether the variable values should be
    serialized. Used for custom scalars and/or enums.
    By default use the serialize_variables argument of the client.
:param parse_result: Whether gql will deserialize the result.
    By default use the parse_results argument of the client.

The extra arguments are passed to the transport subscribe method.Nr   )r   r   r+   r   r   r1   r   r-   r   
_generatorr2   r  rI   rP   r   r   )r;   rF   r1   r%   re   inner_generatorr   s          r=   
_subscribeAsyncClientSession._subscribe  s1    6 -W= ;;KK  ) &&2&'/DKK4S4S%??@R@RSG NN$$ 	 *	+ / f;;%%#$,1J1J&5 KK..#,,"KK+2+A+A	'  "((***/((***s[   B<F?E1 EEE	BE1 EE1 F*E-+F1FFFF.rc   rd   Fc                    g rg   rh   ri   s         r=   r   AsyncClientSession.subscribeJ  r   r@   Tc                    g rg   rh   ri   s         r=   r   rX  U  r   r@   c                    g rg   rh   ri   s         r=   r   rX  `  r   r@   c                 #    U R                   " U4UUS.UD6n U  Sh  vN nUR                  (       a=  [        [        UR                  5      UR                  UR                  UR
                  S9eUR                  c  Mf  U(       a  U7v   Mt  UR                  7v   M   N
 UR                  5       I Sh  vN    g! UR                  5       I Sh  vN    f = f7f)a(  Coroutine to subscribe asynchronously to the provided request
asynchronously using the async transport.

Raises a TransportQueryError if an error has been returned in
    the ExecutionResult.

:param request: GraphQL query as :class:`GraphQLRequest <gql.GraphQLRequest>`.
:param serialize_variables: whether the variable values should be
    serialized. Used for custom scalars and/or enums.
    By default use the serialize_variables argument of the client.
:param parse_result: Whether gql will deserialize the result.
    By default use the parse_results argument of the client.
:param get_execution_result: yield the full ExecutionResult instance instead of
    only the "data" field. Necessary if you want to get the "extensions" field.

The extra arguments are passed to the transport subscribe method.rm   NrN   )rU  rO   r    r&   rP   rQ   r   )r;   rF   r1   r%   rd   re   rT  r   s           r=   r   rX  m  s     8 BFB
 3%B
 	B
	+ / *f==-)&--8%}}#[[#)#4#4	  [[,+$$kk)*  "((***/((***s[   CB> B#B!B#AB> B> !B##B> $C7B:8C>CCCCc                  #    [        X5      nU R                  R                  (       ar  U R                  R                  U5        UR                  bJ  U(       d  Uc@  U R                  R
                  (       a%  UR                  U R                  R                  5      nU R                  R                  (       a$  U R                  U5      I Sh  vN nUI Sh  vN nOM[        U R                  R                  5         U R                  R                  " U40 UD6I Sh  vN nSSS5        U R                  R                  (       ah  U(       d  Uc^  U R                  R                  (       aC  [        U R                  R                  UR                  WR                   UR"                  S9Ul        W$  N N N! , (       d  f       N= f7f)a  Coroutine to execute the provided request asynchronously using
the async transport, returning an ExecutionResult object.

* Validate the query with the schema if provided.
* Serialize the variable_values if requested.

:param request: GraphQL request as a
                :class:`GraphQLRequest <gql.GraphQLRequest>` object.
:param serialize_variables: whether the variable values should be
    serialized. Used for custom scalars and/or enums.
    By default use the serialize_variables argument of the client.
:param parse_result: Whether gql will deserialize the result.
    By default use the parse_results argument of the client.

The extra arguments are passed to the transport execute method.Nr   )r   r   r+   r   r   r1   r   rD   r   r   r0   r-   ru   r2   r  rI   rP   r   r  s          r=   r  AsyncClientSession._execute  sH    4 -W= ;;KK  ) &&2&'/DKK4S4S%??@R@RSG ;;''"&"6"6w"??M((F DKK778#~~55    9 ;; 49R9R-KK&&$$KK#*#9#9	 ) @( 98sO   CG
F,	GF.$G9!F2F0F2BG.G0F22
G <Gc                   #    g 7frg   rh   ri   s         r=   ru   AsyncClientSession.execute  r   r   c                   #    g 7frg   rh   ri   s         r=   ru   r_    r   r   c                   #    g 7frg   rh   ri   s         r=   ru   r_    r   r   c                8  #    U R                   " U4UUS.UD6I Sh  vN nUR                  (       a=  [        [        UR                  5      UR                  UR                  UR
                  S9eUR                  c   S5       eU(       a  U$ UR                  $  N{7f)a  Coroutine to execute the provided request asynchronously using
the async transport.

Raises a TransportQueryError if an error has been returned in
    the ExecutionResult.

:param request: GraphQL query as :class:`GraphQLRequest <gql.GraphQLRequest>`.
:param serialize_variables: whether the variable values should be
    serialized. Used for custom scalars and/or enums.
    By default use the serialize_variables argument of the client.
:param parse_result: Whether gql will deserialize the result.
    By default use the parse_results argument of the client.
:param get_execution_result: return the full ExecutionResult instance instead of
    only the "data" field. Necessary if you want to get the "extensions" field.

The extra arguments are passed to the transport execute method.rm   NrN   r  r  r  s          r=   ru   r_    s     6 }}
 3%
 	
 
 ==%!&--0}}[[!,,	  KK#	JI	J#  M{{/
s   BBA<Br  ry   r  c                  #    U R                   R                  (       a  U(       a$  U H  nU R                   R                  U5        M      U(       d  Uc_  U R                   R                  (       aD  U Vs/ s H7  nUR                  b%  UR                  U R                   R                  5      OUPM9     nnU R                  R                  " U40 UD6I Sh  vN nU R                   R                  (       aq  U(       d  Ucg  U R                   R                  (       aL  U HF  n[        U R                   R                  WR                  UR                  UR                  S9Ul        MH     U$ s  snf  N7f)av  Execute multiple GraphQL requests in a batch, using
the async transport, returning a list of ExecutionResult objects.

:param requests: List of requests that will be executed.
:param serialize_variables: whether the variable values should be
    serialized. Used for custom scalars and/or enums.
    By default use the serialize_variables argument of the client.
:param parse_result: Whether gql will deserialize the result.
    By default use the parse_results argument of the client.
:param validate_document: Whether we still need to validate the document.

The extra arguments are passed to the transport execute_batch method.Nr   r  r  s	            r=   r  !AsyncClientSession._execute_batch8  s(    . ;; #CKK((- $ ##+0O0O  (  ( ..: 55dkk6H6HI !  (   44XHHH ;; 49R9R%F"1**'*'9'9	#FK & - Is   A0E,2>E%0"E,E*BE,c                   #    g 7frg   rh   r{   s         r=   r    AsyncClientSession.execute_batchq  r   r   c                   #    g 7frg   rh   r{   s         r=   r   rf  |  r   r   c                   #    g 7frg   rh   r{   s         r=   r   rf    r   r   c                  #    U R                   " U4UUS.UD6I Sh  vN nU He  nUR                  (       a=  [        [        UR                  5      UR                  UR                  UR
                  S9eUR                  b  M`   S5       e   U(       a  U$ [        [        [        [        [        4      U Vs/ s H  owR                  PM     sn5      $  Ns  snf 7f)a*  Execute multiple GraphQL requests in a batch, using
the async transport. This method sends the requests to the server all at once.

Raises a TransportQueryError if an error has been returned in any
  ExecutionResult.

:param requests: List of requests that will be executed.
:param serialize_variables: whether the variable values should be
    serialized. Used for custom scalars and/or enums.
    By default use the serialize_variables argument of the client.
:param parse_result: Whether gql will deserialize the result.
    By default use the parse_results argument of the client.
:param get_execution_result: return the full ExecutionResult instance instead of
    only the "data" field. Necessary if you want to get the "extensions" field.

The extra arguments are passed to the transport execute method.rm   NrN   r  r  r  s           r=   r   rf    s     6 ++
 3%
 	
 
 F}})%fmm4!==%00	  'NMN'   NDc3h(W*MW6;;W*MNN1
0 +Ns(   CCA"C4C7C
CCc                 X  #    SnU(       Gd  / nU R                   R                  5       I Sh  vN nUc  GOaUR                  U5        U R                   R                  5       U R                  R
                  S-
  :  a2  [        R                  " U R                  R                  5      I Sh  vN   [        U R                  R
                  S-
  5       H6  n U R                   R                  5       nUc  Sn  OUR                  U5        M8     U VVs/ s H  u  pTUPM	     nnnU VVs/ s H  u  pGUPM	     nnn U R                  USSSS9I Sh  vN n	[        X5       H-  u  pUR                  5       (       a  M  UR                  U
5        M/     U(       d  GM  U R$                  R'                  5         g GN GN! [        R                   a       M  f = fs  snnf s  snnf  N! [          a;  nU H+  nUR                  5       (       a  M  UR#                  U5        M-      SnANSnAff = f7f)zJMain loop of the task used to wait for requests
to execute them in a batchFNr   Tr  )r  r   r!  r"  r   r4   rZ   r$  r3   r%  
get_nowait
QueueEmptyr  r(  	cancelledr)  r   r'  _batch_task_stopped_eventr+  )r;   r,  r-  r.  r/  rF   ry   r0  r1  r  r   r   s               r=   r2  AsyncClientSession._batch_loop  s     	PR  &&**,,  ") ''(:; %%'$++*?*?!*CCmmDKK$>$>??? 4;;00145)-)9)9)D)D)F&)1$(	(//0BC 6" 3GG2FJG2FHG/CD/C)!v/CGD27;7J7J(-!&&+	 8K 8 2 '*'&;NF!++--))&1 '<i )~ 	&&**,s - @ )) 
 HD2  2%F!++--,,S1 &2s   *H*F2A<H*)F5*)H*F83H*5F8	H*GH*%G3H*7G" G 'G" 8G" H*H*5H*8GH*GH* G" "
H',H"H"H*"H''H*c                    #    [        U S5      (       d   S5       eU R                  (       a   S5       e[        R                  " 5       nU R                  R                  X45      I Sh  vN   U$  N7f)r5  r  r6  zBatching task has been stoppedN)r   _batch_task_stop_requestedrZ   r   r  r8  r9  s      r=   r   "AsyncClientSession._execute_future  sh      t]++F-FF+22T4TT2!(!1""G#4555 	6s   A%A0'A.(A0c                   #    U R                   R                  (       ae  [        R                  " 5       U l        SU l        [        R                  " 5       U l        [        R                  " U R                  5       5      U l
        gg7f)z6Initialize the batch task loop if batching is enabled.FN)r   rD   rZ   r   r  rq  r   rn  create_taskr2  _batch_taskrC   s    r=   _batch_initAsyncClientSession._batch_init  sW     ;;''.5mmoD.3D+-4]]_D*&2243C3C3EFD	 (s   BBc                    #    [        U S5      (       aM  SU l        U R                  R                  S5      I Sh  vN   U R                  R                  5       I Sh  vN   gg N( N7f)z1Cleanup the batching task if batching is enabled.rn  TN)r   rq  r  r8  rn  rB  rC   s    r=   _batch_cleanup!AsyncClientSession._batch_cleanup&  s`     4455 /3D+""&&t,,, 0055777 6 - 8s!   7A&A"!A&A$A&$A&c                    #    U R                  5       I Sh  vN    U R                  R                  5       I Sh  vN   g N( N! [         a*  nU R                  R	                  5       I Sh  vN    UeSnAff = f7f)zPConnect the transport and initialize the batch task loop if batching
is enabled.N)rv  r-   r   r   r   )r;   es     r=   r   AsyncClientSession.connect1  sh         	..((*** 	! + 	..&&(((G	sL   A:?A:A AA A:A 
A7A2*A-+A22A77A:c                    #    U R                  5       I Sh  vN   U R                  R                  5       I Sh  vN   g N' N7f)zClose the transport and cleanup the batching task if batching is enabled.

Will wait until all the remaining requests in the batch processing queue
have been executed.
N)ry  r-   r   rC   s    r=   r   AsyncClientSession.close=  s7      !!###nn""$$$ 	$$s   A>!AA A Ac                    #    [        S0 U R                  R                  D6nU R                  R	                  [        U5      5      I Sh  vN nU R                  R                  U5        g N 7frE  rF  rG  s      r=   r   AsyncClientSession.fetch_schemaG  sc     
 : 
kk,,
 "&!7!7./"
 
 	445EF	
s   AA,	A*
!A,c                 .    U R                   R                  $ rg   rK  rC   s    r=   r-   AsyncClientSession.transportU  rM  r@   )ru  rq  rn  rS  r  r   rN  )%r:   r   r   r   r   r(   r>   r   r   r   r   r   r   rU  r   r   r
   r8   r   r   r  ru   r   r  r   r2  rZ   r   r   rv  ry  r   r   r   r   r-   r   rh   r@   r=   r   r     s   v  /3'+D+D+ &d^	D+
 tnD+ D+ 
-	.D+L 
 /2'*/233 &d^	3
 tn3 &en3 3 
S#X,	-3 3 
 /2'*44 &d^	4
 tn4 &dm4 4 
-	.4 4 
 /2'*

 &d^	

 tn
 #
 
 
tCH~t+,n_d=R.SS

 
  /3'+%*5+5+ &d^	5+
 tn5+ #5+ 5+ 
tCH~t+,n_d=R.SS
5+v /3'+== &d^	=
 tn= = 
=~ 
 /2'*/2 &d^	
 tn &en  
c3h  
 /2'* &d^	
 tn &dm  
  
 /2'*55 &d^	5
 tn5 #5 5 
tCH~.	/5 5 /3'+%*22 &d^	2
 tn2 #2 2 
tCH~.	/2p /3'+,07~&7 &d^	7
 tn7 $D>7 7 
o	7r 
 /3'+/2#~&# &d^	#
 tn# &en# # 
d38n	# # 
 /3'+$~&$ &d^	$
 tn$ &dm$ $ 
o	$ $ 
 /3'+A~&A &d^	A
 tnA #A A 
tDcN#T/%::	;A A /3'+%*3O~&3O &d^	3O
 tn3O #3O 3O 
tDcN#T/%::	;3OjE-N 
 G	8
%G % %r@   r   
_CallableT.)boundc                   $  ^  \ rS rSrSrSSS.S\S\\\4   S\\\4   4S jjr	S	 r
S
 rS rS rS rSSS.S\S\\   S\\   S\S\4
U 4S jjjrSSS.S\S\\   S\\   S\S\4
S jjrSSS.S\S\\   S\\   S\S\\S4   4
U 4S jjjrSrU =r$ )r   i^  a(  An instance of this class is created when using the
:meth:`connect_async <gql.client.Client.connect_async>` method of the
:class:`Client <gql.client.Client>` class with :code:`reconnecting=True`.

It is used to provide a single session which will reconnect automatically if
the connection fails.
T)retry_connectretry_executer   r  r  c                   Xl         SU l        [        R                  " 5       U l        [        R                  " 5       U l        USL a.  [        R                  " [        R                  [        SS9U l
        O&USL a	  S U l
        O[        U5      (       d   eX l
        USL a0  [        R                  " [        R                  [        SS S	9U l        O&USL a	  S
 U l        O[        U5      (       d   eX0l        U R                  U R                  5      U l        U R                  U R                  R                   5      U l        g)a  
:param client: the :class:`client <gql.client.Client>` used.
:param retry_connect: Either a Boolean to activate/deactivate the retries
    for the connection to the transport OR a backoff decorator to
    provide specific retries parameters for the connections.
:param retry_execute: Either a Boolean to activate/deactivate the retries
    for the execute method OR a backoff decorator to
    provide specific retries parameters for this method.
NT<   )	max_valueFc                     U $ rg   rh   r|  s    r=   <lambda>9ReconnectingAsyncClientSession.__init__.<locals>.<lambda>      1r@      c                 "    [        U [        5      $ rg   )r7   r    r  s    r=   r  r    s    A/B!Cr@   )	max_triesgiveupc                     U $ rg   rh   r  s    r=   r  r    r  r@   )r   _connect_taskrZ   r   _reconnect_request_event_connected_eventbackoffon_exceptionexpor   r  callabler  _execute_once_execute_with_retriesr-   r   _connect_with_retries)r;   r   r  r  s       r=   r>   'ReconnectingAsyncClientSession.__init__g  s     !(/% 'D  ")!5!5"D
 e#!,DM****!.D !(!5!5C	"D e#!,DM****!. &*%7%78J8J%K"%)%7%78N8N%O"r@   c                 p  #     U R                  5       I Sh  vN   U R                  R                  5         U R                  R                  5         U R                  R                  5         U R                  R                  5       I Sh  vN   U R                  R                  5       I Sh  vN   M   N N* N
7f)zCoroutine used for the connection task.

- try to connect to the transport with retries
- send a connected event when the connection has been made
- then wait for a reconnect request to try to connect again
N)r  r  r+  clearr  rB  r-   r   rC   s    r=   _connection_loop/ReconnectingAsyncClientSession._connection_loop  s       ,,... !!%%'!!'') ))//1//44666..&&(((  / 7(s4   B6B0A/B6B2!B6)B4*B62B64B6c                    #    U R                   (       a  [        R                  S5        g[        R                  " U R                  5       5      U l         U R                  R                  5       I Sh  vN   g N7f)zbStart the task responsible to restart the connection
of the transport when requested by an event.
zconnect task already started!N)r  logwarningrZ   r   r  r  rB  rC   s    r=   start_connecting_task4ReconnectingAsyncClientSession.start_connecting_task  sQ      KK78!(!6!6t7L7L7N!OD'',,...s   A.A80A61A8c                 j   #    U R                   b"  U R                   R                  5         SU l         gg7f)zStop the connecting task.N)r  r   rC   s    r=   stop_connecting_task3ReconnectingAsyncClientSession.stop_connecting_task  s0     )%%'!%D *s   13c                 t   #    U R                  5       I Sh  vN   U R                  5       I Sh  vN   g N N7f)zQStart the connect task and initialize the batch task loop if batching
is enabled.N)rv  r  rC   s    r=   r   &ReconnectingAsyncClientSession.connect  s3         ((*** 	!*s   848688c                    #    U R                  5       I Sh  vN   U R                  5       I Sh  vN   U R                  R                  5       I Sh  vN   g N? N) N	7f)zKStop the connect task and cleanup the batching task
if batching is enabled.N)ry  r  r-   r   rC   s    r=   r   $ReconnectingAsyncClientSession.close  sL      !!###'')))nn""$$$	 	$)$s1   AAAA!AAAAANrm   rF   r1   r%   re   rA   c                   >#     [         TU ]  " U4UUS.UD6I Sh  vN nU$  N! [         a    U R                  R	                  5         e f = f7f)z|Same Coroutine as parent method _execute but requesting a
reconnection if we receive a TransportConnectionFailed exception.
rm   N)superr  r   r  r+  )r;   rF   r1   r%   re   answer	__class__s         r=   r  ,ReconnectingAsyncClientSession._execute_once  sh     		 7+$7) 	 F  ) 	))--/	s%   A% #% A% &AAc                J   #    U R                   " U4UUS.UD6I Sh  vN $  N7f)zSame Coroutine as parent, but with optional retries
and requesting a reconnection if we receive a
TransportConnectionFailed exception.
rm   N)r  )r;   rF   r1   r%   re   s        r=   r  'ReconnectingAsyncClientSession._execute  s<      //
 3%
 	
 
 	
 
s   #!#c               &  >#    [         TU ]  " U4UUS.UD6n U  Sh  vN nU7v   M   N
 O)! [         a    U R                  R	                  5         e f = f UR                  5       I Sh  vN    g! UR                  5       I Sh  vN    f = f7f)zSame Async generator as parent method _subscribe but requesting a
reconnection if we receive a TransportConnectionFailed exception.
rm   N)r  rU  r   r  r+  r   )r;   rF   r1   r%   re   rT  r   r  s          r=   rU  )ReconnectingAsyncClientSession._subscribe  s      BGASB
 3%B
 	B
		+ / f ) 	))--/	 !0 "((***/((***s[   B/ -+-/ -/ A3 &AA3 B,A/-B3BB
BB)r  r  r  r  r  r   r  r  )r:   r   r   r   r   r(   r   r   
_Decoratorr>   r  r  r  r   r   r   r   r   r   r  r  r   rU  r   __classcell__)r  s   @r=   r   r   ^  sF    26155P5P T:-.	5P
 T:-.5Pn),	/&+% /3'+ &d^	
 tn  
 : /3'+

 &d^	

 tn
 
 

0 /3'+++ &d^	+
 tn+ + 
-	.+ +r@   r   )?rZ   loggingr#  rW   concurrent.futuresr   queuer   	threadingr   r   typingr   r   r	   r
   r   r   r   r   r   r   r   r   r   r  anyior   graphqlr   r   r   r   r   r   graphql_requestr   r   transport.async_transportr   transport.exceptionsr   r    transport.local_schemar!   transport.transportr"   	utilitiesr#   r$   r%   r  utilsr&   	getLoggerr:   r  r(   r   r   r  r  r   rh   r@   r=   <module>r     s        %  #        H 5 P 8 * G 6 $!i iXZ% Z%z_	% _	%D \#s();<
zlJ./
A+%7 A+r@   