/var/opt/nydus/ops/mysql/connector/aio/__pycache__
NameSizeModeActions
abstracts.cpython-312.pyc1155400644editdlrm
authentication.cpython-312.pyc131520644editdlrm
charsets.cpython-312.pyc173430644editdlrm
connection.cpython-312.pyc708760644editdlrm
cursor.cpython-312.pyc601950644editdlrm
logger.cpython-312.pyc3510644editdlrm
network.cpython-312.pyc305960644editdlrm
pooling.cpython-312.pyc302760644editdlrm
protocol.cpython-312.pyc115140644editdlrm
utils.cpython-312.pyc59830644editdlrm
_decorating.cpython-312.pyc43120644editdlrm
__init__.cpython-312.pyc4930644editdlrm
Edit: /var/opt/nydus/ops/mysql/connector/aio/__pycache__/network.cpython-312.pyc (30596B)
N jodZddgZddlZddlZddlZ ddlZej ejejejdZ ddl m Z mZddlmZddlmZmZmZmZmZd d lmZmZmZmZmZmZd d lmZm Z m!Z!m"Z"d d l#m$Z$m%Z%de&de'fdZ(Gdde Z)Gdde)Z*Gdde*Z+Gdde Z,Gdde,Z-Gdde,Z.y#e $rdZYwxYw)zFModule implementing low-level socket communication with MySQL servers.MySQLTcpSocketMySQLUnixSocketN)TLSv1TLSv1.1TLSv1.2TLSv1.3)ABCabstractmethod)deque)AnyDequeListOptionalTuple)InterfaceErrorNotSupportedErrorOperationalErrorProgrammingErrorReadTimeoutErrorWriteTimeoutError)COMPRESSED_PACKET_HEADER_LENGTHMAX_PAYLOAD_LENGTHMIN_COMPRESS_LENGTHPACKET_HEADER_LENGTH) StreamWriteropen_connectionerrreturncf|js t|S|jd|jS)z`Reformat the IOError error message. This function reformats the IOError error message.  )errnostrstrerror)rs L/opt/nydus/tmp/pip-target-a90h98xg/lib/python/mysql/connector/aio/network.py _strioerrorr'Is, 993s8GSYYKq*GGceZdZdZe ddedededee dee dee d dfd Z e dd e jded ee d e fd Zy) NetworkBrokeraPBroker class interface. The network object is a broker used as a delegate by a socket object. Whenever the socket wants to deliver or get packets to or from the MySQL server it needs to rely on its network broker (netbroker). The netbroker sends `payloads` and receives `packets`. A packet is a bytes sequence, it has a header and body (referred to as payload). The first `PACKET_HEADER_LENGTH` or `COMPRESSED_PACKET_HEADER_LENGTH` (as appropriate) bytes correspond to the `header`, the remaining ones represent the `payload`. The maximum payload length allowed to be sent per packet to the server is `MAX_PAYLOAD_LENGTH`. When `send` is called with a payload whose length is greater than `MAX_PAYLOAD_LENGTH` the netbroker breaks it down into packets, so the caller of `send` can provide payloads of arbitrary length. Finally, data received by the netbroker comes directly from the server, expect to get a packet for each call to `recv`. The received packet contains a header and payload, the latter respecting `MAX_PAYLOAD_LENGTH`. Nwriteraddresspayload packet_numbercompressed_packet_number write_timeoutr c Kyw)aSend `payload` to the MySQL server. If provided a payload whose length is greater than `MAX_PAYLOAD_LENGTH`, it is broken down into packets. Args: sock: Object holding the socket connection. address: Socket's location. payload: Packet's body to send. packet_number: Sequence id (packet ID) to attach to the header when sending plain packets. compressed_packet_number: Same as `packet_number` but used when sending compressed packets. write_timeout: Timeout in seconds before which sending a packet to the server should finish else WriteTimeoutError is raised. Raises: :class:`OperationalError`: If something goes wrong while sending packets to the MySQL server. N)selfr+r,r-r.r/r0s r&writezNetworkBroker.writeireader read_timeoutc Kyw)aMGet the next available packet from the MySQL server. Args: sock: Object holding the socket connection. address: Socket's location. read_timeout: Timeout in seconds before which reading a packet from the server should finish. Returns: packet: A packet from the MySQL server. Raises: :class:`OperationalError`: If something goes wrong while receiving packets from the MySQL server. :class:`ReadTimeoutError`: If the time to receive a packet from the server takes longer than `read_timeout`. :class:`InterfaceError`: If something goes wrong while receiving packets from the MySQL server. Nr2)r3r7r,r8s r&readzNetworkBroker.readr5r6NNNN)__name__ __module__ __qualname____doc__r rr$bytesrintr4asyncio StreamReader bytearrayr:r2r(r&r*r*Qs. (,26'+      }  #+3-   }    > '+  $$  sm     r(r*ceZdZdZddZededeeeffdZ dde eddfdZ d e d e deddfd Z dd ej d ede edefdZ dd e d e dede ede ede eddfdZ dd ej d e de edefdZy)NetworkBrokerPlain,Broker class for MySQL socket communication.r Ncd|_yN_pktnrr3s r&__init__zNetworkBrokerPlain.__init__s  r(pktct|tkr tdtjd|dddzd|d}}||fS)-Recover the header information from a packet.3Can't recover header info from an incomplete packet  8".C 7 8s<A3$0.0A30 A0A A0 A++A00A3r7sizer8c|K td}t||kr[tj|j |t|z |d{}|s t d||z }t||kr[|S7(#tj $r}td|d}~wtj$r}|d}~wwxYww)z(Read `size` bytes from the comm channel.r(Nirh ) rErWrCwait_forr:r TimeoutErrorrCancelledError)r3r7rmr8rPchunkrs r& _read_chunkzNetworkBrokerPlain._read_chunks C.Cc(T/%..KKs3x0,(t44u  c(T/J ## 8".C 7%% I sMB<A A<A:%A<8A<9B<:A<<B9 BB92B44B99B<r-r.r/r0c K|j|d} tt|tzD]x}t j |j ||dtjd|jz|||tzz|d{|j|tz }zt j |j ||tjdt||z ddtjd|jz||dz|d{y77#tj$r} td| d} ~ wtj$r} | d} ~ wwxYww) zSend payload to the MySQL server. If provided a payload whose length is greater than `MAX_PAYLOAD_LENGTH`, it is broken down into packets. r&&OO# ++dDKK89!&64F+FGH"   $$&,,?""KKc'lV&; E  E(!E##E((E+cK |j|t|d{}|j|\}|_||j|||d{zS7;7#t$r}t d|t |f|d}~wwxYww)z+Receive `one` packet from the MySQL server.Nrerf)rtrr]rMrjrr')r3r7r,r8header payload_lenrs r&r:zNetworkBrokerPlain.reads ++F4H,WWF(,v'> $K$"2"26; "UUU U X V "G[-=#>  sJBAA4AAABAA B'BBBr Nr<)rNr;)r=r>r?r@rO staticmethodrArrBr]rrcrr$rlrCrDrErtr4r:r2r(r&rGrGsN6  %S/  x}888 8  8(&* $$sm   6(,26'+/// /  } / #+3- / }/ /j'+ $$sm   r(rGcXeZdZdZdfd ZedededeefdZ edede eeeffd Z dd e eddfd Z d ed ededdffd Z dd ed edede ede ede eddffd Z ddej&dede eddffd Z ddej&d ede edeffd ZxZS)NetworkBrokerCompressedrHr NcNt|d|_t|_yrJ)superrO_compressed_pktnrr _queue_read)r3 __class__s r&rOz NetworkBrokerCompressed.__init__1s  !#-2Wr(r-pktnrc|d}g}tt|tzD]H}|jdt j d|z|||tzz|dzdz}|tz }J|jt j dt||z ddt j d|z||dz|S) z2Prepare a payload for sending to the MySQL server.rrvrwrrarTrUN)rxrWrappendrYry)r-rrzpktsr{s r&_prepare_packetsz(NetworkBrokerCompressed._prepare_packets6s s7|'99:A KK++dE*+&6,>#>?@  QY#%E ( (F; KKc'lV3 4Qq 9kk$& 'fg   r(rPct|tkr tdtjd|dddzd|dtjd|dddzd}}}|||fS)rRrSrTrrUrV)rWrrXrYrZ)rPcompressed_pllr\uncompressed_plls r&r]z"NetworkBrokerCompressed.get_headerOs{ s85 5RS S MM$Aa7 2 3A 6 F MM$Aa7 2 3A 6 0 u&666r(r^cl||xjdz c_n||_|xjdzc_yr`)rrbs r&_set_next_compressed_pktnrz2NetworkBrokerCompressed._set_next_compressed_pktnr]s1 ?  " "a ' "%,D " #%r(r+r,c>Ktj|}tjdt |ddtjd|j ztjdt |ddz|z}t ||||d{S7w)z1Compress packet and write it to the comm channel.rTrrUrwN)zlibcompressrYryrWrrrl)r3r+r,rPcompressed_pktrs r&rlz"NetworkBrokerCompressed._write_pktess+ KKc.1 21Q 7kk$ 6 67 8kk$C)!A. /  W'====sBBBBr.r/r0c XK|j||j| tdj|j ||j }t |ttz k\rd}tt |tzD]T} tj|j|||||tz|d{|j|tz }Vtj|j||||d|d{yt |tkDr0tj|j||||d{ytjt |1||tj dt |ddtj d|j"ztj ddddz|z|d{y7!777 #tj$tj&f$r} t)d| d} ~ wwxYww) zSend `payload` as compressed packets to the MySQL server. If provided a payload whose length is greater than `MAX_PAYLOAD_LENGTH`, it is broken down into packets. r(rNrTrUrwrorh)rcrrEjoinrrMrWrrrxrCrprlrrrYryrrrrqr) r3r+r,r-r.r/r0 payload_preprzr{rrs r&r4zNetworkBrokerCompressed.writeus! ]+ ''(@A6 9$S>..%%gt{{;L7|14HHHs<04FFGA!**"#(&;M2MN & 33500FH&&OOFG\&'5JK!w<"55!**F  "***"#"KKc,.?@1E$kk$0F0FGH$kk$21Q78++&   5 &&(<(<= 9#$/S 8 9s#H*B!G2G) A G2G,G2H* A5E"E#2EEA%E<EEEcK|js t | |t|d{}|j |\}|_}|dk(r3|jj t | |||d{n|j|||d{|jsy|jj}|d|_ |S77Y7;#t$r}td|t|f|d}~wwxYww)z{Receive `one` or `several` packets from the MySQL server, enqueue them, and return the packet at the head. NrrerfrU) rrrtrr]rrrrjrr'popleftrM) r3r7r,r8r}rrrrPrs r&r:zNetworkBrokerCompressed.reads $w2;\ OOF+ "*$$q($$++#g1&.,WW 33 &&(!f  AX &S1A'B s] C>CCA C6C7CCC3C>CCC C;C66C;;C>rr<r;)r=r>r?r@rOrrArBrrrr]rrrr$rlr4rCrDrrEr: __classcell__rs@r&rr.s65 %U 0 7 7%S# "6 7 7&(3-&4&>>> >  >*(,26'+G9G9G9 G9  } G9 #+3- G9 }G9 G9Z'+ -1$$-1-1sm -1  -1f'+ -$$--sm -  --r(rcheZdZdZddZedefdZede ddfdZ ddZ de fd Z d eddfd Zdd Zd ej$ddfdZ d dedeedeedeeddf dZd!deedefdZdddddggfdeedeedeedee dee deeedeeedej$fdZy)" MySQLSocketzMySQL socket communication interface. Examples: Subclasses: network.MySQLTCPSocket and network.MySQLUnixSocket. r Nchd|_d|_d|_d|_t |_d|_y)zsNetwork layer where transactions are made with plain (uncompressed) packets is enabled by default. NF)_reader_writer_connection_timeout_addressrG _netbroker _is_connectedrNs r&rOzMySQLSocket.__init__$s38< /3 26 '+ );)=#(r(c|jS)zSocket location.)rrNs r&r,zMySQLSocket.address/s}}r(kwargsc Kyw)zOpen the socket.Nr2r3rs r&rzMySQLSocket.open_connection4r5r6cnK|jr |jj|jj$|jjj|jj d{d|_yd|_y7#t $r}Yd}~d|_yd}~wwxYww)zClose the connection.NF)rclose transportabort wait_closed Exceptionr)r3r{s r&close_connectionzMySQLSocket.close_connection8s <<  ""$<<))5LL**002ll..000 #U 1 "  s; B5A1BBBB5B B2! B5-B22B5c|jS)zCheck if the socket is connected. Return: bool: Returns `True` if the socket is connected to MySQL server. )rrNs r& is_connectedzMySQLSocket.is_connectedGs !!!r(timeoutc||_y)zSet the connection timeout.N)r)r3rs r&set_connection_timeoutz"MySQLSocket.set_connection_timeoutOs #* r(c"t|_y)zIEnable network layer where transactions are made with compressed packets.N)rrrNs r&switch_to_compressed_modez%MySQLSocket.switch_to_compressed_modeSs 13r( ssl_contextcK|jJ|jjjd}|jdk(r t d|jj |d{y7w)a?Upgrade an existing stream-based connection to TLS. The `start_tls()` method from `asyncio.streams.StreamWriter` is only available in Python 3.11. This method is used as a workaround. The MySQL TLS negotiation happens in the middle of the TCP connection. Therefore, passing a socket to open connection will cause it to negotiate TLS on an existing connection. Args: ssl_context: The SSL Context to be used. Raises: RuntimeError: If the transport does not expose the socket instance. Nsocketrz,SSL is not supported when using Unix sockets)rrget_extra_infofamilyr start_tls)r3rrs r& switch_to_sslzMySQLSocket.switch_to_sslWsb"||'''''66x@ ==A "#QR Rll$$[111sA,A6.A4/A6r-r.r/r0cK|jj|j|j||||d{y7w)z!Send packets to the MySQL server.)r.r/r0N)rr4rr,)r3r-r.r/r0s r&r4zMySQLSocket.writepsCoo## LL LL '%=' $   s9AAAr8cK|jj|j|j|d{S7w)z#Read packets from the MySQL server.N)rr:rr,)r3r8s r&r:zMySQLSocket.reads-__))$,, lSSSSs 5><>Fssl_cassl_certssl_keyssl_verify_certssl_verify_identity tls_versionstls_cipher_suitescd}|js tdt td |r|j d|d}t |} tj | } |dk(rd |vr#| xjtjzc_d |vr#| xjtjzc_d |vr8| xjtjzc_ntj} || _ |rtj| _n-|rtj| _ntj | _| j#|r | j%||r | j+|||r%|d k(r | j-dj/|| S#t&tj(f$r} td | | d} ~ wwxYw#t&tj(f$r} td | | d} ~ wwxYw#t0$r} t3d| d} ~ wt&t4tj6tj(f$r} tt9| | d} ~ wwxYw)zBuild a SSLContext.Nirhz&Python installation has no SSL supportT)reverserrrrrzInvalid CA Certificate: zInvalid Certificate/Key: :)rrssl RuntimeErrorsort TLS_VERSIONS SSLContextoptions OP_NO_TLSv1_2 OP_NO_TLSv1_1 OP_NO_TLSv1create_default_contextcheck_hostname CERT_REQUIRED verify_mode CERT_OPTIONAL CERT_NONEload_default_certsload_verify_locationsrjSSLErrorload_cert_chain set_ciphersr NameErrorrNotImplementedErrorCertificateErrorr$) r3rrrrrrr tls_version ssl_protocolcontextrs r&build_ssl_contextzMySQLSocket.build_ssl_contexts%&* || t, , ;GH H5 4!!$!/*1o +K8 ..6)+ 43+<+<< 43+<+<<l23??:446%8G "&)&7&7#$&)&7&7#&)mm#  & & (T11&9U++Hg> ![I%=##CHH->$?@N .T(+CC5)IJPSST  .U(+DSE)JKQTTU W#$LMSV V    LL   4 !S* 3  4slD$HF!#H&G8(H!G:G  GHG>*G99G>>H I  H0I II rr;r<)r=r>r?r@rOpropertyr$r,r r rrboolrrBrrrrrrArr4rEr:rrr2r(r&rrs )cd #"d"+c+d+42s~~2$28(,26'+    } #+3-   }    "Tx}T T !%"&!%*/.3,.13H4 H43-H4# H4 "$ H4 &d^ H4tCy)H4$DI.H4 H4r(rcDeZdZdZ d dededeffd Zdeddfd Z xZ S) rzMySQL socket class using TCP/IP. Args: host: MySQL host name. port: MySQL port. force_ipv6: Force IPv6 usage. hostport force_ipv6cdt|||_||_||_|d||_y)Nr)rrO_host_port _force_ipv6r)r3rrrrs r&rOzMySQLTcpSocket.__init__s8   !+ $vQtf- r(rr NcKtd|j|jd|d{\|_|_d|_y7w)zOpen TCP/IP connection.)rrNTr2)rrrrrrrs r&rzMySQLTcpSocket.open_connectionsG+:, $**, 06, & " dl"& s&AAA)z 127.0.0.1i F) r=r>r?r@r$rBrrOr rrrs@r&rrs?MR..-0.EI."c"d"r(c:eZdZdZddeffd ZdeddfdZxZS) rzbMySQL socket class using UNIX sockets. Args: unix_socket: UNIX socket file path. unix_socketc0t|||_yr<)rrOr)r3rrs r&rOzMySQLUnixSocket.__init__s ( r(rr NcKtjdd|ji|d{\|_|_d|_y7w)zOpen UNIX socket connection.pathNTr2)rCopen_unix_connectionrrrrrs r&rzMySQLUnixSocket.open_connectionsM ..  "(   L L" s%AAA)z/tmp/mysql.sock) r=r>r?r@r$rOr rrrs@r&rrs' )C)"c"d"r()/r@__all__rCrYrrPROTOCOL_TLSv1PROTOCOL_TLSv1_1PROTOCOL_TLSv1_2 PROTOCOL_TLSr ImportErrorabcr r collectionsr typingr r rrrerrorsrrrrrrnetworkrrrrutilsrrrjr$r'r*rGrrrrr2r(r&rs>M . /  ##''''## L$44 1HWHHQ CQ hFFRl0l^p4#p4f"["4"k"s Cs3CCC