+
     hC  c                   s    ^ RI t ^RIHtHtHt ^RIHtHt ^RIH	t	 ^RI
Ht ^RIHt RtRtR	t ! R
 R]4      t ! R R]]4      tR# )    N)quote_stringrandom_stringstringify_param_value)AsyncGraphCommandsGraphCommands)Edge)Node)Pathz	DB.LABELSzDB.RELATIONSHIPTYPESzDB.PROPERTYKEYSc                   s   a  ] tR t^t o Rt]! 4       3R lt]R 4       tR t	R t
R tR tR tR	 tR
 tR tR tR tR tRR/R ltR tR tR tRtV tR# )Graphz'
Graph, collection of nodes and edges.
c                s    \         P                  ! \        R4      4       W n        Wn        VP
                  V n        / V n        . V n        . V n        . V n	        . V n
        ^ V n        R# )z
Create a new graph.
zoRedisGraph support is deprecated as of Redis Stack 7.2                 (https://redis.com/blog/redisgraph-eol/)N)warningsZwarnZDeprecationWarningNAMEclientexecute_commandnodesedges_labels_properties_relationship_typesversion)selfr   names   &&&B/usr/lib/python3.14/site-packages/redis/commands/graph/__init__.py__init__ZGraph.__init__   sc     	:	
 	%55

#%     c                s    V P                   # N)r   r      &r   r   Z
Graph.name(   s    yyr   c                s0    . V n         . V n        . V n        R # r   r   r   r   r   r   r   _clear_schemaZGraph._clear_schema,   s    #% r   c                s    V P                  4        V P                  4        V P                  4        V P                  4        R # r   )r   _refresh_labels_refresh_relations_refresh_attributesr   r   r   _refresh_schemaZGraph._refresh_schema1   s2    !  "r   c                    V P                  4       p\        V4       UUu. uF  w  r#V^ ,          NK  	  uppV n        R# u uppi r    Nlabels	enumerater   r   Zlbls_Zl   &   r   r   ZGraph._refresh_labels7   s4    {{} *349!99   >c                r"   r#   relationship_typesr&   r   r   Zrelsr(   Zrr)   r   r   ZGraph._refresh_relations=   s8    &&( 6?t_#E_TQAaDD_#E #Er*   c                r"   r#   property_keysr&   r   r   Zpropsr(   pr)   r   r    ZGraph._refresh_attributesC   s;    ""$ .7u-=>-=TQAaDD-=>>r*   c                     V P                   V,          pV#   \         d(    T P                  4        T P                   T,          p T# i ; i)G
Returns a label by it's index

Args:

idx:
    The index of the label
r   
IndexErrorr   r   idxZlabel   && r   	get_labelZGraph.get_labelI   sL    	&LL%E
 	  	&  "LL%E		&    .A	A	c                r2   )V
Returns a relationship type by it's index

Args:

idx:
    The index of the relation
r   r5   r   r   r7   Zrelationship_typer8   r   get_relationZGraph.get_relationZ   sT    	> $ 8 8 =
 ! 	  	>##% $ 8 8 =  		>r:   c                r2   )M
Returns a property by it's index

Args:

idx:
    The index of the property
r   r5   r    r   r7   r1   r8   r   get_propertyZGraph.get_propertyk   sP    	&  %A
 	  	&$$&  %A		&r:   c                sp    VP                   f   \        4       Vn         WP                  VP                   &   R# )z
Adds a node to the graph.
N)aliasr   r   )r   node   &&r   add_nodeZGraph.add_node|   s'     ::&DJ!%

4::r   c                s   V P                   VP                  P                  ,          '       d.   V P                   VP                  P                  ,          '       g   \	        R4      hV P
                  P                  V4       R# )z
Adds an edge to the graph.
z$Both edge's end must be in the graphN)r   Zsrc_noderC   Z	dest_nodeZAssertionErrorr   Zappend)r   edgerE   r   add_edgeZGraph.add_edge   sS     

4==..//DJJt~~?S?S4T4T !GHH

$r   c                s    Vf   R# \        V\        4      '       g   \        R4      hRpVP                  4        F5  w  r4V\	        V4      R,           \        V4      ,           R,           ,          pK7  	  V# )NZ z'params' must be a dictzCYPHER Z=Z )Z
isinstanceZdictZ	TypeErrorZitemsZstrr   )r   ZparamsZparams_headerZkeyZvalues   &&   r   _build_params_headerZGraph._build_params_header   sb    >&$''566! ,,.JCSX^.CE.JJSPPM )r   	read_onlyFc               s    V Uu. uF  p\        V4      NK  	  ppR V RRP                  V4       R2pVP                  RR4      pVe   VRRP                  V4       2,          pV P                  WbR7      # u upi zCALL Z(Z,Z)yNzYIELD rJ   r   ZjoinZgetZqueryr   Z	procedurerJ   ZargsZkwagrsZargZqrL      &&$*,   r   call_procedureZGraph.call_procedure   s|    -12TcS!T2I;a/q1JJsD!=6#((1+''Azz!z11 3s   A6c                D    V P                  \        R R7      P                  # TrM   rQ   	DB_LABELS
result_setr   r   r   r%   ZGraph.labels   s    ""9"=HHHr   c                rR   rS   rQ   DB_RAELATIONSHIPTYPESrV   r   r   r   r,   ZGraph.relationship_types   s    ""#8D"ITTTr   c                rR   rS   rQ   DB_PROPERTYKEYSrV   r   r   r   r/   ZGraph.property_keys   s    ""?d"CNNNr   )	r   r   r   r   r   r   r   r   r   N)__name__
__module____qualname____firstlineno____doc__r   r   Zpropertyr   r   r!   r   r   r    r9   r>   rB   rF   rH   rI   rQ   r%   r,   r/   __static_attributes____classdictcell__Z__classdict__   @r   r	   r	      s      %2O *  &
#:F?"!""& 	2 2IUO Or   r	   c                   sh   a  ] tR t^t o RtR tR tR tR tR t	R t
RR	/R
 ltR tR tR tRtV tR# )
AsyncGraphzAsync version for Graphc                   "   V P                  4       G R j  xL
 p\        V4       UUu. uF  w  r#V^ ,          NK  	  uppV n        R #  L1u uppi 5ir   r$   r'   r)   r   r   ZAsyncGraph._refresh_labels   sA     [[]" *349!9 # :   AAAA
A
Ac                re   r   r.   r0   r)   r   r    ZAsyncGraph._refresh_attributes   sH     ((** .7u-=>-=TQAaDD-=> + ?rf   c                re   r   r+   r-   r)   r   r   ZAsyncGraph._refresh_relations   sF     ,,.. 6?t_#E_TQAaDD_#E  / $Frf   c                   "    V P                   V,          pV#   \         d1    T P                  4       G Rj  xL 
  T P                   T,          p T# i ; i5i)r3   Nr4   r6   r8   r   r9   ZAsyncGraph.get_label   sT     	&LL%E
 	  	&&&(((LL%E		&.   A AA:AAAAc                rg   )r?   Nr@   rA   r8   r   rB   ZAsyncGraph.get_property   sX     	&  %A
 	  	&**,,,  %A		&rh   c                rg   )r;   Nr<   r=   r8   r   r>   ZAsyncGraph.get_relation   s\     	> $ 8 8 =
 ! 	  	>))+++ $ 8 8 =  		>rh   rJ   Fc               s  "   V Uu. uF  p\        V4      NK  	  ppR V RRP                  V4       R2pVP                  RR4      pVe   RRP                  V4       2 V P                  WbR7      G Rj  xL
 # u upi  L	5irK   rN   rO   rP   r   rQ   ZAsyncGraph.call_procedure   s     -12TcS!T2I;a/q1JJsD!=SXXa[M"ZZZ777 3 8s   B A9AB 4A>5
B c                `   "   V P                  \        R R7      G Rj  xL
 P                  #  L5iTrM   NrT   r   r   r   r%   ZAsyncGraph.labels   s'     )))t)DDPPPD   .,.c                ri   rj   rY   r   r   r   r/   ZAsyncGraph.property_keys  s'     ))/T)JJVVVJrk   c                ri   rj   rW   r   r   r   r,   ZAsyncGraph.relationship_types  s)     %%&;t%LL
*	Lrk   r   N)r[   r\   r]   r^   r_   r   r    r   r9   rB   r>   rQ   r%   r/   r,   r`   ra   rb   rc   r   rd   rd      sI     !:?F""!"8u 8QW r   rd   )r
   Zhelpersr   r   r   Zcommandsr   r   rG   r   rD   r   Zpathr   rU   rX   rZ   r	   rd   ) r   r   <module>rl      sL     H H 7   	. #\OM \O~Z* Zr   