ó
    Ð]j  ã                  óÊ  • % S r SSKJr  SSKrSSKJrJrJr  SSKJ	r	  SSK
Jr  SSK
Jr  SS	KJrJr  SS
KJr  SSKJrJrJr  SSKJr  \(       a  SSKJr  SSKJrJr  SSKJr  SSK J!r!  Sr"S\#S'   \RH                  RJ                  r%\RH                  RL                  r&\RN                  RP                  r(\RR                  RT                  r*\RV                  " S5      r, " S S5      r-g)z
commands pipeline management
é    )ÚannotationsN)ÚTYPE_CHECKINGÚAnyÚ	TypeAlias)Údequeé   )Úerrors)Úpq)ÚPipelineCommandÚPQGen)Úconnection_summary)Ú
fetch_manyÚpipeline_communicateÚsend)Úcapabilities)ÚPGresult)ÚKeyÚPrepare)Ú
BaseCursor)ÚBaseConnectionzEtuple[BaseCursor[Any, Any], tuple[Key, Prepare, bytes] | None] | Noner   ÚPendingResultÚpsycopgc                  ó¶   • \ rS rSr% S\S'   S\S'   SS jrSS jr\SS j5       r\	SS	 j5       r
SS
 jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrSrg)ÚBasePipelineé(   zdeque[PipelineCommand]Úcommand_queuezdeque[PendingResult]Úresult_queuec                óœ   • Xl         UR                  U l        [        [           " 5       U l        [        [
           " 5       U l        SU l        g )Nr   )Ú_connÚpgconnr   r   r   r   r   Úlevel)ÚselfÚconns     ÚS/home/mande/repo/quber/.venv/lib/python3.13/site-packages/psycopg/_pipeline_base.pyÚ__init__ÚBasePipeline.__init__,   s9   € ØŒ
Ø—k‘kˆŒÜ"¤?Ò3Ó5ˆÔÜ!¤-Ò0Ó2ˆÔØˆ�
ó    c                óÊ   • U R                   R                   SU R                   R                   3n[        U R                  R
                  5      nSU SU S[        U 5      S S3$ )NÚ.Ú<Ú z at 0xÚxÚ>)Ú	__class__Ú
__module__Ú__qualname__r   r   r    Úid)r"   ÚclsÚinfos      r$   Ú__repr__ÚBasePipeline.__repr__3   s]   € Ø—‘×*Ñ*Ð+¨1¨T¯^©^×-HÑ-HÐ,IÐJˆÜ! $§*¡*×"3Ñ"3Ó4ˆØ�3�%�q˜˜˜f¤R¨£X¨a L°Ð2Ð2r'   c                óV   • [         R                  " U R                  R                  5      $ )N)r
   ÚPipelineStatusr    Úpipeline_status©r"   s    r$   ÚstatusÚBasePipeline.status8   s   € ä× Ò  §¡×!<Ñ!<Ó=Ð=r'   c                ó,   • [         R                  " 5       $ )zCReturn `!True` if the psycopg libpq wrapper supports pipeline mode.)r   Úhas_pipeline)r2   s    r$   Úis_supportedÚBasePipeline.is_supported<   s   € ô ×(Ò(Ó*Ð*r'   c              #  óF  #   • [         R                  " SS9  U R                  S:X  a  U R                  R	                  5         OGU R
                  (       d  U R                  R                  [        :X  a  U R                  5        S h  v•N   U =R                  S-  sl        g  N7f)NT)Úcheckr   r   )	r   r=   r!   r    Úenter_pipeline_moder   Útransaction_statusÚACTIVEÚ	_sync_genr9   s    r$   Ú
_enter_genÚBasePipeline._enter_genA   sl   é € Ü×!Ò!¨Ò-Ø�:‰:˜‹?Ø�K‰K×+Ñ+Õ-Ø×× 4§;¡;×#AÑ#AÄVÓ#Kð —~‘~Ó'×'Ð'Ø�
Š
�a‰Ž
ñ (ùs   ‚BB!ÂBÂB!c                ób  • U =R                   S-  sl         U R                   S:X  a;  U R                  R                  [        :w  a   U R                  R	                  5         g g g ! [
        R                   a8  nU(       a  [        R                  SX5         S nAg UR                  S 5      eS nAff = f)Nr   r   zerror ignored exiting %r: %s)
r!   r    r:   ÚBADÚexit_pipeline_modeÚeÚOperationalErrorÚloggerÚwarningÚwith_traceback)r"   ÚexcÚexc2s      r$   Ú_exitÚBasePipeline._exitO   s‡   € Ø�
Š
�a‰�
Ø�:‰:˜‹?˜tŸ{™{×1Ñ1´SÓ8ð	4Ø—‘×.Ñ.Õ0ð  9ˆ?øô ×%Ñ%ó 4ö Ü—N‘NÐ#AÀ4×NÑNà×-Ñ-¨dÓ3Ð3ûð4ús   ÁA" Á"B.Á6B)ÂB)Â)B.c              #  ó’   #   • U R                  5         U R                  5        S h  v•N   U R                  SS9 S h  v•N   g  N N7f)NF©Úflush©Ú_enqueue_syncÚ_communicate_genÚ
_fetch_genr9   s    r$   rE   ÚBasePipeline._sync_gen]   s?   é € Ø×ÑÔØ×(Ñ(Ó*×*Ð*Ø—?‘?¨�?Ð/×/Ñ/ñ 	+Ù/ùs   ‚$A¦A§A½A¾AÁAc              #  óÎ   #   •  U R                  5         U R                  5        Sh  v•N   U R                  SS9 Sh  v•N   g N N! U R                  SS9 Sh  v•N    f = f7f)zO
Exit current pipeline by sending a Sync and fetch back all remaining results.
NTrU   rW   r9   s    r$   Ú	_exit_genÚBasePipeline._exit_genb   sX   é € ð	3Ø×ÑÔ Ø×,Ñ,Ó.×.Ð.à—‘¨T�Ð2×2Ñ2ñ /á2ø�t—‘¨T�Ð2×2Ò2üsG   ‚A%„#A §A¨A ¬A%¾A¿A%ÁA ÁA%ÁA"ÁAÁA"Á"A%c              #  ó2  #   • [        U R                  U R                  5       Sh  v•N nSnU H/  nU R                  R	                  5       n U R                  XC5        M1     Ub  Ueg NA! [        R                   a  nUc  Un SnAMZ   SnAM`  SnAff = f7f)zaCommunicate with pipeline to send commands and possibly fetch
results, which are then processed.
N)r   r    r   r   ÚpopleftÚ_process_resultsrK   ÚError)r"   ÚfetchedÚ	exceptionÚresultsÚqueuedrP   s         r$   rY   ÚBasePipeline._communicate_genl   s“   é € ô 2°$·+±+¸t×?QÑ?QÓR×RˆØˆ	ÛˆGØ×&Ñ&×.Ñ.Ó0ˆFð$Ø×%Ñ% fÖ6ñ ð Ñ ØˆOð !ñ Søô —7‘7ó $ØÑ$Ø #–Iõ %ûð$üs9   ‚$B¦A(§%BÁA*ÁBÁ*BÁ>BÂBÂBÂBc             #  óø  #   • U R                   (       d  gU(       a7  U R                  R                  5         [        U R                  5       Sh  v•N   SnU R                   (       ad  [	        U R                  5       Sh  v•N =n(       d  O?U R                   R                  5       n U R                  XC5        U R                   (       a  Md  Ub  Ueg N� NS! [        R                   a  nUc  Un SnAN;SnAff = f7f)a.  Fetch available results from the connection and process them with
pipeline queued items.

If 'flush' is True, a PQsendFlushRequest() is issued in order to make
sure results can be fetched. Otherwise, the caller may emit a
PQpipelineSync() call to ensure the output buffer gets flushed before
fetching.
N)	r   r    Úsend_flush_requestr   r   r`   ra   rK   rb   )r"   rV   rd   re   rf   rP   s         r$   rZ   ÚBasePipeline._fetch_gen|   sÕ   é € ð × × ØæØ�K‰K×*Ñ*Ô,Ü˜DŸK™KÓ(×(Ð(àˆ	Ø××Ü+5°d·k±kÓ+B× BÐC�GÕCð Ø×&Ñ&×.Ñ.Ó0ˆFð$Ø×%Ñ% fÔ6ð ××Ñð Ñ ØˆOð !ñ )ñ !Cøô —7‘7ó $ØÑ$Ø #�Iÿøð$üsT   ‚AC:ÁCÁ/C:Á>CÁ?&C:Â&C Â7C:Ã
C:ÃC:ÃC7Ã(C2Ã-C:Ã2C7Ã7C:c                ó�  • Uck  Uu  nUR                   [        :X  a(  [        R                  " X0R                  R
                  S9eUR                   [        :X  a  [        R                  " S5      egUu  pEU(       a+  Uu  pgnUR                  R                  R                  XgX‚5        UR                  U5        UR                  U5        g)aJ  Process a results set fetched from the current pipeline.

This matches 'results' with its respective element in the pipeline
queue. For commands (None value in the pipeline queue), results are
checked directly. For prepare statement creation requests, update the
cache. Otherwise, results are attached to their respective cursor.
N)Úencodingzpipeline aborted)r:   ÚFATAL_ERRORrK   Úerror_from_resultr    Ú	_encodingÚPIPELINE_ABORTEDÚPipelineAbortedr   Ú	_preparedÚvalidateÚ_check_resultsÚ_set_results)	r"   rf   re   ÚresultÚcursorÚprepinfoÚkeyÚprepÚnames	            r$   ra   ÚBasePipeline._process_results›   s§   € ð ‰>Ø‰IˆVØ�}‰}¤Ó+Ü×)Ò)¨&¿;¹;×;PÑ;PÑQÐQØ—‘Ô"2Ó2Ü×'Ò'Ð(:Ó;Ð;ð 3ð  &ÑˆFÞØ"*‘�˜4à—‘×&Ñ&×/Ñ/°¸4ÔIØ×!Ñ! 'Ô*Ø×Ñ Õ(r'   c                ó˜   • U R                   R                  U R                  R                  5        U R                  R                  S5        g)z#Enqueue a PQpipelineSync() command.N)r   Úappendr    Úpipeline_syncr   r9   s    r$   rX   ÚBasePipeline._enqueue_sync²   s4   € à×Ñ×!Ñ! $§+¡+×";Ñ";Ô<Ø×Ñ× Ñ  Õ&r'   )r   r   r!   r    r   N)r#   zBaseConnection[Any]ÚreturnÚNone)r�   Ústr)r�   zpq.PipelineStatus)r�   Úbool)r�   úPQGen[None])rP   zBaseException | Noner�   r‚   )rV   r„   r�   r…   )rf   r   re   zlist[PGresult]r�   r‚   )r�   r‚   )Ú__name__r/   r0   Ú__firstlineno__Ú__annotations__r%   r4   Úpropertyr:   Úclassmethodr>   rF   rR   rE   r]   rY   rZ   ra   rX   Ú__static_attributes__© r'   r$   r   r   (   sh   ‡ Ø)Ó)Ø&Ó&ôô3ð
 ó>ó ð>ð ó+ó ð+ôô4ô0ô
3ôô ô>)÷.'r'   r   ).Ú__doc__Ú
__future__r   ÚloggingÚtypingr   r   r   Úcollectionsr   Ú r	   rK   r
   Úabcr   r   Úpq.miscr   Ú
generatorsr   r   r   Ú_capabilitiesr   Úpq.abcr   Ú
_preparingr   r   Ú_cursor_baser   Ú_connection_baser   r   rˆ   Ú
ExecStatusrm   rp   Ú
ConnStatusrI   ÚTransactionStatusrD   Ú	getLoggerrM   r   rŒ   r'   r$   Ú<module>rŸ      s®   ðòõ #ã ß 0Ñ 0Ý å Ý ß 'Ý 'ß >Ñ >Ý 'æÝ ß(Ý(Ý0ð Lð ˆyó ð �m‰m×'Ñ'€Ø—=‘=×1Ñ1Ð Ø‡m�m×Ñ€à	×	Ñ	×	$Ñ	$€à	×	Ò	˜9Ó	%€÷M'ò M'r'   