o
    tBh#                  	   @   s  d dl mZmZmZmZmZmZmZ ddlm	Z	m
Z
 ddlmZ ddlmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z% ddl&m&Z& g d	Z'd
ede(fddZ)d
ede(fddZ*dede+fddZ,d
edeege+f deege+f de(fddZ-d
edee( fddZ.d
ede+fddZ/dede(fddZ0dede(fddZ1deeef de(fdd Z2dede(fd!d"Z3dede(fd#d$Z4dede(fd%d&Z5dede(fd'd(Z6dede(fd)d*Z7deeef de(fd+d,Z8d-ee( de(fd.d/Z9dKd1ee(ef d2e(de(fd3d4Z:d5e(d6ede(fd7d8Z;d9ede(fd:d;Z<d<ee( de(fd=d>Z=d?ede(fd@dAZ>	0	BdLdCeeeeeef d2e(dDe+de(fdEdFZ?dGedede(fdHdIZ@dJS )M    )AnyCallableDictListOptionalUnioncast   )	print_astStringValueNode)is_printable_as_block_string)inspect)DEFAULT_DEPRECATION_REASONGraphQLArgumentGraphQLDirectiveGraphQLEnumTypeGraphQLEnumValueGraphQLInputObjectTypeGraphQLInputTypeGraphQLInterfaceTypeGraphQLNamedTypeGraphQLObjectTypeGraphQLScalarTypeGraphQLSchemaGraphQLUnionTypeis_enum_typeis_input_object_typeis_interface_typeis_introspection_typeis_object_typeis_scalar_typeis_specified_directiveis_specified_scalar_typeis_union_type   )ast_from_value)print_schemaprint_introspection_schema
print_typeprint_valueschemareturnc                 C   s   t | dd tS )Nc                 S   s
   t |  S N)r!   )n r.   u/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/graphql/utilities/print_schema.py<lambda>%   s   
 zprint_schema.<locals>.<lambda>)print_filtered_schemais_defined_typer*   r.   r.   r/   r&   #   s   
r&   c                 C   s   t | ttS r,   )r1   r!   r   r3   r.   r.   r/   r'   )   s   r'   type_c                 C   s   t |  o	t|  S r,   )r"   r   r4   r.   r.   r/   r2   -   s   r2   directive_filtertype_filterc                 C   sL   t || j}t || j }dg t d t| ftt|tt|R S )Nz

)	filter
directivestype_mapvaluesjoinprint_schema_definitionmapprint_directiver(   )r*   r6   r7   r9   typesr.   r.   r/   r1   1   s   r1   c                 C   s   | j d u rt| rd S g }| j}|r|d|j  | j}|r)|d|j  | j}|r7|d|j  t| d d| d S )Nz	  query: z  mutation: z  subscription: z	schema {


})	descriptionis_schema_of_common_names
query_typeappendnamemutation_typesubscription_typeprint_descriptionr<   )r*   operation_typesrE   rH   rI   r.   r.   r/   r=   B   s   r=   c                 C   sF   | j }|r|jdkrdS | j}|r|jdkrdS | j}| p"|jdkS )a  Check whether this schema uses the common naming convention.

    GraphQL schema define root types for each type of operation. These types are the
    same as any other type and can be named in any manner, however there is a common
    naming convention:

    schema {
      query: Query
      mutation: Mutation
      subscription: Subscription
    }

    When using this naming convention, the schema description can be omitted.
    QueryFMutationSubscription)rE   rG   rH   rI   )r*   rE   rH   rI   r.   r.   r/   rD   W   s   rD   c                 C   s   t | rtt| } t| S t| rtt| } t| S t| r'tt| } t	| S t
| r4tt| } t| S t| rAtt| } t| S t| rNtt| } t| S tdt|  d)NzUnexpected type: .)r    r   r   print_scalarr   r   print_objectr   r   print_interfacer#   r   print_unionr   r   
print_enumr   r   print_input_object	TypeErrorr   r5   r.   r.   r/   r(   r   s&   





r(   c                 C   s   t | d| j  t|  S )Nzscalar )rJ   rG   print_specified_by_urlr5   r.   r.   r/   rP      s   
rP   c                 C   s&   | j }|rdddd |D  S dS )Nz implements z & c                 s       | ]}|j V  qd S r,   rG   ).0ir.   r.   r/   	<genexpr>       z/print_implemented_interfaces.<locals>.<genexpr> )
interfacesr<   )r4   r_   r.   r.   r/   print_implemented_interfaces   s    r`   c                 C   $   t | d| j  t|  t|  S )Nztype rJ   rG   r`   print_fieldsr5   r.   r.   r/   rQ         
rQ   c                 C   ra   )Nz
interface rb   r5   r.   r.   r/   rR      rd   rR   c                 C   s>   | j }|rdddd |D  nd}t| d| j  | S )N =  | c                 s   rX   r,   rY   )rZ   tr.   r.   r/   r\      r]   zprint_union.<locals>.<genexpr>r^   zunion )r@   r<   rJ   rG   )r4   r@   possible_typesr.   r.   r/   rS      s    rS   c                 C   4   dd t | j D }t| d| j  t| S )Nc                 S   s6   g | ]\}\}}t |d | d |  t|j qS   )rJ   print_deprecateddeprecation_reason)rZ   r[   rG   valuer.   r.   r/   
<listcomp>   s    
zprint_enum.<locals>.<listcomp>zenum )	enumerater;   itemsrJ   rG   print_block)r4   r;   r.   r.   r/   rT      s   rT   c                 C   ri   )Nc                 S   s0   g | ]\}\}}t |d | d  t|| qS rj   rJ   print_input_valuerZ   r[   rG   fieldr.   r.   r/   ro      s    
z&print_input_object.<locals>.<listcomp>zinput )rp   fieldsrq   rJ   rG   rr   r4   rw   r.   r.   r/   rU      s   rU   c                 C   s    dd t | j D }t|S )Nc                 S   sN   g | ]#\}\}}t |d | d |  t|jd  d|j  t|j qS )rk   : )rJ   
print_argsargstyperl   rm   ru   r.   r.   r/   ro      s    


z print_fields.<locals>.<listcomp>)rp   rw   rq   rr   rx   r.   r.   r/   rc      s   rc   rq   c                 C   s   | rdd |  d S dS )Nz {
rA   rB   r^   )r<   )rq   r.   r.   r/   rr      s   rr   r^   r{   indentationc                    sn   | sdS t dd |  D sdddd |  D  d S dd	 fd
dt|  D  d	  d S )Nr^   c                 s   rX   r,   )rC   )rZ   argr.   r.   r/   r\      r]   zprint_args.<locals>.<genexpr>(z, c                 s   s    | ]
\}}t ||V  qd S r,   )rt   )rZ   rG   r~   r.   r.   r/   r\      s    )z(
rA   c                 3   s@    | ]\}\}}t |d   | d    t|| V  qdS )rk   Nrs   )rZ   r[   rG   r~   r}   r.   r/   r\      s    

)anyr;   r<   rq   rp   )r{   r}   r.   r   r/   rz      s"   

rz   rG   r~   c                 C   sB   t |j|j}|  d|j }|r|dt| 7 }|t|j S )Nry   re   )r%   default_valuer|   r
   rl   rm   )rG   r~   default_astarg_declr.   r.   r/   rt      s
   rt   	directivec                 C   sF   t | d| j  t| j | jrdnd d ddd | jD  S )Nzdirective @z repeatabler^   z on rf   c                 s   rX   r,   rY   )rZ   locationr.   r.   r/   r\      r]   z"print_directive.<locals>.<genexpr>)rJ   rG   rz   r{   is_repeatabler<   	locations)r   r.   r.   r/   r?      s   
r?   reasonc                 C   s2   | d u rdS | t krtt| d}d| dS dS )Nr^   rn   z @deprecated(reason: r   z @deprecated)r   r
   r   )r   	ast_valuer.   r.   r/   rl      s   rl   scalarc                 C   s*   | j d u rdS tt| j d}d| dS )Nr^   r   z @specifiedBy(url: r   )specified_by_urlr
   r   )r   r   r.   r.   r/   rW     s   
rW   Tdef_first_in_blockc                 C   sR   | j }|d u r	dS tt|t|d}|r|sd| n|}||dd|  d S )Nr^   )rn   blockrA   )rC   r
   r   r   replace)r   r}   r   rC   block_stringprefixr.   r.   r/   rJ     s   rJ   rn   c                 C   s   t t| |S )z=@deprecated: Convenience function for printing a Python value)r
   r%   )rn   r4   r.   r.   r/   r)   (  s   r)   N)r^   )r^   T)Atypingr   r   r   r   r   r   r   languager
   r   language.block_stringr   pyutilsr   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r%   __all__strr&   r'   boolr2   r1   r=   rD   r(   rP   r`   rQ   rR   rS   rT   rU   rc   rr   rz   rt   r?   rl   rW   rJ   r)   r.   r.   r.   r/   <module>   sv   $ `


		
 		

