
    XjN                         d dl 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 dgZeeee   f   Zdedeeef   fdZdee   d	ed
eddfdZ G d de      Zde
dee   fdZy)    )AnyDictListSet   )DocumentNodeFragmentDefinitionNodeFragmentSpreadNodeOperationDefinitionNodeSelectionSetNodeVisitorvisitseparate_operationsdocument_astreturnc           
      Z   g }i }| j                   D ]a  }t        |t              r|j                  |       %t        |t              s6t        |j                        ||j                  j                  <   c i }|D ]  }t               }t        |j                        D ]  }t        |||        |j                  r|j                  j                  nd}t        | j                   D 	cg c]0  }	|	|u s(t        |	t              r|	j                  j                  |v r|	2 c}	      ||<    |S c c}	w )a  Separate operations in a given AST document.

    This function accepts a single AST document which may contain many operations and
    fragments and returns a collection of AST documents each of which contains a single
    operation as well the fragment definitions it refers to.
     )definitions)r   
isinstancer   appendr	   collect_dependenciesselection_setnamevaluesetcollect_transitive_dependenciesr   )
r   
operations	dep_graphdefinition_nodeseparated_document_asts	operationdependenciesfragment_nameoperation_namenodes
             r/var/www/html/myl_app/scheduler-service/venv/lib/python3.12/site-packages/graphql/utilities/separate_operations.pyr   r      s2    13JI (33 o'>?o.3
 5I--5Io**001 8: 
	!$1)2I2IJ 	TM+L)]S	T 2;--R 3? )449$t%;<		<7 
3
/
. #"s   $5D(
	collectedr   	from_nameNc                     || vr:| j                  |       |j                  |      }||D ]  }t        | ||        yyy)zCollect transitive dependencies.

    From a dependency graph, collects a list of transitive dependencies by recursing
    through a dependency graph.
    N)addgetr   )r'   r   r(   immediate_depsto_names        r&   r   r   E   sS     	!i "y1%) O/	9gNO &	 "    c                   F     e Zd ZU ee   ed<   d fdZdededdfdZ	 xZ
S )	DependencyCollectorr"   r   Nc                 f    t         |           g | _        | j                  j                  | _        y N)super__init__r"   r   add_dependency)self	__class__s    r&   r4   zDependencyCollector.__init__Y   s*    "//66r.   r%   _argsc                 N    | j                  |j                  j                         y r2   )r5   r   r   )r6   r%   r8   s      r&   enter_fragment_spreadz)DependencyCollector.enter_fragment_spread^   s    DIIOO,r.   )r   N)__name__
__module____qualname__r   str__annotations__r4   r
   r   r:   __classcell__)r7   s   @r&   r0   r0   V   s-    s)7
-*< -c -d -r.   r0   r   c                 F    t               }t        | |       |j                  S r2   )r0   r   r"   )r   	collectors     r&   r   r   b   s     #%I	-#!!!r.   )typingr   r   r   r   languager   r	   r
   r   r   r   r   __all__r>   DepGraphr   r   r0   r    r.   r&   <module>rH      s    ' '   !
! T#Y/#l /#tC<M7N /#dO3xO$,O9<O	O"	-' 	-"(8 "T#Y "r.   