
    $g                     d    d dl mZmZ ddlmZ ddlmZmZ ddlm	Z	m
Z
 dgZ G d de
          Zd	S )
    )AnySet   )GraphQLError)OperationDefinitionNodeVariableDefinitionNode   )ValidationContextValidationRuleNoUndefinedVariablesRulec                   `     e Zd ZdZdef fdZdeddfdZdededdfd	Z	d
e
deddfdZ xZS )r   zNo undefined variables

    A GraphQL operation is only valid if all variables encountered, both directly and
    via fragment spreads, are defined by that operation.

    See https://spec.graphql.org/draft/#sec-All-Variable-Uses-Defined
    contextc                 p    t                                          |           t                      | _        d S N)super__init__setdefined_variable_names)selfr   	__class__s     o/var/www/html/netbox-4.1.3/venv/lib/python3.11/site-packages/graphql/validation/rules/no_undefined_variables.pyr   z!NoUndefinedVariablesRule.__init__   s-    !!!03###    _argsreturnNc                 8    | j                                          d S r   )r   clear)r   r   s     r   enter_operation_definitionz3NoUndefinedVariablesRule.enter_operation_definition   s    #))+++++r   	operationc           
         | j                             |          }| j        }|D ]\}|j        }|j        j        }||vrC|                     t          |j        rd| d|j        j         dnd| d||g                     ]d S )NzVariable '$z' is not defined by operation 'z'.z' is not defined.)r   get_recursive_variable_usagesr   nodenamevaluereport_errorr   )r   r   r   usagesdefined_variablesusager!   var_names           r   leave_operation_definitionz3NoUndefinedVariablesRule.leave_operation_definition   s     ;;IFF 7 	 	E:DyH000!!   )~K G( G G.7n.BG G G G "Kx!J!J!Jy) 
 
 
		 	r   r!   c                 X    | j                             |j        j        j                   d S r   )r   addvariabler"   r#   )r   r!   r   s      r   enter_variable_definitionz2NoUndefinedVariablesRule.enter_variable_definition/   s)     	#''(:(@AAAAAr   )__name__
__module____qualname____doc__r
   r   r   r   r   r)   r   r-   __classcell__)r   s   @r   r   r   
   s         6 1 6 6 6 6 6 6, , , , , ,0:=	   *B*B47B	B B B B B B B Br   N)typingr   r   errorr   languager   r    r
   r   __all__r    r   r   <module>r9      s            ! ! ! ! ! ! G G G G G G G G / / / / / / / /%
&(B (B (B (B (B~ (B (B (B (B (Br   