/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__/utils.cpython-312.pyc (28181B)
N j\ PUdZddlZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddl mZmZmZmZmZmZmZmZmZmZmZmZmZmZddlmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%erddl&m'Z'dd l(m)Z)dd l*m+Z+m,Z,dd l-m.Z.d Z/e0e1d <e2e3e e)fZ4e#e$e2e$e3e$e e$e)fe1d<de%e2e5fde2fdZ6de2de5fdZ7de2de5fdZ8de2de5fdZ9de2de5fdZ:de2de5fdZ;de2de5fdZde5de#e5e"e5ffdZ?de5de"e#e"e5dffdZ@ d?de5de"e5de"e2de#e5e5ffd ZAde5de2de#e5e2ffd!ZBde5de#e5e"e2ffd"ZCde.deDfd#ZE d@d$e.d%e"eDd&e2ddfd'ZFde eDeDffd(ZGde eDeDffd)ZHde"e eDeDffd*ZIde#eDeDeDffd+ZJd,eDdeDfd-ZKd,eDde eDeeDge0fffd.ZLd/eDde"e#eDeDffd0ZMd1eDdeDfd2ZN dAd3e%e2e.fd4eDdeOfd5ZPe de eDe%eDe#eDeDffffd6ZQd7eDdefd8ZRd9eDd:eDddfd;ZSd:eDddfd<ZTGd=d>ZUy)Bz Utilities.N)Decimal) lru_cache) in_table_a1 in_table_b1 in_table_c3 in_table_c4 in_table_c5 in_table_c6 in_table_c7 in_table_c8 in_table_c9 in_table_c11 in_table_c12in_table_c21_c22 in_table_d1 in_table_d2) TYPE_CHECKINGAnyCallableDictListOptionalTupleTypeUnion)MySQLConnectionAbstract) HexLiteral)DEPRECATED_TLS_CIPHERSUITESDEPRECATED_TLS_VERSIONS) StrOrBytesF__MYSQL_DEBUG__ NUMERIC_TYPESbufreturnc.t|tr|St|t}}|dk(r|dS|dkr0||dd|z zzz }tt j d|dS||dd|z zzz }tt j d|dS)z&Unpacks the given buffer to an integerrrs r4 int2storerCps.  1uE =>> ;;tQ r6c^|dks|dkDr tdtjd|ddS)zb Takes an unsigned integer (3 bytes) and packs it as a bytes-object. Returns string. rz%int3store requires 0 <= i <= 16777215r)r;r>s r4 int3storerG{s5  1uH @AA ;;tQ ! $$r6cX|dks|dkDr tdtjd|S)zb Takes an unsigned integer (4 bytes) and packs it as a bytes-object. Returns string. rz'int4store requires 0 <= i <= 4294967295r)r;r>s r4 int4storerJs.  1uJBCC ;;tQ r6cX|dks|dkDr tdtjd|S)zZ Takes an unsigned integer (8 bytes) and packs it as string. Returns string. rz!int8store requires 0 <= i <= 2^64r+r;r>s r4 int8storerMs0  1u((<== ;;tQ r6c|dks|dkDr td|dkrt}n*|dkrt}n|dkrt}n|dkrt}nt }||S)z Takes an unsigned integers and packs it as a bytes-object. This function uses int1store, int2store, int3store, int4store or int8store depending on the integer value. returns string. rrLz!intstore requires 0 <= i <= 2^64r9rArErI)r<r?rCrGrJrM)r7 formed_strings r4intstorerPs_ 1u((<==Cx! e! h! j! !  r6c|dks|dkDr td|dkrtjd|S|dkrdtjd|zS|d krd tjd |dd zSd tjd|zS)z| Takes an unsigned integer and packs it as bytes, with the information of how much bytes the encoded int takes. rrLzRequires 0 <= i <= 2^64r:rArBrEr)rFr+r;r>s r4lc_intrVs  1u((2333w{{4##EzT1---H}T1-a222 V[[q) ))r6sizec|d|}||d|fS)zi Reads bytes from a buffer. Returns a tuple with buffer less the read bytes, and the bytes. rNr$rWress r4 read_bytesr\s a+C J r6c|ddk(r|dddfSdx}}|d}|dkr|}|d|zd|d|dzfS|dk(rd}n|dk(rd }n|d k(rd }t|d|dz}|||zdzd||dz||zdzfS) u Takes a buffer and reads a length coded string from the start. This is how Length coded strings work If the string is 250 bytes long or smaller, then it looks like this: <-- 1b --> +----------+------------------------- | length | a string goes here +----------+------------------------- If the string is bigger than 250, then it looks like this: <- 1b -><- 2/3/8 -> +------+-----------+------------------------- | type | length | a string goes here +------+-----------+------------------------- if type == ü: length is code in next 2 bytes elif type == ý: length is code in next 3 bytes elif type == þ: length is code in next 8 bytes NULL has a special value. If the buffer starts with û then it's a NULL and we return None as value. Returns a tuple (trucated buffer, bytes). rrRrNrFr*r5)r$r2lsizefsts r4read_lc_stringrfs@ 1v}ABFU a&C czAJL!3q6A:#677 cz   SUQY' (F "$ %s519v~7I'J KKr6.cg}dddd}t|}d}||kr||}|dk(ry|dk(r|jd|d z }nz|d kr(|}|j||d z||d zz|d |zz }nMd} ||}t||d z||d zz}|j||d z|z||z|d zz|d |z|zz }||krt |S#t$rYywxYw) zXReads all length encoded strings from the given buffer Returns a list of bytes r`rFr*)r_rarbrr9NrRrr^)r.appendKeyErrorr5tuple)r$byteslstsizesbuf_lenposfirstr2rds r4read_lc_string_listrps, ')H!! $E#hG C -C C< C< OOD ! 1HC|S1W#'0B CDq6z! !%LE!cAg#'1B!CDC!GeOfuna6P QRq5y6))/ -2 ?    s2C CCendc| | td| |j|}||dzd|d|fS| t||Std#t$r}td|d}~wwxYw)zr Reads a string up until a character or for a given size. Returns a tuple (trucated buffer, string). Nz&read_string() needs either end or sizezend byte not present in bufferrrz.read_string() needs either end or size (weird))r<indexr\)r$rqrWidxerrs r4 read_stringrv/s {t|ABB  H))C.CC!GIAc ++ #t$$ E FF  H=>C G HsA A$ AA$c,t|d|}||d|fS)zMRead an integer from buffer Returns a tuple (truncated buffer, int) rNrcrZs r4read_intrxHs% #a+ C J r6ch|s td|d}|dk(r|dddfS|dkr|ddt|fS|dk(r!|ddtjd|dddfS|d k(r$|d dtjd |dd d zdfS|d k(r!|ddtjd|dddfStd)z Takes a buffer and reads an length code string from the start. Returns a tuple with buffer less the integer and the integer read. z Empty buffer.rrRrNr_rFz>/ * o 0HD 3I9~"A,$$&CaL''-33C8EF3K  1 M 1 Ms A#B??C ci}tjjdd}tjj|r{t |d5}|D]]}|j d}t |dk7r#|dj}|djd jd }|||<_ d d d |S|S#1swY|SxYw) ztParse the contents of /etc/lsb-release file. Returns: A dictionary containing release information. rz lsb-releaserrrr`rrrrNr)rlsb_release_filerrrrrs r4_parse_lsb_releasers Fww||FM: ww~~&' "W 5  JJsO y>Q&l((*!! ++D177<#s !6 M6M6 Ms A#B??C ci}ttjdd5} tjd|}|j tjj}|D]^}|jd}t|dk7r#|d jd d j}|d jd }|||<` ddd|S#t $r YdddywxYw#1swY|SxYw)ztParse the output of the lsb_release command. Returns: A dictionary containing release information. wrr) lsb_releasez-a)stderrN:r`r _r )rrdevnull subprocess check_outputOSErrordecodesysgetfilesystemencoding splitlinesrr.replacerr)rrstdoutlinesrrrrs r4_parse_lsb_release_commandrs F bjj# 0G ,,-B7SF c779:EEGD 3I9~"A,&&sC0668CaL&&t,EF3K  1 M  1 0  1 Ms.C.CBC. C+ C.*C++C..C8ct}|r5|jdd|jdd|jddfSt}|r5|jdd|jdd|jddfSt}|r5|jdd|jd d|jd dfSy ) aNTries to determine the name of the Linux OS distribution name. First tries to get information from ``/etc/os-release`` file. If fails, tries to get the information of ``/etc/lsb-release`` file. And finally the information of ``lsb-release`` command. Returns: A tuple with (`name`, `version`, `codename`) distrib_idr~distrib_releasedistrib_codenamedistributor_idreleasecodenamename version_idversion_codename)r~r~r~)rgetrr)rs r4linux_distributionrs(:';F JJ|R ( JJ(" - JJ)2 .  ( )F JJ' , JJy" % JJz2 &   F JJvr " JJ|R ( JJ)2 .  r6 unicode_strc>|rtj|ddvryy)zGet the readiness direction of the unicode string. We assume that the direction is "L-to-R" if the first character does not indicate the direction is "R-to-L" or an "AL" (Arabic Letter). r)RALR-to-LzL-to-R) unicodedata bidirectional)rs r4_get_unicode_read_directionrs+ {00Q@E r6ct|}|dk(r/t|drt|ds tddtiSdtiS)at 1) The characters in section 5.8 MUST be prohibited. 2) If a string contains any RandALCat character, the string MUST NOT contain any LCat character. 3) If a string contains any RandALCat character, a RandALCat character MUST be the first character of the string, and a RandALCat character MUST be the last character of the string. rrzvInvalid unicode Bidirectional sequence, if the first character is RandALCat, the final charactermust be RandALCat too.z7Bidirectional Characters requirement 2 [StringPrep, d2])rrr<r)rread_dirs r4_get_unicode_direction_rulers]+;7H8KN+ KO0L)  J;WW F{ SSr6normalized_strc httttttt t ttttd } |jt||D]0}|jD]\}}||s|dk7s||fccS2y#t$r}|t|fcYd}~Sd}~wwxYw)aCheck for Prohibited Output according to rfc4013 profile. This profile specifies the following characters as prohibited input: - Non-ASCII space characters [StringPrep, C.1.2] - ASCII control characters [StringPrep, C.2.1] - Non-ASCII control characters [StringPrep, C.2.2] - Private Use characters [StringPrep, C.3] - Non-character code points [StringPrep, C.4] - Surrogate code points [StringPrep, C.5] - Inappropriate for plain text characters [StringPrep, C.6] - Inappropriate for canonical representation characters [StringPrep, C.7] - Change display properties or deprecated characters [StringPrep, C.8] - Tagging characters [StringPrep, C.9] In addition of checking of Bidirectional Characters [StringPrep, Section 6] and the Unassigned Code Points [StringPrep, A.1]. Returns: A tuple with ("probited character", "breaked_rule") ) z4Space characters that contains the ASCII code pointsz&Space characters non-ASCII code pointsz(Unassigned Code Points [StringPrep, A.1]z.Non-ASCII space characters [StringPrep, C.1.2]z,ASCII control characters [StringPrep, C.2.1]z(Private Use characters [StringPrep, C.3]z+Non-character code points [StringPrep, C.4]z'Surrogate code points [StringPrep, C.5]z9Inappropriate for plain text characters [StringPrep, C.6]zGInappropriate for canonical representation characters [StringPrep, C.7]zDChange display properties or deprecated characters [StringPrep, C.8]z$Tagging characters [StringPrep, C.9]Nr)rrrrrrr r r r r updaterr<ritems)rrulesrucharrulefuncs r4"validate_normalized_unicode_stringrs2AM2>4?:F8H4?7B3>EPS^P[0; E( 0@A++-JD$DzdckTz!(  (s3x''(sB B1 B,&B1,B1a_stringc|Dcgc]}t|rdnt|rdn| }}dj|}tjd|}|sy|Scc}w)a(normalizes a unicode string according to rfc4013 Normalization of a unicode string according to rfc4013: The SASLprep profile of the "stringprep" algorithm. Normalization Unicode equivalence is the specification by the Unicode character encoding standard that some sequences of code points represent essentially the same character. This method normalizes using the Normalization Form Compatibility Composition (NFKC), as described in rfc4013 2.2. Returns: Normalized unicode string according to rfc4013. rr~NFKC)rrrr normalize)rr nstr_listnstrs r4normalize_unicode_stringrCsm*DD![->rDH 779 D   .D  Ks#Apayloadrct|tr|St|tr t|St|ts t|j |St|S#t $r}t d|d}~wwxYw)z(Initialize a bytearray from the payload.rzpayload must be a str or bytesN)r,r/r-bytesencodeAttributeErrorr<)rrrus r4init_bytearrayrhs}'9%'3!! gu % HW^^X^>? ? W  H=>C G HsA%% A?. A::A?cddd}tjdk(rtdtjdvrd|d<n6dtjdvrd |d<ntj|d<d tjd |d <|Stj |d<tj d k(rdtjd|d <|Sdjtdd|d <|S)z4Return a dict with the platform arch and OS version.r~)archversionnt64rx86_64r32i386zWindows-rrDarwinzmacOS--r`) rrplatform architecture win32_vermachinesystemmac_verrr)plats r4 get_platformrys=?23ND ww$ 8((*1- -#DL X**,Q/ /!DL#002DL$X%7%7%9!%<$=>Y K  '')V ??  ( &x'7'7'9!'<&=>DO K"hh'9';Aa'@ADO Kr6fullpathc"t|ts td |jdd\}}t j |}t ||}|S#t$rtd|ddttf$r}t||d}~wwxYw)a(Import an object from a fully qualified module path. Args: obj (str): A string representing the fully qualified name of the object. Returns: Object: The imported object. Raises: ValueError: If the object can't be imported. .. versionadded:: 8.0.33 z]'fullpath' should be a str representing the fully qualified name of the object to be imported.rzNo callable named ''N) r,rr<rsplit importlib import_modulegetattrrModuleNotFoundError)r module_str callable_strmoduleobjrus r4 import_objectr s h $ $  ,#+??3#: L((4fl+ J F.xj:;E / 0,C5"+,s6A'B< B  Bcipher_as_ossl tls_versionc|tj|ijvr!d|d}tj|t yy)aIEmits a warning if a deprecated cipher is being utilized. Args: cipher: Must be ingested as OpenSSL name. tls_versions: TLS version to check the cipher against. Raises: DeprecationWarning: If the cipher is flagged as deprecated according to the OSSA cipher list. z$This connection is using TLS cipher [ which is now deprecated and will be removed in a future release of MySQL Connector/Python.N)rrvalueswarningswarnDeprecationWarning)r r warn_msgs r4warn_ciphersuites_deprecatedrsR488bIPPRR2>2BC& &   h 23 Sr6cV|tvr!d|d}tj|tyy)aEmits a warning if a deprecated TLS version is being utilized. Args: tls_versions: TLS version to check. Raises: DeprecationWarning: If the TLS version is flagged as deprecated according to the OSSA cipher list. z%This connection is using TLS version r N)r rrr)r rs r4warn_tls_version_deprecatedrs:--3K=A& &   h 23 .r6c\eZdZdZdeddfdZdedefdZded eddffd Zdefd Z xZ S) GenericWrapperzr8s:      A$M   Q uT#YU T']D"?2Lj%U%xhuos6J0K'L%T G G %G 3-G 5%< G2%suUCZ'8>U>uUHSM%9:>46 6s6EG '  '!)# '>A '  '4S>*DcN(HT#s(^$<."E#sC-0"J S S TSTT#xt ?T:T5UT811 eCHo1h"s"s"L443444(4S4T4&#0#0r6