ó
    Ð]jB^  ã                  óÚ  • % S r SSKJr  SSKrSSKrSSKJrJrJrJ	r	J
r
  SSKJrJr  SSKJr  SSKJr  SSKJr  SS	KJr  S
SKJr  S
SKJrJrJr  S
SKJrJrJr  S
SK J!r!J"r"  S
SK#J$r$  S
SK%J&r&  S
SK'J(r(  S
SK)J*r*  S
SK+J,r,J-r-J.r.  S
SK/J0r0  S
SK1J2r2  S
SK3J4r4  S
SK5J6r6  S
SK7J8r8  \(       a  SSK9J:r:  S
SK;J<r<J=r=  \." S5      r>\R~                  R€                  r@\R~                  R‚                  rA\R„                  R†                  rC\R„                  Rˆ                  rD\RŠ                  RŒ                  rF\RŠ                  RŽ                  rG\RŠ                  R�                  rH\R’                  R”                  rJ\R’                  R–                  rK\4R˜                  " 5       rM\Rœ                  " S5      rO " S S\	5      rPS\PlQ        \\R¤                  /S4   rSS\TS '   \\P/S4   rUS\TS!'    " S" S#\\&   5      rVg)$z
psycopg connection objects
é    )ÚannotationsN)ÚTYPE_CHECKINGÚAnyÚGenericÚ
NamedTupleÚ	TypeAlias)ÚReferenceTypeÚref)Úwarn)Úpartial)Údeque)ÚCallableé   )Úerrors)Ú
generatorsÚpostgresÚpq)ÚPQGenÚ	PQGenConnÚQueryNoTemplate)ÚSQLÚ
Composable)ÚXid)ÚRow)ÚAdaptersMap)ÚIsolationLevel)ÚLiteralStringÚSelfÚTypeVar)Úconnection_summary)ÚPrepareManager)Úcapabilities)ÚBasePipeline)ÚConnectionInfo)ÚBasePool)ÚPGconnÚPGresultÚ	CursorRowÚpsycopgc                  ó<   • \ rS rSr% SrS\S'    S\S'    S\S'   Srg	)
ÚNotifyé<   z8An asynchronous notification received from the database.ÚstrÚchannelÚpayloadÚintÚpid© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__Ú__static_attributes__r2   ó    ÚU/home/mande/repo/quber/.venv/lib/python3.13/site-packages/psycopg/_connection_base.pyr+   r+   <   s   ‡ ÙBàƒLØIàƒLØ3à	ƒHÚEr:   r+   r   ÚNoticeHandlerÚNotifyHandlerc                  ó¢  • \ rS rSrSr\R                  r\R                  r\R                  r\R                  r	\R                  r
\R                  r\R                  r\R                  r\R                  r\R                  rS;S jr\4S<S jjrS=S jr\S>S j5       r\S>S j5       r\S>S j5       r\R0                  S?S	 j5       rS?S
 jrS@S jr\SAS j5       r\R0                  SBS j5       rSBS jrSCS jr\SDS j5       r\R0                  SES j5       rSES jrSFS jr \SDS j5       r!\!R0                  SES j5       r!SES jr"SFS jr#SGS jr$\SHS j5       r%\SIS j5       r&\SJS j5       r'SKS jr(SLS jr)S>S jr*SMS jr+SNS  jr,SNS! jr-\.      SOS" j5       r/SPS# jr0SPS$ jr1\.      SQS% j5       r2\SRS& j5       r3\3R0                  SSS' j5       r3\SRS( j5       r4\4R0                  SSS) j5       r4\5 STS*S+.     SUS, jjj5       r6\74     SVS- jjr8SWS. jr9SLS/ jr:SXS0 jr;SYS1 jr<SXS2 jr=SXS3 jr>SZS4 jr?S[S5 jr@SXS6 jrA      S\S7 jrBSLS8 jrCS9rDg:)]ÚBaseConnectionéO   z¡
Base class for different types of connections.

Share common functionalities such as access to the wrapped PGconn, but
allow different interfaces (sync/async).
c                ó’  • Xl         SU l        S U l        / U l        / U l        SU l        SU l        [        5       U l        S U l	        [        5       U l        [        U 5      n[        [        R                  U5      Ul        [        [        R"                  U5      Ul        U   S U l        U   U   S U l        S U l        S U l        SU l        g )NFr   r:   )ÚpgconnÚ_autocommitÚ	_adaptersÚ_notice_handlersÚ_notify_handlersÚ_num_transactionsÚ_closedr!   Ú	_preparedÚ_tpcr   Ú_notifies_backlogr
   r   r?   Ú_notice_handlerÚnotice_handlerÚ_notify_handlerÚnotify_handlerÚ	_pipelineÚ_isolation_levelÚ
_read_onlyÚ_deferrableÚ_begin_statement)ÚselfrB   Úwselfs      r;   Ú__init__ÚBaseConnection.__init__c   s¼   € ØŒØ ˆÔð .2ˆŒà57ˆÔØ57ˆÔð "#ˆÔàˆŒÜ)7Ó)9ˆŒØ-1ˆŒ	ô 8=³wˆÔä�D“	ˆÜ '¬×(FÑ(FÈÓ NˆÔÜ '¬×(FÑ(FÈÓ NˆÔñ 	à.2ˆŒñ 	áà7;ˆÔØ'+ˆŒØ(,ˆÔØ #ˆÕr:   c                ó¶   • [        U S5      (       d  g U R                  (       a  g [        U S5      (       a  g U" [        R                  U 5       S3[        5        g )NrB   Ú_poolz_ was deleted while still open. Please use 'with' or '.close()' to close the connection properly)ÚhasattrÚclosedÚobjectÚ__repr__ÚResourceWarning)rU   Ú_BaseConnection__warns     r;   Ú__del__ÚBaseConnection.__del__Œ   sV   € ä�t˜X×&Ñ&Øð �;�;Øô �4˜×!Ñ!ØáÜ�‰˜tÓ$Ð%ð &Pð Päõ	
r:   c                ó¶   • U R                   R                   SU R                   R                   3n[        U R                  5      nSU SU S[        U 5      S S3$ )NÚ.Ú<Ú z at 0xÚxÚ>)Ú	__class__r4   r5   r    rB   Úid)rU   ÚclsÚinfos      r;   r^   ÚBaseConnection.__repr__Ÿ   sW   € Ø—‘×*Ñ*Ð+¨1¨T¯^©^×-HÑ-HÐ,IÐJˆÜ! $§+¡+Ó.ˆØ�3�%�q˜˜˜f¤R¨£X¨a L°Ð2Ð2r:   c                ó<   • U R                   R                  [        :H  $ )z$`!True` if the connection is closed.)rB   ÚstatusÚBAD©rU   s    r;   r\   ÚBaseConnection.closed¤   s   € ð �{‰{×!Ñ!¤SÑ(Ð(r:   c                ól   • U R                   R                  [        :H  =(       a    U R                  (       + $ )z£
`!True` if the connection was interrupted.

A broken connection is always `closed`, but wasn't closed in a clean
way, such as using `close()` or a `!with` block.
)rB   ro   rp   rH   rq   s    r;   ÚbrokenÚBaseConnection.broken©   s%   € ð �{‰{×!Ñ!¤SÑ(×=°·±Ô-=Ð=r:   c                ó   • U R                   $ )z'The autocommit state of the connection.)rC   rq   s    r;   Ú
autocommitÚBaseConnection.autocommit³   s   € ð ×ÑÐr:   c                ó&   • U R                  U5        g ©N)Ú_set_autocommit©rU   Úvalues     r;   rw   rx   ¸   ó   € à×Ñ˜UÕ#r:   c                ó   • [         erz   ©ÚNotImplementedErrorr|   s     r;   r{   ÚBaseConnection._set_autocommit¼   ó   € Ü!Ð!r:   c              #  ób   #   • U R                  S5       S h  v•N   [        U5      U l        g  N7f)Nrw   )Ú_check_intrans_genÚboolrC   r|   s     r;   Ú_set_autocommit_genÚ"BaseConnection._set_autocommit_gen¿   s*   é € Ø×*Ñ*¨<Ó8×8Ð8Ü ›;ˆÕñ 	9ùs   ‚/—-˜/c                ó   • U R                   $ )zH
The isolation level of the new transactions started on the connection.
)rQ   rq   s    r;   Úisolation_levelÚBaseConnection.isolation_levelÃ   s   € ð
 ×$Ñ$Ð$r:   c                ó&   • U R                  U5        g rz   )Ú_set_isolation_levelr|   s     r;   rŠ   r‹   Ê   s   € à×!Ñ! %Õ(r:   c                ó   • [         erz   r€   r|   s     r;   r�   Ú#BaseConnection._set_isolation_levelÎ   rƒ   r:   c              #  óz   #   • U R                  S5       S h  v•N   Ub  [        U5      OS U l        SU l        g  N!7f)NrŠ   r:   )r…   r   rQ   rT   r|   s     r;   Ú_set_isolation_level_genÚ'BaseConnection._set_isolation_level_genÑ   s<   é € Ø×*Ñ*Ð+<Ó=×=Ð=Ø9>Ñ9J¤¨uÔ 5ÐPTˆÔØ #ˆÕñ 	>ùó   ‚;—9˜";c                ó   • U R                   $ )zH
The read-only state of the new transactions started on the connection.
)rR   rq   s    r;   Ú	read_onlyÚBaseConnection.read_onlyÖ   s   € ð
 �‰Ðr:   c                ó&   • U R                  U5        g rz   )Ú_set_read_onlyr|   s     r;   r•   r–   Ý   s   € à×Ñ˜EÕ"r:   c                ó   • [         erz   r€   r|   s     r;   r˜   ÚBaseConnection._set_read_onlyá   rƒ   r:   c              #  óz   #   • U R                  S5       S h  v•N   Ub  [        U5      OS U l        SU l        g  N!7f)Nr•   r:   )r…   r†   rR   rT   r|   s     r;   Ú_set_read_only_genÚ!BaseConnection._set_read_only_genä   s8   é € Ø×*Ñ*¨;Ó7×7Ð7Ø).Ñ):œ$˜uœ+ÀˆŒØ #ˆÕñ 	8ùr“   c                ó   • U R                   $ )zI
The deferrable state of the new transactions started on the connection.
)rS   rq   s    r;   Ú
deferrableÚBaseConnection.deferrableé   s   € ð
 ×ÑÐr:   c                ó&   • U R                  U5        g rz   )Ú_set_deferrabler|   s     r;   rŸ   r    ð   r~   r:   c                ó   • [         erz   r€   r|   s     r;   r¢   ÚBaseConnection._set_deferrableô   rƒ   r:   c              #  óz   #   • U R                  S5       S h  v•N   Ub  [        U5      OS U l        SU l        g  N!7f)NrŸ   r:   )r…   r†   rS   rT   r|   s     r;   Ú_set_deferrable_genÚ"BaseConnection._set_deferrable_gen÷   s9   é € Ø×*Ñ*¨<Ó8×8Ð8Ø*/Ñ*;œ4 œ;ÀˆÔØ #ˆÕñ 	9ùr“   c              #  óÄ  #   • U R                   R                  =n[        :X  aI  U R                  (       a8  U R                  R	                  5        S h  v•N   U R                   R                  nU[        :w  ag  U R
                  (       a  [        R                  " SU< S35      e[        R                  " SU< S[        R                  " U5      R                   35      eg  NŒ7f)Nzcan't change z2 now: connection.transaction() context in progressz' now: connection in transaction status )rB   Útransaction_statusÚIDLErP   Ú	_sync_genrG   ÚeÚProgrammingErrorr   ÚTransactionStatusÚname)rU   Ú	attributero   s      r;   r…   Ú!BaseConnection._check_intrans_genü   sÄ   é € à—k‘k×4Ñ4Ð4ˆF¼Ó=À$Ç.Ç.Ø—~‘~×/Ñ/Ó1×1Ð1Ø—[‘[×3Ñ3ˆFØ”T‹>Ø×%×%Ü×(Ò(Ø# I¡=ð 1Cð Cóð ô
 ×(Ò(Ø# I¡=ð 18ä×+Ò+¨FÓ3×8Ñ8Ð9ð;óð ð ñ 2ùs   ‚AC ÁCÁBC c                ó,   • [        U R                  5      $ )z>A `ConnectionInfo` attribute to inspect connection properties.)r$   rB   rq   s    r;   rl   ÚBaseConnection.info  s   € ô ˜dŸk™kÓ*Ð*r:   c                óx   • U R                   (       d  [        [        R                  5      U l         U R                   $ rz   )rD   r   r   Úadaptersrq   s    r;   rµ   ÚBaseConnection.adapters  s%   € à�~�~Ü(¬×):Ñ):Ó;ˆDŒNà�~‰~Ðr:   c                ó   • U $ rz   r2   rq   s    r;   Ú
connectionÚBaseConnection.connection  s	   € ð ˆr:   c                ó.   • U R                   R                  $ )zÆReturn the file descriptor of the connection.

This function allows to use the connection as file-like object in
functions waiting for readiness, such as the ones defined in the
`selectors` module.
)rB   Úsocketrq   s    r;   ÚfilenoÚBaseConnection.fileno  s   € ð �{‰{×!Ñ!Ð!r:   c                ó„   • U R                  5       (       a+  U R                  R                  5       nUR                  5         gg)z/Cancel the current operation on the connection.N)Ú_should_cancelrB   Ú
get_cancelÚcancel)rU   Úcs     r;   rÁ   ÚBaseConnection.cancel(  s1   € à×Ñ× Ñ Ø—‘×&Ñ&Ó(ˆAØ�H‰H�Jð !r:   c                óž   • U R                   (       a  gU R                  (       a*  U R                  S   (       a  [        R                  " S5      eg)zXCheck whether the current command should actually be cancelled when
invoking cancel*().
Fr   z=cancel() cannot be used with a prepared two-phase transactionT)r\   rJ   r¬   r­   rq   s    r;   r¿   ÚBaseConnection._should_cancel.  s:   € ð �;�;ØØ�9�9˜Ÿ™ 1ŸÜ×$Ò$ØOóð ð r:   c             #  óœ   #   • U R                   R                  5       nUR                  5         [        R                  " X!S9 S h  v•N   g  N7f)N©Útimeout)rB   Úcancel_connÚstartr   rÁ   )rU   rÈ   rÉ   s      r;   Ú_cancel_genÚBaseConnection._cancel_gen=  s7   é € Ø—k‘k×-Ñ-Ó/ˆØ×ÑÔÜ×$Ò$ [ÑB×BÓBùs   ‚AAÁA
ÁAc                ó:   • U R                   R                  U5        g)zÁ
Register a callable to be invoked when a notice message is received.

:param callback: the callback to call upon message received.
:type callback: Callable[[~psycopg.errors.Diagnostic], None]
N)rE   Úappend©rU   Úcallbacks     r;   Úadd_notice_handlerÚ!BaseConnection.add_notice_handlerB  ó   € ð 	×Ñ×$Ñ$ XÕ.r:   c                ó:   • U R                   R                  U5        g)z¤
Unregister a notice message callable previously registered.

:param callback: the callback to remove.
:type callback: Callable[[~psycopg.errors.Diagnostic], None]
N)rE   ÚremoverÏ   s     r;   Úremove_notice_handlerÚ$BaseConnection.remove_notice_handlerK  rÓ   r:   c                ó,  • U " 5       nU(       a  UR                   (       d  g [        R                  " XR                  R                  5      nUR                    H  n U" U5        M     g ! [
         a!  n[        R                  SXE5         S nAM7  S nAff = f)Nz)error processing notice callback '%s': %s)rE   r¬   Ú
DiagnosticrB   Ú	_encodingÚ	ExceptionÚloggerÚ	exception)rV   ÚresrU   ÚdiagÚcbÚexs         r;   rL   ÚBaseConnection._notice_handlerT  sv   € ñ ‹wˆÞ˜×.×.Øä�|Š|˜C§¡×!6Ñ!6Ó7ˆØ×'Ô'ˆBðVÙ�4–ò (øô ó VÜ× Ñ Ð!LÈb×UÒUûðVús   ÁA(Á(
BÁ2BÂBc                ó:   • U R                   R                  U5        g)z½
Register a callable to be invoked whenever a notification is received.

:param callback: the callback to call upon notification received.
:type callback: Callable[[~psycopg.Notify], None]
N)rF   rÎ   rÏ   s     r;   Úadd_notify_handlerÚ!BaseConnection.add_notify_handlerc  rÓ   r:   c                ó:   • U R                   R                  U5        g)z—
Unregister a notification callable previously registered.

:param callback: the callback to remove.
:type callback: Callable[[~psycopg.Notify], None]
N)rF   rÕ   rÏ   s     r;   Úremove_notify_handlerÚ$BaseConnection.remove_notify_handlerl  rÓ   r:   c                ó|  • U " 5       =n(       d  g UR                   R                  n[        UR                  R	                  U5      UR
                  R	                  U5      UR                  5      nUR                  (       a  UR                   H  nU" U5        M     g UR                  =nb  UR                  U5        g g rz   )
rB   rÚ   r+   ÚrelnameÚdecodeÚextraÚbe_pidrF   rK   rÎ   )rV   ÚpgnrU   ÚencÚnrà   Úds          r;   rN   ÚBaseConnection._notify_handleru  s”   € ñ ›��•Øà�k‰k×#Ñ#ˆÜ�3—;‘;×%Ñ% cÓ*¨C¯I©I×,<Ñ,<¸SÓ,AÀ3Ç:Á:ÓNˆà× × Ø×+Ô+�Ù�1–ò ,ð ×+Ñ+Ð+�Ñ8Ø—‘˜•ð 9r:   c                ó.   • U R                   R                  $ )zî
Number of times a query is executed before it is prepared.

- If it is set to 0, every query is prepared the first time it is
  executed.
- If it is set to `!None`, prepared statements are disabled on the
  connection.

Default value: 5
©rI   Úprepare_thresholdrq   s    r;   rõ   Ú BaseConnection.prepare_threshold‡  s   € ð �~‰~×/Ñ/Ð/r:   c                ó$   • XR                   l        g rz   rô   r|   s     r;   rõ   rö   •  s   € à+0�‰Õ(r:   c                ó^   • U R                   R                  nU[        R                  :w  a  U$ S$ )z‰
Maximum number of prepared statements on the connection.

`!None` means no max number of prepared statements. The default value
is 100.
N)rI   Úprepared_maxÚsysÚmaxsize)rU   Úrvs     r;   rù   ÚBaseConnection.prepared_max™  s)   € ð �^‰^×(Ñ(ˆØœ3Ÿ;™;Ó&ˆrÐ0¨DÐ0r:   c                óJ   • Uc  [         R                  nXR                  l        g rz   )rú   rû   rI   rù   r|   s     r;   rù   rý   ¤  s   € à‰=Ü—K‘KˆEØ&+�‰Õ#r:   g        rÇ   c             #  óZ   #   • [         R                  " XS9 Sh  v•N nU " U5      nU$  N7f)z?Generator to connect to the database and create a new instance.rÇ   N)r   Úconnect)rk   ÚconninforÈ   rB   Úconns        r;   Ú_connect_genÚBaseConnection._connect_gen´  s.   é € ô
 '×.Ò.¨xÑI×IˆÙ�6‹{ˆØˆñ Jùs   ‚+š)›+c              #  ó2  #   • U R                  5         [        U[        5      (       a&  UR                  U R                  R
                  5      nO&[        U[        5      (       a  UR                  U 5      nU R                  (       ak  [        U R                  R                  USUS9nU R                  R                  R                  U5        U R                  R                  R                  S5        gU[        :X  a  U R                  R                  U5        OU R                  R                  USUS9  [         R"                  " U R                  5       Sh  v•N S   nUR$                  [&        :w  a£  UR$                  [(        :w  a�  UR$                  [*        :X  a(  [,        R.                  " X@R                  R
                  S9e[,        R0                  " S[2        R4                  " UR$                  5      R6                   SUR9                  5       < 35      eU$  NÀ7f)zÑ
Generator to send a command and receive the result to the backend.

Only used to implement internal commands such as "commit", with eventual
arguments bound client-side. The cursor can do more complex stuff.
N)Úresult_formatéÿÿÿÿ©Úencodingúunexpected result z from command )Ú_check_connection_okÚ
isinstancer-   ÚencoderB   rÚ   r   Úas_bytesrP   r   Úsend_query_paramsÚcommand_queuerÎ   Úresult_queueÚTEXTÚ
send_queryr   Úexecutero   Ú
COMMAND_OKÚ	TUPLES_OKÚFATAL_ERRORr¬   Úerror_from_resultÚInterfaceErrorr   Ú
ExecStatusr¯   rë   )rU   Úcommandr  ÚcmdÚresults        r;   Ú_exec_commandÚBaseConnection._exec_command½  s�  é € ð 	×!Ñ!Ô#ä�gœs×#Ñ#Ø—n‘n T§[¡[×%:Ñ%:Ó;‰GÜ˜¤×,Ñ,Ø×&Ñ& tÓ,ˆGà�>�>ÜØ—‘×-Ñ-ØØØ+ñ	ˆCð �N‰N×(Ñ(×/Ñ/°Ô4Ø�N‰N×'Ñ'×.Ñ.¨tÔ4Øð
 œDÓ Ø�K‰K×"Ñ" 7Õ+à�K‰K×)Ñ)¨'°4À}Ð)ÑUä'1×'9Ò'9¸$¿+¹+Ó'F×FÈÑKˆØ�=‰=œJÓ&¨6¯=©=¼IÓ+EØ�}‰}¤Ó+Ü×)Ò)¨&¿;¹;×;PÑ;PÑQÐQä×&Ò&Ø(¬¯ª°v·}±}Ó)E×)JÑ)JÐ(KØ$ W§^¡^Ó%5Ñ$8ð:óð ð ˆñ Gùs   ‚EHÅHÅCHc              #  óB  #   • Ub  [         (       d$  Ub  SU-   OSnU R                  U5       Sh  v•N   gU R                  5         U R                  (       ak  [	        U R
                  R                  U5      nU R                  R                  R                  U5        U R                  R                  R                  S5        gU R
                  R                  U5        [        R                  " U R
                  5       Sh  v•N S   nUR                  [        :w  a~  UR                  [        :X  a(  [        R                   " X@R
                  R"                  S9e[        R$                  " S[&        R(                  " UR                  5      R*                   S35      eg GNk N�7f)a5  
Deallocate one, or all, prepared statement in the session.

``name == None`` stands for DEALLOCATE ALL.

If possible, use protocol-level commands; otherwise use SQL statements.

Note that PgBouncer doesn't support DEALLOCATE name, but it supports
protocol-level Close from 1.21 and DEALLOCATE ALL from 1.22.
Ns   DEALLOCATE s   DEALLOCATE ALLr  r  r
  z0 from sending closing prepared statement message)Ú_HAS_SEND_CLOSEr  r  rP   r   rB   Úsend_close_preparedr  rÎ   r  r   r  ro   r  r  r¬   r  rÚ   r  r   r  r¯   )rU   r¯   Ústmtr  r  s        r;   Ú_deallocateÚBaseConnection._deallocateë  s<  é € ð ‰<ŸšØ,0Ñ,<�> DÒ(ÐBSˆDØ×)Ñ)¨$Ó/×/Ð/Øà×!Ñ!Ô#à�>�>Ü˜$Ÿ+™+×9Ñ9¸4Ó@ˆCØ�N‰N×(Ñ(×/Ñ/°Ô4Ø�N‰N×'Ñ'×.Ñ.¨tÔ4Øà�‰×'Ñ'¨Ô-ä'×/Ò/°·±Ó<×<¸bÑAˆØ�=‰=œJÓ&Ø�}‰}¤Ó+Ü×)Ò)¨&¿;¹;×;PÑ;PÑQÐQä×&Ò&Ø(¬¯ª°v·}±}Ó)E×)JÑ)JÐ(KØFðGóð ð	 'ò 0ñ =ùs#   ‚-F¯F°CFÃ?FÄ BFÆFc                ó  • U R                   R                  [        :X  a  g U R                   R                  [        :X  a  [        R
                  " S5      e[        R                  " SU R                   R                   35      e)Nzthe connection is closedz7cannot execute operations: the connection is in status )rB   ro   ÚOKrp   r¬   ÚOperationalErrorr  rq   s    r;   r  Ú#BaseConnection._check_connection_ok  sh   € Ø�;‰;×Ñ¤Ó#Øà�;‰;×Ñ¤Ó$Ü×$Ò$Ð%?Ó@Ð@Ü×ÒðØŸ+™+×,Ñ,Ð-ð/ó
ð 	
r:   c              #  ó,  #   • U R                   (       a  gU R                  R                  [        :w  a  gU R	                  U R                  5       5       Sh  v•N   U R                  (       a#  U R                  R                  5        Sh  v•N   gg N9 N7f)z.Generator to start a transaction if necessary.N)rC   rB   r©   rª   r  Ú_get_tx_start_commandrP   r«   rq   s    r;   Ú_start_queryÚBaseConnection._start_query  sn   é € à××Øà�;‰;×)Ñ)¬TÓ1Øà×%Ñ% d×&@Ñ&@Ó&BÓC×CÐCØ�>�>Ø—~‘~×/Ñ/Ó1×1Ñ1ð ñ 	Dá1ùs$   ‚ABÁBÁ2BÂ	BÂ
BÂBc                ó"  • U R                   (       a  U R                   $ S/nU R                  b_  [        U R                  5      nUR                  S5        UR                  UR                  R                  SS5      R                  5       5        U R                  b$  UR                  U R                  (       a  SOS5        U R                  b$  UR                  U R                  (       a  SOS5        S	R                  U5      U l         U R                   $ )
Ns   BEGINs   ISOLATION LEVELÚ_rf   s	   READ ONLYs
   READ WRITEs
   DEFERRABLEs   NOT DEFERRABLEó    )
rT   rŠ   r   rÎ   r¯   Úreplacer  r•   rŸ   Újoin)rU   ÚpartsÚvals      r;   r+  Ú$BaseConnection._get_tx_start_command&  sÇ   € Ø× × Ø×(Ñ(Ð(à�
ˆà×ÑÑ+Ü  ×!5Ñ!5Ó6ˆCØ�L‰LÐ+Ô,Ø�L‰L˜Ÿ™×)Ñ)¨#¨sÓ3×:Ñ:Ó<Ô=à�>‰>Ñ%Ø�L‰L¨¯¯™¸]ÔKà�?‰?Ñ&Ø�L‰L¨$¯/¯/™Ð?PÔQà $§	¡	¨%Ó 0ˆÔØ×$Ñ$Ð$r:   c              #  óˆ  #   • U R                   (       a  [        R                  " S5      eU R                  (       a  [        R                  " S5      eU R                  R
                  [        :X  a  gU R                  S5       Sh  v•N   U R                  (       a#  U R                  R                  5        Sh  v•N   gg N9 N7f)z-Generator implementing `Connection.commit()`.zˆExplicit commit() forbidden within a Transaction context. (Transaction will be automatically committed on successful exit from context.)z6commit() cannot be used during a two-phase transactionNs   COMMIT)
rG   r¬   r­   rJ   rB   r©   rª   r  rP   r«   rq   s    r;   Ú_commit_genÚBaseConnection._commit_gen:  sœ   é € à×!×!Ü×$Ò$ð4óð ð
 �9�9Ü×$Ò$ØHóð ð �;‰;×)Ñ)¬TÓ1Øà×%Ñ% iÓ0×0Ð0à�>�>Ø—~‘~×/Ñ/Ó1×1Ñ1ð ñ 	1ñ 2ùs$   ‚BCÂB>Â2CÂ7C Â8CÃ Cc              #  óp  #   • U R                   (       a  [        R                  " S5      eU R                  (       a  [        R                  " S5      eU R                  (       a"  U R                  R                  5        Sh  v•N   U R                  R                  [        :X  a  gU R                  S5       Sh  v•N   U R                  R                  5         U R                  R                  U 5       Sh  v•N   U R                  (       a#  U R                  R                  5        Sh  v•N   gg N® Nx N= N7f)z/Generator implementing `Connection.rollback()`.zŒExplicit rollback() forbidden within a Transaction context. (Either raise Rollback() or allow an exception to propagate out of the context.)z8rollback() cannot be used during a two-phase transactionNs   ROLLBACK)rG   r¬   r­   rJ   rP   r«   rB   r©   rª   r  rI   ÚclearÚmaintain_genrq   s    r;   Ú_rollback_genÚBaseConnection._rollback_genN  sê   é € à×!×!Ü×$Ò$ðAóð ð
 �9�9Ü×$Ò$ØJóð ð
 �>�>Ø—~‘~×/Ñ/Ó1×1Ð1à�;‰;×)Ñ)¬TÓ1Øà×%Ñ% kÓ2×2Ð2Ø�‰×ÑÔØ—>‘>×.Ñ.¨tÓ4×4Ð4à�>�>Ø—~‘~×/Ñ/Ó1×1Ñ1ð ñ 2ñ
 	3á4ñ 2ùsH   ‚A=D6Á?D.Â 7D6Â7D0Â8<D6Ã4D2Ã52D6Ä'D4Ä(D6Ä0D6Ä2D6Ä4D6c                óP   • U R                  5         [        R                  " XU5      $ )a  
Returns a `Xid` to pass to the `!tpc_*()` methods of this connection.

The argument types and constraints are explained in
:ref:`two-phase-commit`.

The values passed to the method will be available on the returned
object as the members `~Xid.format_id`, `~Xid.gtrid`, `~Xid.bqual`.
)Ú
_check_tpcr   Ú
from_parts)rU   Ú	format_idÚgtridÚbquals       r;   ÚxidÚBaseConnection.xidi  s   € ð 	�‰ÔÜ�~Š~˜i°Ó6Ð6r:   c              #  ó  #   • U R                  5         [        U[        5      (       d  [        R                  " U5      nU R                  R
                  [        :w  aK  [        R                  " S[        R                  " U R                  R
                  5      R                   35      eU R                  (       a  [        R                  " S5      eUS4U l        U R                  U R                  5       5       S h  v•N   g  N7f)Nz8can't start two-phase transaction: connection in status z3can't use two-phase transactions in autocommit modeF)r?  r  r   Úfrom_stringrB   r©   rª   r¬   r­   r   r®   r¯   rC   rJ   r  r+  ©rU   rD  s     r;   Ú_tpc_begin_genÚBaseConnection._tpc_begin_genv  sÆ   é € Ø�‰Ôä˜#œs×#Ñ#Ü—/’/ #Ó&ˆCà�;‰;×)Ñ)¬TÓ1Ü×$Ò$ðÜ×(Ò(¨¯©×)GÑ)GÓH×MÑMÐNðPóð ð
 ××Ü×$Ò$ØEóð ð ˜%�LˆŒ	Ø×%Ñ% d×&@Ñ&@Ó&BÓC×CÓCùs   ‚C7DÃ9C?Ã:Dc              #  óÂ  #   • U R                   (       d  [        R                  " S5      eU R                   S   (       a  [        R                  " S5      eU R                   S   nUS4U l         U R                  [	        S5      R                  [        U5      5      5       S h  v•N   U R                  (       a#  U R                  R                  5        S h  v•N   g g  N9 N7f)Nz='tpc_prepare()' must be called inside a two-phase transactionr   zF'tpc_prepare()' cannot be used during a prepared two-phase transactionr   TzPREPARE TRANSACTION {})	rJ   r¬   r­   r  r   Úformatr-   rP   r«   rH  s     r;   Ú_tpc_prepare_genÚBaseConnection._tpc_prepare_genŠ  s³   é € Ø�y�yÜ×$Ò$ØOóð ð �9‰9�Q�<Ü×$Ò$ØXóð ð �i‰i˜‰lˆØ˜$�KˆŒ	Ø×%Ñ%¤cÐ*BÓ&C×&JÑ&JÌ3ÈsË8Ó&TÓU×UÐUØ�>�>Ø—~‘~×/Ñ/Ó1×1Ñ1ð ñ 	Vá1ùs$   ‚BCÂ!CÂ"2CÃCÃCÃCc              #  óª  #   • SUR                  5        S3nUc:  U R                  (       d  [        R                  " U S35      eU R                  S   nOUU R                  (       a  [        R                  " U S35      e[	        U[
        5      (       d  [
        R                  " U5      nU R                  (       aI  U R                  S   (       d5  [        U SUR                  5        S35      nS U l        U" 5        S h  v•N   g U R                  [        S	5      R                  [        U5      [        U5      5      5       S h  v•N   S U l        g  NQ N7f)
NÚtpc_z()z? without xid must must be called inside a two-phase transactionr   z= with xid must must be called outside a two-phase transactionr   r/  Ú_genz{} PREPARED {})ÚlowerrJ   r¬   r­   r  r   rG  Úgetattrr  r   rL  r-   )rU   ÚactionrD  ÚfnameÚmeths        r;   Ú_tpc_finish_genÚBaseConnection._tpc_finish_gen™  s'  é € ð �v—|‘|“~Ð& bÐ)ˆØ‰;Ø—9—9Ü×(Ò(Ø�gð =ð =óð ð —)‘)˜A‘,‰Cà�y�yÜ×(Ò(Ø�gð 7ð 7óð ô ˜c¤3×'Ñ'Ü—o’o cÓ*�à�9�9˜TŸY™Y qŸ\ä˜4 1 V§\¡\£^Ð$4°DÐ!9Ó:ˆDØˆDŒIÙ“v×Ñà×)Ñ)ÜÐ$Ó%×,Ñ,¬S°«[¼#¸c»(ÓCó÷ ð ð ˆD�Iñ ñùs%   ‚C;EÃ=EÃ>AEÅEÅEÅEc                ó   • g)z0Raise NotSupportedError if TPC is not supported.Nr2   rq   s    r;   r?  ÚBaseConnection._check_tpc¸  s   € ð 	r:   )rD   rC   rT   rH   rS   rQ   rE   rK   rF   rG   rP   rI   rR   rJ   rB   N)rB   r&   )r`   r   ÚreturnÚNone)r[  r-   )r[  r†   )r}   r†   r[  r\  )r}   r†   r[  úPQGen[None])r[  úIsolationLevel | None)r}   r^  r[  r\  )r}   r^  r[  r]  )r[  úbool | None)r}   r_  r[  r\  )r}   r_  r[  r]  )r°   r-   r[  r]  )r[  r$   )r[  r   )r[  zBaseConnection[Row])r[  r0   )r[  r\  )rÈ   Úfloatr[  zPQGenConn[None])rÐ   r<   r[  r\  )rV   ú"ReferenceType[BaseConnection[Row]]rÞ   r'   r[  r\  )rÐ   r=   r[  r\  )rV   ra  rî   zpq.PGnotifyr[  r\  )r[  ú
int | None)r}   rb  r[  r\  )Ú )r  r-   rÈ   r`  r[  zPQGenConn[Self])r  r   r  z	pq.Formatr[  zPQGen[PGresult | None])r¯   zbytes | Noner[  r]  )r[  r]  )r[  Úbytes)rA  r0   rB  r-   rC  r-   r[  r   )rD  z	Xid | strr[  r]  )rT  r   rD  zXid | str | Noner[  r]  )Er3   r4   r5   r6   r7   r¬   ÚWarningÚErrorr  ÚDatabaseErrorÚ	DataErrorr(  ÚIntegrityErrorÚInternalErrorr­   ÚNotSupportedErrorrW   r   ra   r^   Úpropertyr\   rt   rw   Úsetterr{   r‡   rŠ   r�   r‘   r•   r˜   rœ   rŸ   r¢   r¦   r…   rl   rµ   r¸   r¼   rÁ   r¿   rË   rÑ   rÖ   ÚstaticmethodrL   rä   rç   rN   rõ   rù   Úclassmethodr  r  r  r$  r  r,  r+  r7  r<  rD  rI  rM  rW  r?  r9   r2   r:   r;   r?   r?   O   s]  † ñð �i‰i€GØ�G‰G€EØ×%Ñ%€NØ—O‘O€MØ—‘€IØ×)Ñ)ÐØ×%Ñ%€NØ—O‘O€MØ×)Ñ)ÐØ×+Ñ+Ðô'$ðR %)ö 
ô&3ð
 ó)ó ð)ð ó>ó ð>ð ó ó ð ð ×Ñó$ó ð$ô"ô'ð ó%ó ð%ð ×Ñó)ó ð)ô"ô$ð
 óó ðð ×Ñó#ó ð#ô"ô$ð
 ó ó ð ð ×Ñó$ó ð$ô"ô$ô
ð$ ó+ó ð+ð óó ðð óó ðô"ôôôCô
/ô/ð ðVØ1ðVØ8@ðVà	óVó ðVô/ô/ð ðØ1ðØ8Cðà	óó ðð" ó0ó ð0ð ×Ñó1ó ð1ð ó1ó ð1ð ×Ñó,ó ð,ð àðØ58ñØðØ-2ðà	õó ðð DHð,Ø&ð,Ø7@ð,à	õ,ô\"ôH	
ô
2ô%ô(2ô(2ô67ôDô(2ðØ#ðØ*:ðà	ô÷>r:   r?   )Wr7   Ú
__future__r   rú   ÚloggingÚtypingr   r   r   r   r   Úweakrefr	   r
   Úwarningsr   Ú	functoolsr   Úcollectionsr   Úcollections.abcr   rc  r   r¬   r   r   r   Úabcr   r   r   Úsqlr   r   rJ   r   Úrowsr   Úadaptr   Ú_enumsr   Ú_compatr   r   r   Úpq.miscr    Ú
_preparingr!   Ú_capabilitiesr"   Ú_pipeline_baser#   Ú_connection_infor$   Úpsycopg_pool.baser%   Úpq.abcr&   r'   r(   ÚFormatr  ÚBINARYÚ
ConnStatusr'  rp   r  r  r  r  r®   rª   ÚINTRANSÚhas_send_close_preparedr!  Ú	getLoggerrÜ   r+   r4   rÙ   r<   r8   r=   r?   r2   r:   r;   Ú<module>r‹     sr  ðòõ #ã 
Û ß EÕ Eß &Ý Ý Ý Ý $å ß &Ñ &ß 2Ñ 2ß  Ý Ý Ý Ý "ß 1Ñ 1Ý 'Ý &Ý 'Ý (Ý ,æÝ*ç(ñ �KÓ €	à	‡y�y‡~�~€Ø	�‰×	Ñ	€à‡]�]×Ñ€Ø‡m�m×Ñ€à�]‰]×%Ñ%€
Ø�M‰M×#Ñ#€	Ø�m‰m×'Ñ'€à	×Ñ× Ñ €Ø
×
Ñ
×
&Ñ
&€à×6Ò6Ó8€à	×	Ò	˜9Ó	%€ô
FˆZô 
Fð €Ô à# Q§\¡\ N°DÐ$8Ñ9€ˆyÓ 9Ø# V H¨d NÑ3€ˆyÓ 3ôl	�W˜S‘\õ l	r:   