ó
    ßÅŸgñ  ã                   óº  • S r SS/rSSKrSSKrSSKrSSKrSSKJrJr   SSK	r	SSKJrJrJrJr  \(       a  SSKJr  \R%                  S5         " S	 S
\R&                  5      r " S S\R(                  R*                  5      r SSS.S\S\S\S\S\\R0                  \4   4
S jjjrS\S\S\S\R4                  4S jrS\S\4S jrS\4S jrg! \
 a    Sr	 Nµf = f)z
Utilities.Ú	to_threadÚopen_connectioné    N)ÚReadTimeoutErrorÚWriteTimeoutError)ÚTYPE_CHECKINGÚAnyÚCallableÚTuple)ÚMySQLConnectionAbstractÚStreamWriterc                   ó>   • \ rS rSrSrS\R                  SS4S jrSrg)ÚStreamReaderProtocolé8   zàExtends asyncio.streams.StreamReaderProtocol for adding start_tls().

The ``start_tls()`` is based on ``asyncio.streams.StreamWriter`` introduced
in Python 3.11. It provides the same functionality for older Python versions.
ÚwriterÚreturnNc                 ód   • UR                   nXl        X l        UR                  S5      SLU l        g)z9Replace stream writer.

Args:
    writer: Stream Writer.
Ú
sslcontextN)Ú	transportÚ_stream_writerÚ
_transportÚget_extra_infoÚ	_over_ssl)Úselfr   r   s      ÚZ/var/www/blue/EV-Temp_rev04/venv/lib/python3.13/site-packages/mysql/connector/aio/utils.pyÚ_replace_writerÚ$StreamReaderProtocol._replace_writer?   s1   € ð ×$Ñ$ˆ	Ø$ÔØ#ŒØ"×1Ñ1°,Ó?ÀtÐKˆ�ó    )r   r   r   )	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úasyncior   r   Ú__static_attributes__© r   r   r   r   8   s#   † ñð	L g×&:Ñ&:ð 	L¸t÷ 	Lr   r   c            	       óP   • \ rS rSrSrSSS.S\R                  S\S\SS4S	 jjr	S
r
g)r   éK   zØExtends asyncio.streams.StreamWriter for adding start_tls().

The ``start_tls()`` is based on ``asyncio.streams.StreamWriter`` introduced
in Python 3.11. It provides the same functionality for older Python versions.
N)Úserver_hostnameÚssl_handshake_timeoutÚssl_contextr(   r)   r   c          	   ƒ   ó  #   • U R                   R                  SLnU R                   nU R                  5       I Sh  v•N   U R                  R	                  U R
                  UUUUUS9I Sh  v•N nUU l        UR                  U 5        g NM N7f)z½Upgrade an existing stream-based connection to TLS.

Args:
    ssl_context: Configured SSL context.
    server_hostname: Server host name.
    ssl_handshake_timeout: SSL handshake timeout.
N)Úserver_sider(   r)   )Ú	_protocolÚ_client_connected_cbÚdrainÚ_loopÚ	start_tlsr   r   )r   r*   r(   r)   r,   ÚprotocolÚnew_transports          r   r1   ÚStreamWriter.start_tlsR   s�   é € ð —n‘n×9Ñ9ÀÐEˆØ—>‘>ˆØ�j‰j‹l×ÐØ"Ÿj™j×2Ñ2à�O‰OØØØ#Ø+Ø"7ð 3ð 
÷ 
ˆð ð 	Œð 	× Ñ  Õ&ñ 	ñ
ùs!   ‚8BºB»/BÁ*B
Á+BÂ
B)r   )r   r   r    r!   r"   ÚsslÚ
SSLContextÚstrÚintr1   r$   r%   r   r   r   r   K   sC   † ñð  $Ø%)ò'à—^‘^ð'ð ð	'ð
  #ð'ð 
÷'ð 'r   i   )ÚlimitÚhostÚportr9   Úkwdsr   c             ‹   óê   ^	#   • [         R                  " 5       n[         R                  R                  X$S9n[	        XTS9m	UR
                  " U	4S jX40 UD6I Sh  v•N u  pg[        UT	XT5      nXX4$  N7f)aÙ  A wrapper for create_connection() returning a (reader, writer) pair.

This function is based on ``asyncio.streams.open_connection`` and adds a custom
stream reader.

MySQL expects TLS negotiation to happen in the middle of a TCP connection, not at
the start.
This function in conjunction with ``_StreamReaderProtocol`` and ``_StreamWriter``
allows the TLS negotiation on an existing connection.

Args:
    host: Server host name.
    port: Server port.
    limit: The buffer size limit used by the returned ``StreamReader`` instance.
           By default the limit is set to 64 KiB.

Returns:
    tuple: Returns a pair of reader and writer objects that are instances of
           ``StreamReader`` and ``StreamWriter`` classes.
)r9   Úloop)r>   c                  ó   >• T $ ©Nr%   )r2   s   €r   Ú<lambda>Ú!open_connection.<locals>.<lambda>Œ   s   ø€ ¹r   N)r#   Úget_running_loopÚstreamsÚStreamReaderr   Úcreate_connectionr   )
r:   r;   r9   r<   r>   Úreaderr   Ú_r   r2   s
            @r   r   r   r   sq   øé € ô. ×#Ò#Ó%€DÜ�_‰_×)Ñ)°Ð)ÐA€FÜ# FÑ6€HØ×/Ò/Ô0@À$ÑUÐPTÑU×U�L€IÜ˜) X¨vÓ<€FØˆ>Ðñ Vùs   ƒAA3ÁA1ÁA3ÚfuncÚargsÚkwargsc              �   óà   #   • [         R                  " 5       n[        R                  " 5       n[        R
                  " UR                  U /UQ70 UD6nUR                  SU5      I Sh  v•N $  N7f)a9  Asynchronously run function ``func`` in a separate thread.

This function is based on ``asyncio.to_thread()`` introduced in Python 3.9, which
provides the same functionality for older Python versions.

Returns:
    coroutine: A coroutine that can be awaited to get the eventual result of
               ``func``.
N)r#   rC   ÚcontextvarsÚcopy_contextÚ	functoolsÚpartialÚrunÚrun_in_executor)rI   rJ   rK   r>   ÚctxÚ	func_calls         r   r   r   ‘   s\   é € ô ×#Ò#Ó%€DÜ
×
"Ò
"Ó
$€CÜ×!Ò! #§'¡'¨4ÐA°$ÒA¸&ÑA€IØ×%Ñ% d¨IÓ6×6Ð6Ñ6ùs   ‚A%A.Á'A,Á(A.Úreasonc                 ó0   ^ • S[         S[         4U 4S jjnU$ )z&Use it to decorate deprecated methods.rI   r   c                 ór   >^ • [         R                  " T 5      S[        S[        S[        4U U4S jj5       nU$ )NrJ   rK   r   c               Ÿ   ó„   >#   • [         R                  " STR                   ST 3[        SS9  T" U 0 UD6I S h  v•N $  N7f)NzCall to deprecated function z
. Reason: é   )ÚcategoryÚ
stacklevel)ÚwarningsÚwarnr   ÚDeprecationWarning)rJ   rK   rI   rU   s     €€r   ÚwrapperÚ.deprecated.<locals>.decorator.<locals>.wrapper¥   sD   øé € ä�MŠMØ.¨t¯}©}¨o¸ZÈÀxÐPÜ+Øòñ
 ˜tÐ. vÑ.×.Ð.Ñ.ùs   ƒ6A ¹>ºA )rO   Úwrapsr   r	   )rI   r_   rU   s   ` €r   Ú	decoratorÚdeprecated.<locals>.decorator¤   s:   ù€ Ü	�Š˜Ó	ð	/¤ð 	/´ð 	/¼÷ 	/ó 
ð	/ð ˆr   ©r	   )rU   rb   s   ` r   Ú
deprecatedre   ¡   s   ø€ ð
œð 
¤X÷ 
ð Ðr   c                  ó(   • S[         S[         4S jn U $ )z
Decorator to close the current connection if a read or a write timeout
is raised by the method passed via the func parameter.
Ú
cnx_methodr   c           	      ór   ^ • [         R                  " T 5      SSS[        S[        S[        4U 4S jj5       nU$ )NÚcnxr   rJ   rK   r   c              Ÿ   óÊ   >#   •  T" U /UQ70 UD6I S h  v•N $  N! [          a;  n[        U[        [        45      (       a  U R	                  5       I S h  v•N    UeS nAff = f7fr@   )Ú	ExceptionÚ
isinstancer   r   Úclose)ri   rJ   rK   Úerrrg   s       €r   Úhandle_cnx_methodÚGhandle_read_write_timeout.<locals>.decorator.<locals>.handle_cnx_methodº   s]   øé € ðÙ'¨Ð=¨dÒ=°fÑ=×=Ð=Ñ=øÜó Ü˜cÔ$4Ô6GÐ#H×IÑIØŸ)™)›+×%Ñ%Ø�	ûðüs<   ƒA#… ”• ˜A#™ ›
A ¥.AÁAÁAÁA Á A#)rO   ra   r   )rg   ro   s   ` r   rb   Ú,handle_read_write_timeout.<locals>.decorator¹   sF   ø€ Ü	�Š˜Ó	$ð	Ø*ð	Ü36ð	ÜBEð	äö	ó 
%ð	ð !Ð r   rd   )rb   s    r   Úhandle_read_write_timeoutrr   ³   s   € ð!œhð !¬8ô !ð Ðr   )NN)r"   Ú__all__r#   rM   rO   r\   Úmysql.connector.errorsr   r   r5   ÚImportErrorÚtypingr   r   r	   r
   Úmysql.connector.aio.abstractsr   Úappendr   rD   r   r7   r8   rE   r   ÚFuturer   re   rr   r%   r   r   Ú<module>rz      s  ðñ@ àÐ)Ð
*€ã Û Û Û ç FðÛ÷ 7Ó 6æÝEà‡N�N�>Ô"ôL˜7×7Ñ7ô Lô&$'�7—?‘?×/Ñ/ô $'ðP #'ðØ8=òØ
ðØðØ25ðØGJðà
ˆ7×Ñ Ð-Ñ.öð>7˜(ð 7¨3ð 7¸#ð 7À'Ç.Á.ô 7ð �sð ˜xô ð$ 8õ øðM ó Ø
‚Cðús    C ÃCÃC