
    XjA                        U d dl 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 ddlmZ ddlmZmZ ddlmZmZ 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 g dZ G d de       Z! ejD                         D  ci c]  \  } }|  e#d |D               c}} Z$ee%ee%df   f   e&d<   	 	 	 ddede
deeee         dee'   dee   dee   fdZ(	 	 d de
dee   deeee         dee   fdZ)de
ddfdZ*de
deddfdZ+yc c}} w )!    )
CollectionDictListOptionalTupleType   )GraphQLError)DocumentNodeParallelVisitorvisit)QUERY_DOCUMENT_KEYS)inspectis_collection)GraphQLSchemaassert_valid_schema)TypeInfoTypeInfoVisitor   )ASTValidationRule)specified_rulesspecified_sdl_rules)SDLValidationContextValidationContext)assert_valid_sdlassert_valid_sdl_extensionvalidatevalidate_sdlc                       e Zd ZdZy)ValidationAbortedErrorz?Error when a validation has been aborted (error limit reached).N)__name__
__module____qualname____doc__     h/var/www/html/myl_app/scheduler-service/venv/lib/python3.12/site-packages/graphql/validation/validate.pyr    r       s    Ir&   r    c              3   ,   K   | ]  }|d k7  s	|  yw)descriptionNr%   ).0keys     r'   	<genexpr>r,      s     <sm';<s   
.query_document_keys_to_validateNschemadocument_astrules
max_errors	type_inforeturnc           	      D  	 |rt        |t              st        d      t        |        dnt        t              st        d      |t        |       }n(t        |t
              st        dt        |       d      |t        }n(t        |      rt        d |D              st        d      g 	d	t        d
df	fd}t        | |||      }|D cg c]
  } ||       }}	 t        |t        |t        |            t               	S c c}w # t         $ r Y 	S w xY w)a  Implements the "Validation" section of the spec.

    Validation runs synchronously, returning a list of encountered errors, or an empty
    list if no errors were encountered and the document is valid.

    A list of specific validation rules may be provided. If not provided, the default
    list of rules defined by the GraphQL specification will be used.

    Each validation rule is a ValidationRule object which is a visitor object that holds
    a ValidationContext (see the language/visitor API). Visitor methods are expected to
    return GraphQLErrors, or lists of GraphQLErrors when invalid.

    Validate will stop validation after a ``max_errors`` limit has been reached.
    Attackers can send pathologically invalid queries to induce a DoS attack,
    so by default ``max_errors`` set to 100 errors.

    Providing a custom TypeInfo instance is deprecated; omit the ``type_info``
    argument so that validate creates the TypeInfo instance. It will be removed in v3.3.
    zMust provide document.Nd   z6The maximum number of errors must be passed as an int.zNot a TypeInfo object: .c              3   `   K   | ]&  }t        |t              xr t        |t               ( y wN)
isinstancetype
issubclassr   )r*   rules     r'   r,   zvalidate.<locals>.<genexpr>D   s,      -KO
4F:d4E#FF-s   ,.zHRules must be specified as a collection of ASTValidationRule subclasses.errorr3   c                     t              k\  r j                  t        d             t        j                  |        y )NzDToo many validation errors, error limit reached. Validation aborted.)lenappendr
   r    )r=   errorsr1   s    r'   on_errorzvalidate.<locals>.on_errorM   s<    v;*$MM+ )(er&   )r9   r   	TypeErrorr   intr   r   r   r   allr
   r   r   r   r   r-   r    )
r.   r/   r0   r1   r2   rB   contextr<   visitorsrA   s
      `     @r'   r   r      s?   4 z,E011

C(PQQV$		8,1')2D1EQGHH}5! -SX- * V
 	
 "$F	 	 	  iJG +00$W0H0Ix'@A+	
 M 1 " Ms   D'$D 	DDschema_to_extendc                     g }t        | ||j                        }|t        }|D cg c]
  } ||       }}t        | t	        |             |S c c}w )z:Validate an SDL document.

    For internal use only.
    )r   r@   r   r   r   )r/   rH   r0   rA   rF   r<   rG   s          r'   r   r   j   sV     "$F"<1A6==QG}#*/0$W0H0	,12M 1s   Ac                 `    t        |       }|r!t        dj                  d |D                    y)zAssert document is valid SDL.

    Utility function which asserts a SDL document is valid by throwing an error if it
    is invalid.
    

c              3   4   K   | ]  }|j                     y wr8   messager*   r=   s     r'   r,   z#assert_valid_sdl.<locals>.<genexpr>        #FeEMM#F   Nr   rC   join)r/   rA   s     r'   r   r   |   s0     ,'F#Fv#FFGG r&   c                 b    t        | |      }|r!t        dj                  d |D                    y)zAssert document is a valid SDL extension.

    Utility function which asserts a SDL document is valid by throwing an error if it
    is invalid.
    rK   c              3   4   K   | ]  }|j                     y wr8   rM   rO   s     r'   r,   z-assert_valid_sdl_extension.<locals>.<genexpr>   rP   rQ   NrR   )r/   r.   rA   s      r'   r   r      s2     ,/F#Fv#FFGG r&   )NNN)NN),typingr   r   r   r   r   r   r=   r
   languager   r   r   language.astr   pyutilsr   r   r:   r   r   	utilitiesr   r   r0   r   r   r   validation_contextr   r   __all__RuntimeErrorr    itemstupler-   str__annotations__rD   r   r   r   r   )kindkeyss   00r'   <module>rd      s   @ @ @   ; ; . , 5 1 $ A G
XJ\ J 0)//1?d 	%<t<
<<? c5c?&:!;  <@ $$(KKK Jt$5678K 	K
 !K 
,K` 15;?}- Jt$5678 
,	$	H< 	HD 	HHH(5H	He?s   9C=