/var/opt/nydus/ops/mysql/connector/__pycache__
NameSizeModeActions
abstracts.cpython-312.pyc1263050644editdlrm
authentication.cpython-312.pyc148150644editdlrm
charsets.cpython-312.pyc102270644editdlrm
connection.cpython-312.pyc705380644editdlrm
connection_cext.cpython-312.pyc485700644editdlrm
constants.cpython-312.pyc482270644editdlrm
conversion.cpython-312.pyc315540644editdlrm
cursor.cpython-312.pyc587990644editdlrm
cursor_cext.cpython-312.pyc497900644editdlrm
custom_types.cpython-312.pyc13400644editdlrm
dbapi.cpython-312.pyc30230644editdlrm
errorcode.cpython-312.pyc907520644editdlrm
errors.cpython-312.pyc133090644editdlrm
logger.cpython-312.pyc3390644editdlrm
network.cpython-312.pyc319440644editdlrm
optionfiles.cpython-312.pyc145250644editdlrm
pooling.cpython-312.pyc273930644editdlrm
protocol.cpython-312.pyc471850644editdlrm
tls_ciphers.cpython-312.pyc78190644editdlrm
types.cpython-312.pyc25860644editdlrm
utils.cpython-312.pyc281810644editdlrm
version.cpython-312.pyc6900644editdlrm
_decorating.cpython-312.pyc39980644editdlrm
_scripting.cpython-312.pyc157000644editdlrm
__init__.cpython-312.pyc17090644editdlrm
Edit: /var/opt/nydus/ops/mysql/connector/__pycache__/network.cpython-312.pyc (31944B)
N judZddlZddlZddlZddlZddlmZmZddlm Z ddl m Z m Z m Z mZmZmZ ddlZej$ej&ej(ej*dZeedxr ej0Zd d lmZmZmZmZm Z m!Z!m"Z"d Z#d Z$d Z%dZ&de'de(fdZ)GddeZ*Gdde*Z+Gdde+Z,GddeZ-Gdde-Z.Gdde-Z/y#e$rdZdZYpwxYw)zFModule implementing low-level socket communication with MySQL servers.N)ABCabstractmethod)deque)AnyDequeListOptionalTupleUnion)TLSv1TLSv1.1TLSv1.2TLSv1.3 HAS_TLSv1_3F)ConnectionTimeoutErrorInterfaceErrorNotSupportedErrorOperationalErrorProgrammingErrorReadTimeoutErrorWriteTimeoutError2ierrreturnch|js t|Sd|jd|jS)z`Reformat the IOError error message. This function reformats the IOError error message. zErrno z: )errnostrstrerror)rs H/opt/nydus/tmp/pip-target-a90h98xg/lib/python/mysql/connector/network.py _strioerrorr#Is. 993s8NF399+R ~*NNceZdZdZe d dej dededee dee ddf d Z edej dede fd Z y) 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`. Nsockaddresspayload packet_numbercompressed_packet_numberrcy)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. Raises: :class:`OperationalError`: If something goes wrong while sending packets to the MySQL server. N)selfr'r(r)r*r+s r"sendzNetworkBroker.sendir$cy)a)Get the next available packet from the MySQL server. Args: sock: Object holding the socket connection. address: Socket's location. Returns: packet: A packet from the MySQL server. Raises: :class:`OperationalError`: If something goes wrong while receiving packets from the MySQL server. :class:`InterfaceError`: If something goes wrong while receiving packets from the MySQL server. Nr-)r.r'r(s r"recvzNetworkBroker.recvr0r$NN) __name__ __module__ __qualname____doc__rsocketr bytesr intr/ bytearrayr2r-r$r"r&r&Qs. (,26  mm     }  #+3-     6     r$r&c eZdZdZddZddZdej dededdfd Z ddej d e de fd Z ddej ded ed e e de e ddf dZdej dede fdZy)NetworkBrokerPlain,Broker class for MySQL socket communication.rNcd|_yN_pktnrr.s r"__init__zNetworkBrokerPlain.__init__s  r$c2|jdzdz|_yzIncrement packet id.rNrBrDs r"_set_next_pktnrz"NetworkBrokerPlain._set_next_pktnrs{{Q#- r$r'r(pktc |j|y#tjtf$r}t d|d}~wt $r}t d|t|f|d}~wt$r}t d|d}~wwxYw)z!Write packet to the comm channel. rNrvaluesi) sendallr8timeout TimeoutErrorrIOErrorrr#AttributeError)r.r'r(rJrs r" _send_pktzNetworkBrokerPlain._send_pktsy 8 LL  - 9#$/S 8 "G[-=#>  8".C 7 8s*A= : A=A A=+ A88A=sizect|}t|}|r5|j||}|dk(r|dkDr td||d}||z}|r5|S)z(Read `size` bytes from the comm channel.rirMN)r; memoryview recv_intor)r.r'rWrJpkt_viewreads r" _recv_chunkzNetworkBrokerPlain._recv_chunks_oc?>>(D1DqyTAX$400H DLD   r$r)r*r+c  ||jn||_t|tk\rd}t t|tzD]\}|j ||dt jd|jz|||tzz|j|tz }^||d}|j ||t jdt|ddt jd|jz|zy)zSend payload to the MySQL server. If provided a payload whose length is greater than `MAX_PAYLOAD_LENGTH`, it is broken down into packets. Nr#kk$ 45fv0B'BCD$$&,,?fg&G    KKc'l +Aa 0kk$ , -  r$cn |j|t}tjd|dddzd|dc}|_||j||zS#t j tf$r}td|j|d}~wt$r}td |t|f |d}~wwxYw) z+Receive `one` packet from the MySQL server.rWrarrbrL)rmsgNrNrO) r]PACKET_HEADER_LENGTHrfunpackrCr8rRrSrr!rTrr#)r.r'r(header payload_lenrs r"r2zNetworkBrokerPlain.recvs %%d1E%FF dF1QK'$9:1=q  %K D,,T ,DD D - J"3<<@c I "G[-=#>  s$AAB42B  B4B//B4rN)rr3)r4r5r6r7rErIr8r r9rVr:r;r]r r/r2r-r$r"r=r=s6. 8fmm 8c 8 8$ 8  S  "(,26 * mm* *  *  } * #+3- *  * Xr$r=c &eZdZdZdfd ZedededeefdZ ddZ d e jd e d eddffd Z dd e jd e ded eedeeddf fd Zd e jdededdffd Zd e jd e deffd ZxZS)NetworkBrokerCompressedr>rNcNt|d|_t|_yr@)superrE_compressed_pktnrr _queue_read)r. __class__s r"rEz NetworkBrokerCompressed.__init__s  !#-2Wr$r)pktnrcg}t|tk\rmd}tt|tzD]H}|jdt j d|z|||tzz|dzdz}|tz }J||d}|jt j dt|ddt j d|z|z|S) z2Prepare a payload for sending to the MySQL server.rr_r`rrHNrarb)rcrdreappendrfrg)r)rzpktsrhris r"_prepare_packetsz(NetworkBrokerCompressed._prepare_packetss w<- -F3w<+==> #kk$./fv0B'BCD c),,?fg&G KKc'l +Aa 06;;tU3K Kg U  r$c2|jdzdz|_yrG)rwrDs r"_set_next_compressed_pktnrz2NetworkBrokerCompressed._set_next_compressed_pktnrs"&"8"81"<!Cr$r'r(rJc"tj|}tjdt |ddtjd|j ztjdt |ddz|z}t ||||S)z1Compress packet and write it to the comm channel.rarrbr`)zlibcompressrfrgrcrwrvrV)r.r'r(rJcompressed_pktrys r"rVz!NetworkBrokerCompressed._send_pkt#ss+ KKc.1 21Q 7kk$ 6 67 8kk$C)!A. /  w w44r$r*r+c ||jn||_||jn||_t dj |j ||j}t|ttz k\rod}tt|tzD]8}|j|||||tz|j|tz }:|j||||dyt|tkDr|j|||yt |-||tjdt|ddtjd|jztjddddz|zy)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. Nr$rrarbr`)rIrCrrwr;joinr~rcrdrnrerVMIN_COMPRESS_LENGTHrvrfrg) r.r'r(r)r*r+ payload_preprhrirys r"r/zNetworkBrokerCompressed.send.sr   "'DK # +  + + -%=D " ~**4+@+@$+++VW w<-0DD DF3|,0BBC'<BT9T#U//1,, D NN4,vw*? @ 7|11tWl;!KKc,&781=kk$(>(>?@kk$*1Q/0##r$compressed_plluncompressed_pllct |||}|dk(r|nttj|}d}|t |krt jd|||tzdz dzd}t|zt ||z kDrt ||t}t jd|dddzd|dt jd|dddzd c}|_ }t |||}||dk(r|ntj|z }|jj|||tz|z|t|zz }|t |kry y ) z&Handle reading of a compressed packet.rkrrarrlrbrrN) rvr]r;r decompressrcrfrornCOMPRESSED_PACKET_HEADER_LENGTHrwrxr|) r.r'rrrrJrhpllrprys r"_recv_compressed_pktz,NetworkBrokerCompressed._recv_compressed_pktks,T,G 1$ 4??>:; s3x--c&6,@#@1#DEOC$c)CHv,==,T8W,XMM$q g(=>qA1IMM$q g(=>qA "*$ "'!4T!4!O'1,#8    # #C:N1NQT1T$U V *S0 0F?s3xr$c|jss t| |t}t j d|dddzd|dt j d|dddzd c}|_}|j||||jsy |jj}|d|_|S#tjtf$r}td |d }~wt$r}td |t|f |d }~wwxYw) z{Receive `one` or `several` packets from the MySQL server, enqueue them, and return the packet at the head. rkrarrbrlrrrLrMNrNrO)rxrvr]rrfrorwrr8rRrSrrTrr#popleftrC) r.r'r(rprrrrJrys r"r2zNetworkBrokerCompressed.recvs ,T8W,XMM$q g(=>qA1IMM$q g(=>qA "*$ ))$@PQ&&(!f  NNL1 <&T2; &S1A'B s$A2B44D C D&C??Drrr3)r4r5r6r7rE staticmethodr9r:rr~rr8r rVr r/rr;r2 __classcell__rys@r"rtrts65 %U 2D 5fmm 5c 5 5$ 5 (,26 ;mm;; ;  } ; #+3- ; ;z.1MM.136.1JM.1 .1`!!!!!r$rtcPeZdZdZddZddZddZddZddZd e e ddfd Z d e d e ddfd Z d de e de e de e de ede ede ee de ee de fdZ d!dede e de e de e ddf dZd"de e defdZeddZeede fdZy)# MySQLSocketzMySQL socket communication interface. Examples: Subclasses: network.MySQLTCPSocket and network.MySQLUnixSocket. rNcLd|_d|_d|_t|_y)zsNetwork layer where transactions are made with plain (uncompressed) packets is enabled by default. N)r'_connection_timeout server_hostr= _netbrokerrDs r"rEzMySQLSocket.__init__s% .2 26 *.);)=r$c"t|_y)zIEnable network layer where transactions are made with compressed packets.N)rtrrDs r"switch_to_compressed_modez%MySQLSocket.switch_to_compressed_modes 13r$c |jjtj|jj y#t t f$rYywxYw)z'Shut down the socket before closing it.N)r'shutdownr8 SHUT_RDWRcloserUOSErrorrDs r"rzMySQLSocket.shutdownsD  II  v// 0 IIOO (   sAAAAcd |jjy#ttf$rYywxYw)zClose the socket.N)r'rrUrrDs r"close_connectionzMySQLSocket.close_connections,  IIOO (   s //c$|jyN)rrDs r"__del__zMySQLSocket.__del__s  r$rRcb||_|jr|jj|yy)zSet the connection timeout.N)rr' settimeout)r.rRs r"set_connection_timeoutz"MySQLSocket.set_connection_timeouts(#* 99 II  ) r$ ssl_contexthostc |jJ|jjdk(r tdt t d |j |j||_y#t $r}t d|d}~wtjtf$r(}td|jt|f|d}~wtj$r}tt||d}~wt$r}tt||d}~wwxYw)aUpgrade an existing connection to TLS. Args: ssl_context (ssl.SSLContext): The SSL Context to be used. host (str): Server host name. Returns: None. Raises: ProgrammingError: If the transport does not expose the socket instance. NotSupportedError: If Python installation has no SSL support. Nrz,SSL is not supported when using Unix sockets&Python installation has no SSL support)server_hostnamerNrO)r'familyrsslr wrap_socket NameErrorSSLErrorrTrr(r#CertificateErrorr NotImplementedError)r.rrrs r" switch_to_sslzMySQLSocket.switch_to_sslsyy$$$ 99  q "#QR R ;#$LM M 4#// 4/PDI W#$LMSV V g&  DLL+c2B#C ## 4 S* 3" 4 S* 3 4s<"A(( D 1 A==D #B<<D C'' D 3DD ssl_cassl_certssl_keyssl_verify_certssl_verify_identity tls_versionstls_cipher_suitescd}|js tdt td|g}|g} |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} td| d} ~ wt&t2tj4tj(f$r} tt7| | d} ~ wwxYw)aBuild a SSLContext. Args: ssl_ca: Certificate authority, opptional. ssl_cert: SSL certificate, optional. ssl_key: Private key, optional. ssl_verify_cert: Verify the SSL certificate if `True`. ssl_verify_identity: Verify host identity if `True`. tls_versions: TLS protocol versions, optional. tls_cipher_suites: Set of steps that helps to establish a secure connection. Returns: ssl_context (ssl.SSLContext): An SSL Context ready be used. Raises: NotSupportedError: Python installation has no SSL support. InterfaceError: Socket undefined or invalid ssl data. NirMrT)reverserrrr r zInvalid CA Certificate: zInvalid Certificate/Key: :)r'rrrsort 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_locationsrTrload_cert_chain set_ciphersrrrrr ) r.rrrrrrr tls_version ssl_protocolcontextrs r"build_ssl_contextzMySQLSocket.build_ssl_contexts>8&* yy t, , ;#$LM M  L  $ " 6 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$H F)+H .G(H )GGGH H2HHH I( H0I(I##I(r)r*r+ write_timeoutc |js4|j(|jj|r t|nd|j j |j|j|||y#t$r }Yd}~Cd}~wwxYw)atSend `payload` to the MySQL server. NOTE: if `payload` is an instance of `bytearray`, then `payload` might be changed by this method - `bytearray` is similar to passing a variable by reference. If you're sure you won't read `payload` after invoking `send()`, then you can use `bytearray.` Otherwise, you must use `bytes`. N)r*r+)rr'rfloatrrr/r()r.r)r*r+rris r"r/zMySQLSocket.sendrsz  ,,1F $$]U=%9PTU  II LL '%=     sAA77 B B  read_timeoutc |js4|j(|jj|r t|nd|j j |j|jS#t$r }Yd}~>d}~wwxYw)z.Get packet from the MySQL server comm channel.N)rr'rrrrr2r()r.rris r"r2zMySQLSocket.recvsj ,,1F $$LU<%8dS##DIIt||<<   sAA22 BBcy)zOpen the socket.Nr-rDs r"open_connectionzMySQLSocket.open_connectionr0r$cy)zGet the location of the socket.Nr-rDs r"r(zMySQLSocket.addressr0r$rr)NNNFFNN)NNNr)r4r5r6r7rErrrrr r:rrr rboolrrr9r/r;r2rrpropertyr(r-r$r"rrs >4*hsm** "4"4C"4D"4L!%"&!%*/.3,015`4 `43-`4# `4 "$ `4 &d^ `4tCy)`4$DI.`4 `4J(,26'+    } #+3-   }    @ =# =) =...r$rc`eZdZdZd deddffd ZedefdZd dZde d e ddfd Z xZ S) MySQLUnixSocketzpMySQL socket class using UNIX sockets. Opens a connection through the UNIX socket of the MySQL Server. unix_socketrNc>t|||_||_yr)rvrEr_address)r.rrys r"rEzMySQLUnixSocket.__init__s  +( r$c|jSrrrDs r"r(zMySQLUnixSocket.address }}r$c0 tjtjtj|_|jj |j |jj |jy#tjtf$r(}td|jt|f|d}~wt$r(}td|jt|f|d}~wt$r}tt!||d}~wwxYw)NirO)r8AF_UNIX SOCK_STREAMr'rrconnectrrRrSrr(r#rTr Exceptionr )r.rs r"rzMySQLUnixSocket.open_connections 4 ""DI II !9!9 : II  d.. / - (LL$     DLL+c2B#C  4 S* 3 4s0BBD#C D #C// D;DDargskwargsc8tjdty)zSwitch the socket to use SSL.z2SSL is disabled when using unix socket connectionsN)warningswarnWarning)r.rrs r"rzMySQLUnixSocket.switch_to_ssls  @  r$)z/tmp/mysql.sockrr) r4r5r6r7r rErr(rrrrrs@r"rrsX )C)) 40  $'  r$rc ZeZdZdZ d dedededdffd ZedefdZ d d Z xZ S) MySQLTCPSocketzYMySQL socket class using TCP/IP. Opens a TCP/IP connection to the MySQL Server. rport force_ipv6rNcrt|||_||_||_d|_|d||_y)Nrr)rvrEr server_portr_familyr)r.rrrrys r"rEzMySQLTCPSocket.__init__s@  $ $ * $vQtf- r$c|jSrrrDs r"r(zMySQLTCPSocket.addressrr$c Jd} tj|j|jdtjtj }|D]B}|j r|dtjk(r|}n|dtjk(s@|}n|j r|dtd|j|d|d}|\|_ }}}} tj|j|||_ |jj|j|jj!|y#t$r3}td|j|jt|f|d}~wwxYw#tj"t$f$r3}t'd|j|jt|f|d}~wt$r3}td|j|jt|f|d}~wt($r}tt+||d}~wwxYw)z/Open the TCP/IP connection to the MySQL server.)NNNNNrNzNo IPv6 address found for irO)r8 getaddrinforrrSOL_TCPrAF_INET6AF_INETrrTr#rr'rrrrRrSrrr ) r.addrinfo addrinfosinforsocktypeprotorisockaddrs r"rzMySQLTCPSocket.open_connections  +  **    "" I"??tAw&//'A#H7fnn,#H "8A;#6$'A$BRBRAS%TUU{"$Q<8@4x8 4 dllHeDDI II !9!9 : II  h '  (($*:*:Krs&:M  #;; ##''''## L !m4H "#OWOOD CD NbbJ0Df.#f.R. k. bR4[R4K CsA C!! C-,C-