
    $gS                     $   d dl 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 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 dd	gZd
edeee	f         deeef         dededeeee         f         fdZd
edeee	f         deeef         dedee         deeee         f         fdZd
edeee	f         deeef         dededeeee         f         dee         ddfdZdeeef         dee
eef         defdZd
edee	ef         dedefdZdedefdZ dS )    )AnyDictListSetUnioncast   )	FieldNodeFragmentDefinitionNodeFragmentSpreadNodeInlineFragmentNodeSelectionSetNode)GraphQLAbstractTypeGraphQLIncludeDirectiveGraphQLObjectTypeGraphQLSchemaGraphQLSkipDirectiveis_abstract_type)type_from_ast   )get_directive_valuescollect_fieldscollect_sub_fieldsschema	fragmentsvariable_valuesruntime_typeselection_setreturnc           
      L    i }t          | |||||t                                 |S )a;  Collect fields.

    Given a selection_set, collects all the fields and returns them.

    collect_fields requires the "runtime type" of an object. For a field that
    returns an Interface or Union type, the "runtime type" will be the actual
    object type returned by that field.

    For internal use only.
    )collect_fields_implset)r   r   r   r   r   fieldss         `/var/www/html/netbox-4.1.3/venv/lib/python3.11/site-packages/graphql/execution/collect_fields.pyr   r      s8    " *,F	?L-QTQVQV   M    return_typefield_nodesc           
      r    i }t                      }|D ]#}|j        rt          | ||||j        ||           $|S )ar  Collect sub fields.

    Given a list of field nodes, collects all the subfields of the passed in fields,
    and returns them at the end.

    collect_sub_fields requires the "return type" of an object. For a field that
    returns an Interface or Union type, the "return type" will be the actual
    object type returned by that field.

    For internal use only.
    )r"   r   r!   )r   r   r   r&   r'   sub_field_nodesvisited_fragment_namesnodes           r$   r   r   0   s`    $ 35O'*uu 
 
 		"&   r%   r#   r*   Nc           
         |j         D ]C}t          |t                    rJt          ||          s)t	          |          }|                    |g                               |           bt          |t                    r=t          ||          rt          | ||          st          | ||||j
        ||           t          |t                    rz|j        j        }	|	|v st          ||          s|                    |	           |                    |	          }
|
rt          | |
|          s)t          | ||||
j
        ||           EdS )z)Collect fields (internal implementation).N)
selections
isinstancer
   should_include_nodeget_field_entry_key
setdefaultappendr   does_fragment_condition_matchr!   r   r   namevalueaddget)r   r   r   r   r   r#   r*   	selectionr4   	frag_namefragments              r$   r!   r!   R   s    #- ( (	i++ '	&	BB &y11DdB''..y9999	#566 "	&  269lSS '&    	#566 	!,I222:M; ;2 "&&y111 }}Y//H #@,$ $  &&  A( (r%   r+   c                     t          t          ||           }|r
|d         rdS t          t          ||           }|r
|d         sdS dS )zCheck if node should be included

    Determines if a field should be included based on the @include and @skip
    directives, where @skip has higher precedence than @include.
    ifFT)r   r   r   )r   r+   skipincludes       r$   r/   r/      s]       4dOLLD T
 u"#:D/RRG wt} u4r%   r:   type_c                     |j         }|sdS t          | |          }||u rdS t          |          r)|                     t	          t
          |          |          S dS )z8Determine if a fragment is applicable to the given type.TF)type_conditionr   r   is_sub_typer   r   )r   r:   r?   type_condition_nodeconditional_types        r$   r3   r3      st     #1 t$V-@AA5  t()) V!!$':<L"M"MuUUU5r%   c                 @    | j         r| j         j        n| j        j        S )z@Implements the logic to compute the key of a given field's entry)aliasr5   r4   )r+   s    r$   r0   r0      s    #z>4:ty>r%   )!typingr   r   r   r   r   r   languager
   r   r   r   r   typer   r   r   r   r   r   utilities.type_from_astr   valuesr   __all__strr   r   r!   boolr/   r3   r0    r%   r$   <module>rP      s   4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4                             4 3 3 3 3 3 ( ( ( ( ( (1
2C//0 #s(^ $	
 $ 
#tI
   0C//0 #s(^ #	
 i 
#tI
   D22C//02 #s(^2 $	2
 $2 d9o%&2  H2 
2 2 2 2j#s(^
"I/AA
B 
   (*,>>?  
	   "?i ?C ? ? ? ? ? ?r%   