
    Cjѐ                        S r SSKrSSKrSSKJrJr  SSKJr  SSKJ	r	J
r
JrJrJrJr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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+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4J5r5J6r6J7r7J8r8J9r9J:r:J;r;J<r<J=r=J>r>J?r?J@r@JArAJBrBJCrCJDrD  SSKEJFrF  SS	KGJHrH  SS
KIJJrJ  \R                  " \L5      rM\R                  " S5      rOS\	S\\9   4S jrPS\	S\ S\\9   4S jrQSSSSS\H4S jrR " S S5      rS " S S\5      rT " S S\T5      rU " S S\T5      rV " S S\U\V5      rW " S S \W5      rX " S! S"\W5      rY " S# S$\W5      rZ " S% S&5      r[ " S' S(5      r\ " S) S*5      r] " S+ S,\5      r^ " S- S.\T5      r_ " S/ S0\T5      r` " S1 S2\^5      ra " S3 S4\a\`5      rb " S5 S6\b5      rc " S7 S8\^\_5      rd " S9 S:\^\_\U5      reg);a  
.. image:: http://www.plantuml.com/plantuml/png/ZLAzJWCn3Dxz51vXw1im50ag8L4XwC1OkLTJ8gMvAd4GwEYxGuC8pTbKtUxy_TZEvsaIYfAt7e1MII9rWfsdbF1cSRzWpvtq4GT0JENduX8GXr_g7brQlf5tw-MBOx_-HlS0LV_Kzp8xr1kZav9PfCsMWvolEA_1VylHoZCExKwKv4Tg2s_VkSkca2kof2JDb0yxZYIk3qMZYUe1B1uUZOROXn96pQMugEMUdRnUUqUf6DBXQyIz2zu5RlgUQAFVNYaeRfBI79_JrUTaeg9JZFQj5MmUc69PDmNGE2iU61fDgfri3x36gxHw3gDHD6xqqQ7P4vjKqz2-602xtkO7uo17SCLhVSv25VjRjUAFcUE73Sspb8ADBl8gTT7j2cFAOPst_Wi0  # noqa
    :alt: UML diagram
    N)ABCabstractmethod)isfinite)AnyDictIterableMappingOptionalTupleUnioncast)3ArgumentNodeBooleanValueNodeDocumentNodeEnumValueNode	FieldNodeFloatValueNodeFragmentDefinitionNodeFragmentSpreadNodeGraphQLArgumentGraphQLEnumTypeGraphQLErrorGraphQLField	GraphQLIDGraphQLInputObjectTypeGraphQLInputTypeGraphQLInterfaceTypeGraphQLListGraphQLNamedTypeGraphQLNonNullGraphQLObjectTypeGraphQLScalarTypeGraphQLSchemaGraphQLStringInlineFragmentNodeIntValueNodeListTypeNodeListValueNodeNamedTypeNodeNameNodeNonNullTypeNodeNullValueNodeObjectFieldNodeObjectValueNodeOperationDefinitionNodeOperationTypeSelectionSetNodeStringValueNodeTypeNode	Undefined	ValueNodeVariableDefinitionNodeVariableNodeget_named_typeintrospection_typesis_enum_typeis_input_object_typeis_leaf_typeis_list_typeis_non_null_typeis_wrapping_type	print_ast)inspect   )GraphQLRequest)to_camel_casez^-?(?:0|[1-9][0-9]*)$
serializedreturnc                    U b	  U [         L a
  [        5       $ [        U [        5      (       a2  S U R	                  5        5       n[        S U 5       5      n[        US9$ [        U [        5      (       a9  [        U [        5      (       d$  S U  5       n[        S U 5       5      n[        US9$ [        U [        5      (       a	  [        U S9$ [        U [        5      (       a  [        [        U 5      S9$ [        U [        5      (       a?  [        U 5      (       a/  [        U 5      nUR!                  S	5      (       a  USS
 n[#        US9$ [        U [        5      (       a	  [%        U S9$ ['        S[)        U 5       S35      e)a  Given a serialized value, try our best to produce an AST.

Anything ressembling an array (instance of Mapping) will be converted
to an ObjectFieldNode.

Anything ressembling a list (instance of Iterable - except str)
will be converted to a ListNode.

In some cases, a custom scalar can be serialized differently in the query
than in the variables. In that case, this function will not work.Nc              3   @   #    U  H  u  pU[        U5      4v   M     g 7fN!ast_from_serialized_value_untyped).0keyvalues      Y/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/gql/dsl.py	<genexpr>4ast_from_serialized_value_untyped.<locals>.<genexpr>[   s$      
0
 3E:;0s   c              3   Z   #    U  H!  u  pU(       d  M  [        [        US 9US9v   M#     g7frN   )namerN   Nr-   r*   rL   
field_namefield_values      rO   rP   rQ   _   ,      
+6'
 PO
!;;O+6   ++fieldsc              3   8   #    U  H  n[        U5      v   M     g 7frI   rJ   )rL   items     rO   rP   rQ   g   s     V:48>>:   c              3   6   #    U  H  o(       d  M  Uv   M     g 7frI    rL   nodes     rO   rP   rQ   h   s     ;{tddd{   
	valuesrT   z.0zCannot convert value to AST: .)r4   r,   
isinstancer	   itemstupler.   r   strr(   boolr   intr&   floatr   endswithr   r2   	TypeErrorrA   )rE   field_itemsfield_nodesmaybe_nodesnodesrN   s         rO   rK   rK   K   sN    Z94*g&&
(..0
  
+6
 

 k22*h''
:s0K0KV:V;{;;E***d##j11*c""#j/22*e$$*)=)=J>>$#2JEE***c""Z00
3GJ4G3HJ
KK    rN   type_c                   ^ ^	 [        T [        5      (       a  T R                  U5      R                  $ [	        U5      (       aW  [        [        U5      nUR                  n[        T U5      n[        U[        5      (       a  [        S[        U5       S35      eU$ T c
  [        5       $ T [        L a  [        S[        U5       S35      e[        U5      (       ay  [        [        U5      nUR                  m	[        T [        5      (       a<  [        T [         5      (       d'  U	4S jT  5       n[#        S U 5       5      n[%        US9$ [        T T	5      $ ['        U5      (       ah  T b  [        T [(        5      (       d  g[        [*        U5      nU 4S jUR,                  R/                  5        5       n[#        S	 U 5       5      n[1        US
9$ [3        U5      (       a  UR5                  T 5      n[        U[         5      (       aN  [7        U5      (       a	  [9        US9$ U[:        L a#  [<        R?                  U5      (       a	  [A        US9$ [C        US9$ [E        U5      $ [G        S[        U5       S35      e)a  
This is a partial copy paste of the ast_from_value function in
graphql-core utilities/ast_from_value.py

Overwrite the if blocks that use recursion and add a new case to return a
VariableNode when value is a DSLVariable

Produce a GraphQL Value AST given a Python object.

Raises a GraphQLError instead of returning None if we receive an Undefined
of if we receive a Null value for a Non-Null type.
z(Received Null value for a Non-Null type ri   Nz"Received Undefined value for type c              3   <   >#    U  H  n[        UT5      v   M     g 7frI   )ast_from_value)rL   r_   	item_types     rO   rP   !ast_from_value.<locals>.<genexpr>   s      SUTi!@!@Us   c              3   6   #    U  H  o(       d  M  Uv   M     g 7frI   rb   rc   s     rO   rP   r}      s     K1Bd1Bre   rf   c              3   n   >#    U  H*  u  pUT;   d  M  U[        TU   UR                  5      4v   M,     g 7frI   )r{   type)rL   rX   fieldrN   s      rO   rP   r}      s;      
%9!
U" HZj(95::FG%9s   5"5c              3   Z   #    U  H!  u  pU(       d  M  [        [        US 9US9v   M#     g7frS   rV   rW   s      rO   rP   r}      rZ   r[   r\   rT   zUnexpected input type: )$rj   DSLVariableset_typeast_variable_namer>   r   r    of_typer{   r,   r   rA   r4   r=   r   r   rm   rl   r(   r;   r	   r   r]   rk   r.   r<   	serializer:   r   r   _re_integer_stringmatchr&   r2   rK   rr   )
rN   rx   
inner_type	ast_valuemaybe_value_nodesvalue_nodesrs   rt   rE   r|   s
   `        @rO   r{   r{   }   s4    %%%~~e$666^U+]]
"5*5	i//:gj>Q=RRST   } 	??OqQRR E[%(MM	eX&&z%/E/E SU SK1BKKK 44eY// E""=
5' : :+U3
%*\\%7%7%9

  
+6
 

 k22E __U+
 j#&&E""$:66 	!&8&>&>z&J&J#*55"44 1<< -gen-=Q?
@@rw   
operationsDSLExecutableoperations_with_namec                  J   / U QS UR                  5        5       Q7nUR                  5        H  u  p4X4l        M     U H0  n[        U[        5      (       a  M  [        S[        U5       S35      e   [        U Vs/ s H  oDR                  PM     snS9n[        U5      $ s  snf )a  Given arguments instances of :class:`DSLExecutable`
containing GraphQL operations or fragments,
generate a Document which can be executed later in a
gql client or a gql session.

Similar to the :func:`gql.gql` function but instead of parsing a python
string to describe the request, we are using operations which have been generated
dynamically using instances of :class:`DSLField`, generated
by instances of :class:`DSLType` which themselves originated from
a :class:`DSLSchema` class.

:param \*operations: the GraphQL operations and fragments
:type \*operations: DSLQuery, DSLMutation, DSLSubscription, DSLFragment
:param \**operations_with_name: the GraphQL operations with an operation name
:type \**operations_with_name: DSLQuery, DSLMutation, DSLSubscription

:return: a :class:`GraphQLRequest <gql.GraphQLRequest>`
    which can be later executed or subscribed by a
    :class:`Client <gql.client.Client>`, by an
    :class:`async session <gql.client.AsyncClientSession>` or by a
    :class:`sync session <gql.client.SyncClientSession>`

:raises TypeError: if an argument is not an instance of :class:`DSLExecutable`
:raises AttributeError: if a type has not been provided in a :class:`DSLFragment`
c              3   $   #    U  H  ov   M     g 7frI   rb   )rL   	operations     rO   rP   dsl_gql.<locals>.<genexpr>   s     	C%B	)%Bs   zsOperations should be instances of DSLExecutable (DSLQuery, DSLMutation, DSLSubscription or DSLFragment).
Received: ri   )definitions)
rg   rk   rU   rj   r   rr   r   r   executable_astrC   )r   r   all_operationsrU   r   documents         rO   dsl_gqlr      s    <3	3	C%9%@%@%B	C3N 0557 8 $	)]33!)_-Q0  $ ?MN~)--~NH (## Os   ;B c                   8    \ rS rSrSrS\4S jrS\SS4S jrS	r	g
)	DSLSchemai  zThe DSLSchema is the root of the DSL code.

Attributes of the DSLSchema class are generated automatically
with the `__getattr__` dunder method in order to generate
instances of :class:`DSLType`
schemac                 h    [        U[        5      (       d  [        S[        U5       35      eXl        g)a  Initialize the DSLSchema with the given schema.

:param schema: a GraphQL Schema provided locally or fetched using
               an introspection query. Usually `client.schema`
:type schema: GraphQLSchema

:raises TypeError: if the argument is not an instance of :class:`GraphQLSchema`
z1DSLSchema needs a schema as parameter. Received: N)rj   r#   rr   r   _schema)selfr   s     rO   __init__DSLSchema.__init__  s3     &-00CDL>R  '-rw   rU   rF   DSLTypec                     U R                   R                  U5      nUc  [        SU S35      e[        U[        [
        45      (       d  [        SU SU< S35      e[        X 5      $ )NzType 'z' not found in the schema!zType "z (z`)" is not valid as an attribute of DSLSchema. Only Object types or Interface types are accepted.)r   get_typeAttributeErrorrj   r!   r   r   )r   rU   type_defs      rO   __getattr__DSLSchema.__getattr__(  sx    /3||/D/DT/J 6$/I!JKK(%68L$MNN b -Q Q 
 x&&rw   )r   N)
__name__
__module____qualname____firstlineno____doc__r#   r   rm   r   __static_attributes__rb   rw   rO   r   r     s&    -} -"' '	 'rw   r   c                   h    \ rS rSr% Sr\\S'       SS jr\S	SS
\	4S j5       r
SSSSS
\4S jrSrg)DSLSelectori8  aJ  DSLSelector is an abstract class which defines the
:meth:`select <gql.dsl.DSLSelector.select>` method to select
children fields in the query.

Inherited by
:class:`DSLRootFieldSelector <gql.dsl.DSLRootFieldSelector>`,
:class:`DSLFieldSelector <gql.dsl.DSLFieldSelector>`
:class:`DSLFragmentSelector <gql.dsl.DSLFragmentSelector>`
selection_setr]   DSLSelectablefields_with_aliasDSLSelectableWithAliasc                 b    [        SS9U l        U(       d  U(       a  U R                  " U0 UD6  gg):meta private:rb   )
selectionsN)r1   r   selectr   r]   r   s      rO   r   DSLSelector.__init__E  s.     .<&KK5#45 'rw   r   rF   c                     [        S5      e)Nz:Any DSLSelector subclass must have a is_valid_field methodNotImplementedError)r   r   s     rO   is_valid_fieldDSLSelector.is_valid_fieldP  s    !H
 	
rw   c                    [         R                  X5      nU HX  n[        U[        5      (       d  [	        S[        U5       35      eU R                  U5      (       a  MG  [        SU < SU< 35      e   [        S U 5       5      nU R                  R                  U-   U R                  l
        [        R                  SU SU < 35        g)ar  Select the fields which should be added.

:param \*fields: fields or fragments
:type \*fields: DSLSelectable
:param \**fields_with_alias: fields or fragments with alias as key
:type \**fields_with_alias: DSLSelectable

:raises TypeError: if an argument is not an instance of :class:`DSLSelectable`
:raises graphql.error.GraphQLError: if an argument is not a valid field
z7Fields should be instances of DSLSelectable. Received: zInvalid field for z: c              3   8   #    U  H  oR                   v   M     g 7frI   )	ast_field)rL   r   s     rO   rP   %DSLSelector.select.<locals>.<genexpr>x  s     <|e//|r`   zAdded fields: z in N)DSLFieldget_aliased_fieldsrj   r   rr   r   r   r   rl   r   r   logdebug)r   r]   r   added_fieldsr   added_selectionss         rO   r   DSLSelector.selectV  s      5=4O4O5

 "Ee]33!!%e/ 
 &&u--"%7xr%#KLL " <|<< 	
 )-(:(:(E(EHX(X%		N<.TH=>rw   )r   Nr]   r   r   r   )r   r   r   r   r   r1   __annotations__r   r   rn   r   r   r   r   rb   rw   rO   r   r   8  si     $#	6 	6 6	6 
O 
 
 

'? '? 6'? 
	'?rw   r   c                   j    \ rS rSr% SrS\S'   \\   \S'   \\S'   \	\
S 5       5       r    SS jrS	rg
)r   i  zInterface for the root elements which can be executed
in the :func:`dsl_gql <gql.dsl.dsl_gql>` function

Inherited by
:class:`DSLOperation <gql.dsl.DSLOperation>` and
:class:`DSLFragment <gql.dsl.DSLFragment>`
DSLVariableDefinitionsvariable_definitionsrU   r   c                     [        S5      e)8Generates the ast for :func:`dsl_gql <gql.dsl.dsl_gql>`.z<Any DSLExecutable subclass must have executable_ast propertyr   r   s    rO   r   DSLExecutable.executable_ast  s     "J
 	
rw   c                 d    SU l         [        5       U l        [        R                  " U /UQ70 UD6  g)a  Given arguments of type :class:`DSLSelectable` containing GraphQL requests,
generate an operation which can be converted to a Document
using the :func:`dsl_gql <gql.dsl.dsl_gql>`.

The fields arguments should be either be fragments or
fields of root GraphQL types
(Query, Mutation or Subscription) and correspond to the
operation_type of this operation.

:param \*fields: root fields or fragments
:type \*fields: DSLSelectable
:param \**fields_with_alias: root fields or fragments with alias as key
:type \**fields_with_alias: DSLSelectable

:raises TypeError: if an argument is not an instance of :class:`DSLSelectable`
:raises AssertionError: if an argument is not a field which correspond
                        to the operation type
N)rU   r   r   r   r   r   s      rO   r   DSLExecutable.__init__  s/    0 	$:$<!T@F@.?@rw   )rU   r   Nr   )r   r   r   r   r   r   r
   rm   r1   propertyr   r   r   r   rb   rw   rO   r   r     sS     32
3-##
  
A A 6Arw   c                   *    \ rS rSrSrSSS\4S jrSrg)	DSLRootFieldSelectori  zClass used to define the
:meth:`is_valid_field <gql.dsl.DSLRootFieldSelector.is_valid_field>` method
for root fields for the :meth:`select <gql.dsl.DSLSelector.select>` method.

Inherited by
:class:`DSLOperation <gql.dsl.DSLOperation>`
r   r   rF   c                 \   [        U [        5      (       d   eU R                  R                  n[        U[        5      (       a,  UR                  S;   a  US:H  $ UR                  S:X  a  US:g  $  g	[        U[
        5      (       a  UR                  c   eUR                  R                  R                  nSnUS:X  a  UR                  nO%US:X  a  UR                  nOUS:X  a  UR                  nUc  [        R                  SU S35        g	UR                  R                  UR                  :H  $ g	)
ae  Check that a field is valid for a root field.

For operations, the fields arguments should be fields of root GraphQL types
(Query, Mutation or Subscription) and correspond to the
operation_type of this operation.

the :code:`__typename` field can only be added to Query or Mutation.
the :code:`__schema` and :code:`__type` field can only be added to Query.
)__schema__typeQUERY
__typenameSUBSCRIPTIONNMUTATIONzRoot type of type z not found in the schema!F)rj   DSLOperationoperation_typerU   DSLMetaFieldr   dsl_type_dsl_schemar   
query_typemutation_typesubscription_typer   errorparent_type)r   r   operation_namer   	root_types        rO   r   #DSLRootFieldSelector.is_valid_field  s#    $----,,11e\**zz33%00zz\)%77 *4 / x((>>---^^//77FI("--	:-"00	>1"44	 		((88QR $$))Y^^;;rw   rb   N)r   r   r   r   r   rn   r   r   rb   rw   rO   r   r     s    ,O , ,rw   r   c                   J    \ rS rSr% Sr\\S'   \S\4S j5       r	S\
4S jrSrg)	r   i  zInterface for GraphQL operations.

Inherited by
:class:`DSLQuery <gql.dsl.DSLQuery>`,
:class:`DSLMutation <gql.dsl.DSLMutation>` and
:class:`DSLSubscription <gql.dsl.DSLSubscription>`
r   rF   c           	          [        S[        U R                  5      U R                  U R                  R                  5       S.U R                  (       a  S[        U R                  S90O0 DSS0D6$ )r   )r   r   r   rU   rT   
directivesrb   )r/   r0   r   r   r   get_ast_definitionsrU   r*   r   s    rO   r   DSLOperation.executable_ast  si     ' 
#D$7$78,,!%!:!:!N!N!P
 7;iityy12R	

 
 	
rw   c                 6    SU R                   R                   S3$ )N<>)	__class__r   r   s    rO   __repr__DSLOperation.__repr__  s    4>>**+1--rw   rb   N)r   r   r   r   r   r0   r   r   r/   r   rm   r   r   rb   rw   rO   r   r     s5     "!	
 7 	
 	
.# .rw   r   c                   ,    \ rS rSr\R
                  rSrg)DSLQueryi  rb   N)r   r   r   r   r0   r   r   r   rb   rw   rO   r   r     s    "((Nrw   r   c                   ,    \ rS rSr\R
                  rSrg)DSLMutationi
  rb   N)r   r   r   r   r0   r   r   r   rb   rw   rO   r   r   
  s    "++Nrw   r   c                   ,    \ rS rSr\R
                  rSrg)DSLSubscriptioni  rb   N)r   r   r   r   r0   r   r   r   rb   rw   rO   r   r     s    "//Nrw   r   c                   \    \ rS rSrSrS\4S jrS\S\4S jr	S\SS 4S jr
S	\SS 4S
 jrSrg)r   i  aF  The DSLVariable represents a single variable defined in a GraphQL operation

Instances of this class are generated for you automatically as attributes
of the :class:`DSLVariableDefinitions`

The type of the variable is set by the :class:`DSLField` instance that receives it
in the :meth:`args <gql.dsl.DSLField.args>` method.
rU   c                 x    Xl         SU l        [        [        U R                   S9S9U l        SU l        SU l        g)r   NrT   rU   )rU   ast_variable_typer7   r*   r   default_valuer   r   rU   s     rO   r   DSLVariable.__init__  s4    	59!-8$))3L!M!04	rw   rx   rF   c                 v   [        U5      (       an  [        U[        5      (       a"  [        U R	                  UR
                  5      S9$ [        U[        5      (       a"  [        U R	                  UR
                  5      S9$ [        U[        [        [        45      (       d   e[        [        UR                  S9S9$ )N)r   rT   r   )r?   rj   r   r'   to_ast_typer   r    r+   r"   r   r   r)   r*   rU   r   rx   s     rO   r  DSLVariable.to_ast_type$  s    E""%--#)9)9%--)HIIE>22&D,<,<U]],KLL%8NO
 
 	
 
 ("<==rw   c                 >    Xl         U R                  U5      U l        U $ rI   )r   r  r  r  s     rO   r   DSLVariable.set_type2  s    	!%!1!1%!8rw   r  c                     Xl         U $ rI   )r  )r   r  s     rO   defaultDSLVariable.default7  s    *rw   )r   r  r  rU   r   N)r   r   r   r   r   rm   r   r   r3   r  r   r   r  r   rb   rw   rO   r   r     sN    5S 5>!1 >h >. = 
S ] rw   r   c                   H    \ rS rSrSrS rS\SS4S jrS\\	S4   4S	 jr
S
rg)r   i<  a  The DSLVariableDefinitions represents variable definitions in a GraphQL operation

Instances of this class have to be created and set as the `variable_definitions`
attribute of a DSLOperation instance

Attributes of the DSLVariableDefinitions class are generated automatically
with the `__getattr__` dunder method in order to generate
instances of :class:`DSLVariable`, that can then be used as values
in the :meth:`args <gql.dsl.DSLField.args>` method.
c                     0 U l         g)r   N	variablesr   s    rO   r   DSLVariableDefinitions.__init__H  s	    13rw   rU   rF   r   c                 n    XR                   ;  a  [        U5      U R                   U'   U R                   U   $ rI   )r  r   r  s     rO   r   "DSLVariableDefinitions.__getattr__L  s.    ~~%#.t#4DNN4 ~~d##rw   .c                 V    [        S U R                  R                  5        5       5      $ )zX
:meta private:

Return a list of VariableDefinitionNodes for each variable with a type
c           	   3      #    U  Ha  nUR                   c  M  [        UR                  UR                  UR                  c  S O[        UR                  UR                   5      SS9v   Mc     g 7f)Nrb   )r   variabler  r   )r   r6   r  r   r  r{   )rL   vars     rO   rP   =DSLVariableDefinitions.get_ast_definitions.<locals>.<genexpr>W  sf      
 /xx	"**.. ((0 '(9(9388D	 /s   A+AA+)rl   r  rg   r   s    rO   r   *DSLVariableDefinitions.get_ast_definitionsQ  s-      
 ~~,,.
 
 	
rw   r  N)r   r   r   r   r   r   rm   r   r   r6   r   r   rb   rw   rO   r   r   <  s6    	4$ $ $

U+A3+F%G 
rw   r   c                   T    \ rS rSrSrS\\\4   S\4S jr	S\
SS4S	 jrS\
4S
 jrSrg)r   ig  a  The DSLType represents a GraphQL type for the DSL code.

It can be a root type (Query, Mutation or Subscription).
Or it can be any other object type (Human in the StarWars schema).
Or it can be an interface type (Character in the StarWars schema).

Instances of this class are generated for you automatically as attributes
of the :class:`DSLSchema`

Attributes of the DSLType class are generated automatically
with the `__getattr__` dunder method in order to generate
instances of :class:`DSLField`
graphql_type
dsl_schemac                 P    Xl         X l        [        R                  SU < S35        g)a%  Initialize the DSLType with the GraphQL type.

.. warning::
    Don't instantiate this class yourself.
    Use attributes of the :class:`DSLSchema` instead.

:param graphql_type: the GraphQL type definition from the schema
:param dsl_schema: reference to the DSLSchema which created this type
	Creating )N)_typer   r   r   )r   r  r  s      rO   r   DSLType.__init__v  s&     FR
%		IdXQ'(rw   rU   rF   r   c                 d   [        U5      nXR                  R                  ;   a  UnU R                  R                  U   nO[X R                  R                  ;   a  UnU R                  R                  U   nO&[        SU SU R                  R                   S35      e[        X0R                  X@5      $ )NzField z does not exist in type ri   )rD   r!  r]   r   rU   r   )r   rU   camel_cased_nameformatted_namer   s        rO   r   DSLType.__getattr__  s    (.::$$$!NJJ%%d+E!2!22-NJJ%%&67E 6tzz6GqI  

E@@rw   c                 R    SU R                   R                   SU R                  < S3$ Nr    r   )r   r   r!  r   s    rO   r   DSLType.__repr__  s&    4>>**+1TZZN!<<rw   )r   r!  N)r   r   r   r   r   r   r!   r   r   r   rm   r   r   r   rb   rw   rO   r   r   g  sL    )-/CCD) )$A A
 A =# =rw   r   c                   t    \ rS rSr% Sr\\\\4   \	S'   \
S\S    S\\S4   S\S   4S	 j5       rS\4S
 jrSrg)r   i  a1  DSLSelectable is an abstract class which indicates that
the subclasses can be used as arguments of the
:meth:`select <gql.dsl.DSLSelector.select>` method.

Inherited by
:class:`DSLField <gql.dsl.DSLField>`,
:class:`DSLFragment <gql.dsl.DSLFragment>`
:class:`DSLInlineFragment <gql.dsl.DSLInlineFragment>`
r   r]   r   r   rF   )r   .c                 :    / U QS UR                  5        5       Q7$ )z
:meta private:

Concatenate all the fields (with or without alias) in a Tuple.

Set the requested alias for the fields with alias.
c              3   H   #    U  H  u  pUR                  U5      v   M     g 7frI   )alias)rL   r.  r   s      rO   rP   3DSLSelectable.get_aliased_fields.<locals>.<genexpr>  s      O5N\Uekk%  5Ns    ")rk   )r]   r   s     rO   r    DSLSelectable.get_aliased_fields  s+    

O5F5L5L5NO
 	
rw   c                 ,    [        U R                  5      $ rI   )r@   r   r   s    rO   __str__DSLSelectable.__str__  s    ((rw   rb   N)r   r   r   r   r   r   r   r%   r   r   staticmethodr   r   rm   r   r   r2  r   rb   rw   rO   r   r     sk     Y 24FFGG
)
%= =>
 
#	$
 
") )rw   r   c                   *    \ rS rSrSrS\S\4S jrSrg)DSLFragmentSelectori  a  Class used to define the
:meth:`is_valid_field <gql.dsl.DSLFragmentSelector.is_valid_field>` method
for fragments for the :meth:`select <gql.dsl.DSLSelector.select>` method.

Inherited by
:class:`DSLFragment <gql.dsl.DSLFragment>`,
:class:`DSLInlineFragment <gql.dsl.DSLInlineFragment>`
r   rF   c                    [        U [        [        45      (       d   e[        U[        [        45      (       a  g[        U[        5      (       d   e[        U[        5      (       a  UR
                  S:H  $ U R                  nUc   eUR
                  UR                  R                  5       ;   a:  UR                  UR
                     R                  UR                  R                  :H  $ gzCheck that a field is valid.Tr   F)rj   DSLFragmentDSLInlineFragmentr   r   rU   r!  r]   keysr   r   )r   r   fragment_types      rO   r   "DSLFragmentSelector.is_valid_field  s     $.? @AAAAek+<=>>%****e\**::--

(((::--2244 ''

388EKK<L<LLLrw   rb   N	r   r   r   r   r   r   rn   r   r   rb   rw   rO   r6  r6    s    M d rw   r6  c                   *    \ rS rSrSrS\S\4S jrSrg)DSLFieldSelectori  zClass used to define the
:meth:`is_valid_field <gql.dsl.DSLFieldSelector.is_valid_field>` method
for fields for the :meth:`select <gql.dsl.DSLSelector.select>` method.

Inherited by
:class:`DSLField <gql.dsl.DSLField>`,
r   rF   c                    [        U [        5      (       d   e[        U[        [        45      (       a  g[        U[        5      (       d   e[        U[        5      (       a  UR
                  S:H  $ [        U R                  R                  5      n[        U[        [        45      (       d  gUR
                  UR                  R                  5       ;   a:  UR                  UR
                     R                  UR                  R                  :H  $ gr8  )rj   r   r9  r:  r   rU   r8   r   r   r   r!   r]   r;  )r   r   r   s      rO   r   DSLFieldSelector.is_valid_field  s     $))))ek+<=>>%****e\**::--$TZZ__5+(<>O'PQQ::++0022%%ejj166%++:J:JJJrw   rb   Nr>  rb   rw   rO   r@  r@    s    M d rw   r@  c                   6    \ rS rSr% Sr\\S'   S\SS 4S jrSr	g)	r   i  zoDSLSelectableWithAlias is an abstract class which indicates that
the subclasses can be selected with an alias.
r   r.  rF   c                 6    [        US9U R                  l        U $ )aO  Set an alias

.. note::
    You can also pass the alias directly at the
    :meth:`select <gql.dsl.DSLSelector.select>` method.
    :code:`ds.Query.human.select(my_name=ds.Character.name)` is equivalent to:
    :code:`ds.Query.human.select(ds.Character.name.alias("my_name"))`

:param alias: the alias
:type alias: str
:return: itself
rT   )r*   r   r.  )r   r.  s     rO   r.  DSLSelectableWithAlias.alias  s      (e4rw   rb   N)
r   r   r   r   r   r   r   rm   r.  r   rb   rw   rO   r   r     s#     3 #; rw   r   c            
          ^  \ rS rSr% Sr\\\4   \S'   \	\S'   \
\S'    SS\S\\\4   S\
S\\   4S	 jjr\S
 5       rS\SS 4S jrS\SS 4S jrS\S\4S jr      SU 4S jjrS\4S jrSrU =r$ )r   i  a<  The DSLField represents a GraphQL field for the DSL code.

Instances of this class are generated for you automatically as attributes
of the :class:`DSLType`

If this field contains children fields, then you need to select which ones
you want in the request using the :meth:`select <gql.dsl.DSLField.select>`
method.
r!  r   r   rU   r   r   c                     X l         X0l        [        [        US9SSS9U l        X@l        [        R                  SU < 35        [        R                  U 5        g)a  Initialize the DSLField.

.. warning::
    Don't instantiate this class yourself.
    Use attributes of the :class:`DSLType` instead.

:param name: the name of the field
:param parent_type: the GraphQL type definition from the schema of the
                    parent type of the field
:param field: the GraphQL field definition from the schema
:param dsl_type: reference of the DSLType instance which created this field
rT   rb   )rU   	argumentsr   r  N)
r   r   r   r*   r   r   r   r   r   r   )r   rU   r   r   r   s        rO   r   DSLField.__init__)  sQ    & '
"%

 !		IdX&'T"rw   c                 B    U R                   R                  R                  $ )r   )r   rU   rN   r   s    rO   rU   DSLField.nameI  s     ~~""(((rw   kwargsrF   c                 &    U R                   " S0 UD6$ )Nrb   argsr   rL  s     rO   __call__DSLField.__call__N  s    yy"6""rw   c                   ^  T R                   R                  c   eT R                   R                  [        U 4S jUR                  5        5       5      -   T R                   l        [        R                  SU ST < S35        T $ )a  Set the arguments of a field

The arguments are parsed to be stored in the AST of this field.

.. note::
    You can also call the field directly with your arguments.
    :code:`ds.Query.human(id=1000)` is equivalent to:
    :code:`ds.Query.human.args(id=1000)`

:param \**kwargs: the arguments (keyword=value)
:return: itself

:raises KeyError: if any of the provided arguments does not exist
                  for this field.
c           
   3      >#    U  H;  u  p[        [        US 9[        UTR                  U5      R                  5      S9v   M=     g7frS   )r   r*   r{   _get_argumentr   )rL   rU   rN   r   s      rO   rP    DSLField.args.<locals>.<genexpr>d  sG      D

  .	 D)$UD,>,>t,D,I,IJ  .s   AAzAdded arguments z
 in field r   )r   rH  rl   rk   r   r   rP  s   ` rO   rO  DSLField.argsQ  sw    " ~~''333#'>>#;#;e D

  &||~D
 ?
 $
  			$VHJtha@Arw   c                     U R                   R                  R                  U5      nUc  [        SU SU R                    S35      eU$ )zMethod used to return the GraphQLArgument definition
of an argument from its name.

:raises KeyError: if the provided argument does not exist
                  for this field.
z	Argument z does not exist in ri   )r   rO  getKeyError)r   rU   args      rO   rU  DSLField._get_argumentp  sE     jjoo!!$';Ytf,?

|1MNN
rw   c                 ^   > [         TU ]  " U0 UD6  U R                  U R                  l        U $ WCalling :meth:`select <gql.dsl.DSLSelector.select>` method with
corrected typing hints
superr   r   r   r   r]   r   r   s      rO   r   DSLField.select~  s.     	4"34'+'9'9$rw   c                 ~    SU R                   R                   SU R                  R                   SU R                   S3$ )Nr   r)  z::r   )r   r   r   rU   r   s    rO   r   DSLField.__repr__  s:    4>>**+1T-=-=-B-B,Cr$))TUVVrw   )r   r   r   r   rI   )r]   r   r   r   rF   r   )r   r   r   r   r   r   r!   r   r   r   r   rm   r
   r   r   r   rU   r   rQ  rO  r   rU  r   r   r   __classcell__r   s   @rO   r   r     s     "$8899 '+## ,.BBC# 	#
 7##@ ) )# # #S Z ># / 
&
=U
	
W# W Wrw   r   c                      ^  \ rS rSrSr\" S\" \5      \" \" \\	S   5      5      \" \" \\	S   5      S\
" \" \5      S90S9S	.S
9rS\4U 4S jjrSrU =r$ )r   i  zDSLMetaField represents a GraphQL meta-field for the DSL code.

meta-fields are reserved field in the GraphQL type system prefixed with
"__" two underscores and used for introspection.

meta_field__Schema__TyperU   )rx   rN  )r   r   r   r\   c                    >  U R                   R                  U   n[        TU ]  XR                   U5        g! [         a    [        SU S35      ef = f)zYInitialize the meta-field.

:param name: the name between __typename, __schema or __type
zInvalid meta-field ""N)	meta_typer]   rZ  r   ra  r   )r   rU   r   r   s      rO   r   DSLMetaField.__init__  sW    	?NN))$/E 	~~u5  	?!5dV1=>>	?s	   7 Arb   )r   r   r   r   r   r!   r   r$   r   r9   r   r    rn  rm   r   r   rf  rg  s   @rO   r   r     s{     "&}5$&(;J(GH #&(;H(EFoN=4QRS	
I6S 6 6rw   r   c                      ^  \ rS rSr% Sr\\\4   \S'   \	\S'       SS jr
      SU 4S jjrS\SS 4S	 jrS\4S
 jrSrU =r$ )r:  i  zADSLInlineFragment represents an inline fragment for the DSL code.r!  r   c                     [         R                  SU < 35        [        SS9U l        [        R
                  " U /UQ70 UD6  g)zInitialize the DSLInlineFragment.

:param \*fields: new children fields
:type \*fields: DSLSelectable (DSLField, DSLFragment or DSLInlineFragment)
:param \**fields_with_alias: new children fields with alias as key
:type \**fields_with_alias: DSLField
r  rb   r   N)r   r   r%   r   r   r   r   s      rO   r   DSLInlineFragment.__init__  s<     			IdX&'+r:T@F@.?@rw   rF   c                 ^   > [         TU ]  " U0 UD6  U R                  U R                  l        U $ r^  r`  rb  s      rO   r   DSLInlineFragment.select  s.     	4"34'+'9'9$rw   type_conditionc                     UR                   U l         [        [        U R                   R                  S9S9U R                  l        U $ )z2Provides the GraphQL type of this inline fragment.rT   r   )r!  r)   r*   rU   r   rv  r   rv  s     rO   onDSLInlineFragment.on  s9     $))
(5

0)
% rw   c                     Sn USU R                   R                   3-  nSU R                  R                   U S3$ ! [         a     N(f = f)N z on r   r   )r!  rU   r   r   r   )r   	type_infos     rO   r   DSLInlineFragment.__repr__  sZ    		4

011I 4>>**+I;a88  		s   < 
A	A	)r!  r   r   )r]   r   r   r   rF   r:  )r   r   r   r   r   r   r!   r   r   r%   r   r   r   ry  rm   r   r   rf  rg  s   @rO   r:  r:    sz    K"$8899!!A A 6A&	&	=U			 -@ 9# 9 9rw   r:  c                      ^  \ rS rSr% Sr\\\\4      \	S'   \
\	S'   \\	S'   S\4S jr\S\
4S j5       r      SU 4S	 jjrS
\SS 4S jr\S\4S j5       rS\4S jrSrU =r$ )r9  i  zADSLFragment represents a named GraphQL fragment for the DSL code.r!  r   rU   c                 z    [         R                  U 5        Xl        SU l        [        R                  SU < 35        g)zSInitialize the DSLFragment.

:param name: the name of the fragment
:type name: str
Nr  )r   r   rU   r!  r   r   r  s     rO   r   DSLFragment.__init__  s1     	t$	
		IdX&'rw   rF   c                 H    [        SS9n[        U R                  S9Ul        U$ )zast_field property will generate a FragmentSpreadNode with the
provided name.

Note: We need to ignore the type because of
`issue #4125 of mypy <https://github.com/python/mypy/issues/4125>`_.
rb   rr  rT   )r   r*   rU   )r   spread_nodes     rO   r   DSLFragment.ast_field  s%     )B7#$))4rw   c                 X   > U R                   c  [        S5      e[        TU ]  " U0 UD6  U $ )r_  =Missing type condition. Please use .on(type_condition) method)r!  r   ra  r   rb  s      rO   r   DSLFragment.select  s8     :: O  	4"34rw   rv  c                 (    UR                   U l         U $ )ztProvides the GraphQL type of this fragment.

:param type_condition: the provided type
:type type_condition: DSLType
)r!  rx  s     rO   ry  DSLFragment.on  s     $))
rw   c           	      R   U R                   c   eU R                  c  [        S5      eU R                  R	                  5       n[        U5      S:X  a   0 nOSU0n[        S[        [        U R                  R                   S9S9U R                  S.UD[        U R                   S9SS.D6$ )	zrGenerates the ast for :func:`dsl_gql <gql.dsl.dsl_gql>`.

:raises AttributeError: if a type has not been provided
r  r   r   rT   r   )rv  r   rb   )rU   r   )
rU   r!  r   r   r   lenr   r)   r*   r   )r   fragment_variable_definitionsvariable_definition_kwargss      rO   r   DSLFragment.executable_ast)  s     yy$$$:: O  )-(A(A(U(U(W%,-2 *,& '(E*& & 
(hTZZ__.MN,,
 )
 		*
 	
rw   c                 R    SU R                   R                   SU R                  < S3$ r(  )r   r   rU   r   s    rO   r   DSLFragment.__repr__N  s&    4>>**+1TYYM;;rw   )r!  rU   )r]   r   r   r   rF   r9  )r   r   r   r   r   r
   r   r!   r   r   r   rm   r   r   r   r   r   ry  r   r   r   r   rf  rg  s   @rO   r9  r9    s    KE+-AABCC!!
I((" -  &=U		 	] 	 "
 6 "
 "
H<# < <rw   r9  )fr   loggingreabcr   r   mathr   typingr   r   r   r	   r
   r   r   r   graphqlr   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(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   graphql.pyutilsrA   graphql_requestrC   utilsrD   	getLoggerr   r   compiler   rK   r{   r   r   r   r   r   r   r   r   r   r   r   r   r   r6  r@  r   r   r   r:  r9  rb   rw   rO   <module>r     s  
  	 #  M M M4 4 4 4 4 4 4 4 4 4 4 4 4 4j $ +  !ZZ 78 /L# /L(9:M /LdXA# XA&6 XA8I;N XAv4$ 4$:I4$4$n&' &'RE?# E?P0AK 0Af5; 5p.="6 .6)| ),, ,0l 0' 'T(
 (
V2= 2=j )C  )F+ B{ B] 2qW%'7 qWh 68  6F59': 59pf<-!4m f<rw   