
    Xj!                     "   d dl mZmZmZmZmZmZmZmZm	Z	 ddl
mZ ddlmZmZmZmZmZmZmZmZmZ ddlmZmZmZmZmZmZmZmZ ddlm Z m!Z! g dZ"eeef   Z# G d d	e      Z$ G d
 de      Z% G d d      Z& G d de&      Z' G d de&      Z(y)    )	AnyCallableDictList
NamedTupleOptionalSetUnioncast   )GraphQLError)	DocumentNodeFragmentDefinitionNodeFragmentSpreadNodeOperationDefinitionNodeSelectionSetNodeVariableNodeVisitorVisitorActionvisit)GraphQLArgumentGraphQLCompositeTypeGraphQLDirectiveGraphQLEnumValueGraphQLFieldGraphQLInputTypeGraphQLOutputTypeGraphQLSchema)TypeInfoTypeInfoVisitor)ASTValidationContextSDLValidationContextValidationContextVariableUsageVariableUsageVisitorc                   B    e Zd ZU eed<   ee   ed<   eed<   ee   ed<   y)r$   nodetypedefault_valueparent_typeN)__name__
__module____qualname__r   __annotations__r   r   r        r/var/www/html/myl_app/scheduler-service/venv/lib/python3.12/site-packages/graphql/validation/validation_context.pyr$   r$   &   s&    

#
$$*++r0   r$   c                   ^     e Zd ZU dZee   ed<   def fdZde	de
fdZdede	de
fd	Z xZS )
r%   z3Visitor adding all variable usages to a given list.usages	type_infoc                 t    t         |           g | _        | j                  j                  | _        || _        y N)super__init__r3   append_append_usage
_type_info)selfr4   	__class__s     r1   r8   zVariableUsageVisitor.__init__2   s.    ![[//#r0   _argsreturnc                     | j                   S r6   )SKIP)r<   r>   s     r1   enter_variable_definitionz.VariableUsageVisitor.enter_variable_definition8   s    yyr0   r'   c                     | j                   }t        ||j                         |j                         |j	                               }| j                  |       y r6   )r;   r$   get_input_typeget_default_valueget_parent_input_typer:   )r<   r'   r>   r4   usages        r1   enter_variablez#VariableUsageVisitor.enter_variable;   sO    OO	$$&'')++-	
 	5!r0   )r+   r,   r-   __doc__r   r$   r.   r   r8   r   r   rB   r   rH   __classcell__r=   s   @r1   r%   r%   -   sJ    =$( $  	< 	 	 	r0   r%   c                       e Zd ZU dZeed<   eeee	f      ed<   ee
ee   f   ed<   eeee	   f   ed<   dedeegdf   d	dfd
Zded	dfdZded	dfdZded	ee	   fdZde
d	ee   fdZded	ee	   fdZy)r!   zUtility class providing a context for validation of an AST.

    An instance of this class is passed as the context attribute to all Validators,
    allowing access to commonly useful contextual information from within a validation
    rule.
    document
_fragments_fragment_spreads!_recursively_referenced_fragmentsaston_errorNr?   c                 J    || _         || _        d | _        i | _        i | _        y r6   )rM   rR   rN   rO   rP   )r<   rQ   rR   s      r1   r8   zASTValidationContext.__init__W   s)      !#13.r0   errorc                      y r6   r/   r<   rT   s     r1   rR   zASTValidationContext.on_error`   s    r0   c                 &    | j                  |       y r6   )rR   rV   s     r1   report_errorz!ASTValidationContext.report_errorc   s    er0   namec                     | j                   }|O| j                  j                  D ci c])  }t        |t              r|j
                  j                  |+ }}|| _         |j                  |      S c c}w r6   )rN   rM   definitions
isinstancer   rY   valueget)r<   rY   	fragments	statements       r1   get_fragmentz!ASTValidationContext.get_fragmentf   sq    OO	 "&!:!:i)?@ $$i/I  (DO}}T""s   .A/r'   c                 f   | j                   j                  |      }|g }|j                  }|g}|j                  }|j                  }|rY |       }|j                  D ]@  }t        |t              r	 ||       t        t        |      j                  }	|	s9 ||	       B |rY|| j                   |<   |S r6   )
rO   r^   r9   pop
selectionsr\   r   r   NodeWithSelectionSetselection_set)
r<   r'   spreadsappend_spreadsets_to_visit
append_setpop_setvisited_set	selectionset_to_visits
             r1   get_fragment_spreadsz)ASTValidationContext.get_fragment_spreadsr   s    ((,,T2?G#NNM!FM&--J#''G%i!,!7!7 5I!)-?@%i0'+0)('- % (&|45   ,3D""4(r0   	operationc                    | j                   j                  |      }|g }|j                  }t               }|j                  }|j
                  g}|j                  }|j                  }| j                  }	| j                  }
|r_ |       } |
|      D ]J  }|j                  j                  }||vs ||        |	|      }|s1 ||        ||j
                         L |r_|| j                   |<   |S r6   )rP   r^   r9   setaddrf   rc   ra   ro   rY   r]   )r<   rp   r_   append_fragmentcollected_namesadd_namenodes_to_visitappend_nodepop_nodera   ro   visited_nodespread	frag_namefragments                  r1   $get_recursively_referenced_fragmentsz9ASTValidationContext.get_recursively_referenced_fragments   s     ::>>yI	I'..O(+O&**H'556N(//K%))H,,L#'#<#<  'z2<@ @F & 1 1I 7 +#/	#:#+H5'(>(>?@ ! AJD229=r0   )r+   r,   r-   rI   r   r.   r   r   strr   r   r   r   r   r   r   r8   rR   rX   ra   ro   r~   r/   r0   r1   r!   r!   G   s     c#99:;;,d3E.FFGG'+&<!==( 44+3\ND4H+I4	4l t , 4 
# 
#2H)I 
#)9 dCU>V ,0	$	%r0   r!   c                   X     e Zd ZU dZee   ed<   dedee   dee	gdf   ddf fdZ
 xZS )r"   zUtility class providing a context for validation of an SDL AST.

    An instance of this class is passed as the context attribute to all Validators,
    allowing access to commonly useful contextual information from within a validation
    rule.
    schemarQ   rR   Nr?   c                 4    t         |   ||       || _        y r6   )r7   r8   r   )r<   rQ   r   rR   r=   s       r1   r8   zSDLValidationContext.__init__   s     	h'r0   )r+   r,   r-   rI   r   r   r.   r   r   r   r8   rJ   rK   s   @r1   r"   r"      sV     ]## ' L>4/0	
 
 r0   r"   c            
       J    e Zd ZU dZeed<   eed<   eee	e
   f   ed<   eee	e
   f   ed<   dedededeegd	f   d
d	f
 fdZded
e	e
   fdZded
e	e
   fdZd
ee   fdZd
ee   fdZd
ee   fdZd
ee   fdZd
ee   fdZd
ee   fdZd
ee   fdZd
ee    fdZ! xZ"S )r#   a  Utility class providing a context for validation using a GraphQL schema.

    An instance of this class is passed as the context attribute to all Validators,
    allowing access to commonly useful contextual information from within a validation
    rule.
    r   r;   _variable_usages_recursive_variable_usagesrQ   r4   rR   Nr?   c                 ^    t         |   ||       || _        || _        i | _        i | _        y r6   )r7   r8   r   r;   r   r   )r<   r   rQ   r4   rR   r=   s        r1   r8   zValidationContext.__init__   s2     	h'# "*,'r0   r'   c                     | j                   j                  |      }|Pt        | j                        }t	        |t        | j                  |             |j                  }|| j                   |<   |S r6   )r   r^   r%   r;   r   r    r3   )r<   r'   r3   usage_visitors       r1   get_variable_usagesz%ValidationContext.get_variable_usages   s`    &&**40>0AM$GH"))F*0D!!$'r0   rp   c                     | j                   j                  |      }|P| j                  } ||      }| j                  |      D ]  }|j	                   ||              || j                   |<   |S r6   )r   r^   r   r~   extend)r<   rp   r3   r   r}   s        r1   get_recursive_variable_usagesz/ValidationContext.get_recursive_variable_usages   sv     0044Y?>"&":":(3F EEiP =1(;<=9?D++I6r0   c                 6    | j                   j                         S r6   )r;   get_typer<   s    r1   r   zValidationContext.get_type   s    ''))r0   c                 6    | j                   j                         S r6   )r;   get_parent_typer   s    r1   r   z!ValidationContext.get_parent_type   s    ..00r0   c                 6    | j                   j                         S r6   )r;   rD   r   s    r1   rD   z ValidationContext.get_input_type       --//r0   c                 6    | j                   j                         S r6   )r;   rF   r   s    r1   rF   z'ValidationContext.get_parent_input_type   s    4466r0   c                 6    | j                   j                         S r6   )r;   get_field_defr   s    r1   r   zValidationContext.get_field_def       ,,..r0   c                 6    | j                   j                         S r6   )r;   get_directiver   s    r1   r   zValidationContext.get_directive   r   r0   c                 6    | j                   j                         S r6   )r;   get_argumentr   s    r1   r   zValidationContext.get_argument   s    ++--r0   c                 6    | j                   j                         S r6   )r;   get_enum_valuer   s    r1   r   z ValidationContext.get_enum_value   r   r0   )#r+   r,   r-   rI   r   r.   r   r   re   r   r$   r   r   r   r   r8   r   r   r   r   r   r   r   r   rD   rF   r   r   r   r   r   r   r   r   rJ   rK   s   @r1   r#   r#      sD    /m1DDEE $%<d=>Q%Q RR-- - 	-
 L>4/0- 
-(< mAT 
0
	m	
*(#45 *1*>!? 10)9 : 07x0@'A 7/x5 //x(89 /.h7 .0)9 : 0r0   r#   N))typingr   r   r   r   r   r   r	   r
   r   rT   r   languager   r   r   r   r   r   r   r   r   r(   r   r   r   r   r   r   r   r   	utilitiesr   r    __all__re   r$   r%   r!   r"   r#   r/   r0   r1   <module>r      s    T T T  
 
 
	 	 	 2 46LLM ,J ,7 4Z Zz/ (F0, F0r0   