
    $g                     `    d dl 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   )GraphQLError)DocumentNodeOperationDefinitionNode   )ASTValidationContextASTValidationRuleLoneAnonymousOperationRulec                   P     e Zd ZdZdef 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   a  Lone anonymous operation

    A GraphQL document is only valid if when it contains an anonymous operation
    (the query short-hand) that it contains only that one operation definition.

    See https://spec.graphql.org/draft/#sec-Lone-Anonymous-Operation
    contextc                 X    t                                          |           d| _        d S )Nr   )super__init__operation_count)selfr   	__class__s     q/var/www/html/netbox-4.1.3/venv/lib/python3.11/site-packages/graphql/validation/rules/lone_anonymous_operation.pyr   z#LoneAnonymousOperationRule.__init__   s)    !!!     node_argsreturnNc                 L    t          d |j        D                       | _        d S )Nc              3   @   K   | ]}t          |t                    V  d S )N)
isinstancer   ).0
definitions     r   	<genexpr>z<LoneAnonymousOperationRule.enter_document.<locals>.<genexpr>   sA       #
 #
 z#:;;#
 #
 #
 #
 #
 #
r   )sumdefinitionsr   r   r   r   s      r   enter_documentz)LoneAnonymousOperationRule.enter_document   s9    " #
 #
".#
 #
 #
  
  
r   c                 x    |j         s0| j        dk    r'|                     t          d|                     d S d S d S )Nr   z<This anonymous operation must be the only defined operation.)namer   report_errorr   r!   s      r   enter_operation_definitionz5LoneAnonymousOperationRule.enter_operation_definition   s`     y 	T1A55RTX     	 	55r   )__name__
__module____qualname____doc__r	   r   r   r   r"   r   r&   __classcell__)r   s   @r   r   r   
   s         ! 4 ! ! ! ! ! !
< 
 
 
 
 
 
+58	       r   N)typingr   errorr   languager   r    r	   r
   __all__r    r   r   <module>r2      s          ! ! ! ! ! ! = = = = = = = = 5 5 5 5 5 5 5 5'
(    !2     r   