/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__/_scripting.cpython-312.pyc (15700B)
N je=@UdZddlZddlZddlmZddlmZmZmZddl m Z ddl m Z dZ d d d d d ddddddddddZ ejdej ej"zZej&ed< GddZ d#dededee ddffd Zd!edeefd"Zy)$z8Classes and methods utilized to work with MySQL Scripts.N)deque)Deque GeneratorOptional)InterfaceError)MySQLScriptPartition;s\$s\^s\?s\(s\)s\[s\]s\{s\}s\.s\|s\+s\-s\*)$^?()[]{}.|+-*sA(delimiter\s+)(?=(?:[^"'`]*(?:"[^"]*"|'[^']*'|`[^`]*`))*[^"'`]*$))flagsDELIMITER_PATTERNceZdZdZdZdeddfdZdededeefd Ze d e de fd Z e d e de fd Z e d edeefdZe dede fdZe dedefdZdde deefdZdefdZy)MySQLScriptSplitterzBreaks a MySQL script into single statements. It strips custom delimiters and comments along the way, except for comments representing a MySQL extension or optimizer hint. s3(?=(?:[^"'`]*(?:"[^"]*"|'[^']*'|`[^`]*`))*[^"'`]*$) sql_scriptreturnNc<||_d|_d|_i|_y)z Constructor.N)_code _single_stmts_mappable_stmts_re_sql_split_stmts)selfrs K/opt/nydus/tmp/pip-target-a90h98xg/lib/python/mysql/connector/_scripting.py__init__zMySQLScriptSplitter.__init__Ns! 486:<> code delimitercg}||jvrd|vr td|jDcgc]&}tj ||j (}}t jdj||jz|j|<|j|j|D]&}|j}|s|j|(|Scc}w)z Split code context by delimiter.\z5The backslash (\) character is not a valid delimiter.r') r#rdecodeDELIMITER_RESERVED_SYMBOLSgetencoderecompilejoin_regex_sql_split_stmtssplitstripappend)r$r(r)snippetschardelimiter_patternsnippet snippet_strips r%_split_statementz$MySQLScriptSplitter._split_statementUs D44 4 !$L &,,.!.D+..tT[[]C. !35***+d.I.II3D $ $Y /// :@@FG#MMOM .G !s+C&r8cHtjt|ddvS)z;Validates whether `char` is a white-space character or not.r>Z unicodedatacategorychrr8s r%is_white_space_charz'MySQLScriptSplitter.is_white_space_charm###CI.q1U::r'cHtjt|ddvS)z7Validates whether `char` is a control character or not.r>Cr?rCs r%is_control_charz#MySQLScriptSplitter.is_control_charrrEr'stringc.tjd|S)z6Split `string` by any control character or whitespace.s[\s\x00-\x1f\x7f-\x9f])r0r4)rIs r%$split_by_control_char_or_white_spacez8MySQLScriptSplitter.split_by_control_char_or_white_spacewsxx2F;;r'c:tjt|duS)zBValidates whether `code` has the delimiter command pattern or not.N)r0searchrr(s r% has_delimiterz!MySQLScriptSplitter.has_delimiter|syy*D1==r'cFdtdtdtfd}dtdtfd}dtdtdtfd}td}d\}}t d t d t d } }}|t |kr|Qd } ||d d ||rd} n||dd rd} n||d d ||rd} | | dvr3|t |krh|||k7r`|dz }|t |krM|||k7rnC|dzt |kr-|||dzdk7r"|dz }|dzt |kr |||dzdk7r"|dz }t t | D]} |j|rttj|dstj|drD|j|r2tj|dr+tj|drDc||||| fvr||}n | ||||hvrd }|j|||dz }|t |krt|S)aRemove MySQL comments which include `--`-style, `#`-style and `C`-style comments. A `--`-style comment spans from `--` to the end of the line. It requires the second dash to be followed by at least one whitespace or control character (such as a space, tab, newline, and so on). A `#`-style comment spans from `#` to the end of the line. A C-style comment spans from a `/*` sequence to the following `*/` sequence, as in the C programming language. This syntax enables a comment to extend over multiple lines because the beginning and closing sequences need not be on the same line. **NOTE: Only C-style comments representing MySQL extensions or optimizer hints are preserved**. E.g., ``` /*! MySQL-specific code */ /*+ MySQL-specific code */ ``` *For Reference Manual- MySQL Comments*, see https://dev.mysql.com/doc/refman/en/comments.html. b_strb_charrch|dk(xr,tj|xstj|S)Ns--)rrHrDrQrRs r% is_dash_stylez:MySQLScriptSplitter.remove_comments..is_dash_styles5E>#33F;C&::6B r'c |dk(S)N#)rQs r% is_hash_stylez:MySQLScriptSplitter.remove_comments..is_hash_styles D= r'c@|dk(xr|tdtdhvS)Ns/*!r)ordrTs r% is_c_stylez7MySQLScriptSplitter.remove_comments..is_c_styles#E>HfSXs3x4H&H Hr'r')rN '"N--#z/*)rbrdrs*/) bytesintbool bytearrayr\lenrangepoprrHrDr6) r(rUrYr]bufi literal_ctx line_break single_quote double_quotestyle_s r%remove_commentsz#MySQLScriptSplitter.remove_commentss\<      ! !4 ! Ie IS IT In ;14TCHc#h,L #d)m" RS473 E"3rs8,EBC$q'2 E$ +#d)mQ:0EFA #d)mQ:0E !ec$i/DQUOu4LFA !ec$i/DQUOu4LQ"3u:. /+;;CGD.BB3r7K +;;CGD.BB3r7K"tAw<2N'N"1g (T!Wj8Q-Q" JJtAw  FAG#d)mJSzr'ruc|j |jSg|_t}g}d}|r!tj|j}n |j}t j t|D]}t jt|rq|j|d}|j|jj|jdj||||t|dg}}n|j||}|r;|jj|jdj|||jS)aSplits the given script text into a sequence of individual statements. The word DELIMITER and any of its lower and upper case combinations such as delimiter, DeLiMiter, etc., are considered reserved words by the connector. Users must quote these when included in multi statements for other purposes different from declaring an actual statement delimiter; e.g., as names for tables, columns, variables, in comments, etc. ``` CREATE TABLE `delimiter` (begin INT, end INT); -- I am a `DELimiTer` comment ``` If they are not quoted, the statement-mapping will not produce the expected experience. See https://dev.mysql.com/doc/refman/8.0/en/keywords.html to know more about quoting a reserved word. *Note that comments are always ignored as they are not considered to be part of statements, with one exeception; **C-style comments representing MySQL extensions or optimizer hints are preserved***. Nr'rN)patternrIr )r(r))r!DEFAULT_DELIMITERrrur r0r4rrMrKrlextendr<r2rjr6)r$rur)rmprevr(currnext_delimiters r% split_scriptz MySQLScriptSplitter.split_scriptsJ0    )%% % %  &66DJJ6GD::DHH%6tDDyy*D1"&!J!J4!PQR!S ""))))tyy~)S "0$s>7J7L2M1N3  4 D1E6     % %%%499S>Y%O !!!r'c8|jjdS)Nutf-8)r r,)r$s r%__repr__zMySQLScriptSplitter.__repr__ szz  ))r')T)__name__ __module__ __qualname____doc__r3rfr&listr< staticmethodrgrhrDrHrKrOrur~strrrXr'r%rrEs X?5?T?Uue0;#;$;;;c;d;;E>d>>QeQQQfI"DI"DKI"V*#*r'rsql_code map_resultsrc #Ktj|s|sttg|yt|}|j }|sttdgdy|s(tt|dj |yd}dt |D}|D]X}||kDr-tdj |||t|||t||t||g|d z}Z|t|kr@tdj ||t|t||t|yyw) aBreaks a MySQL script into sub-scripts. If the given script uses `DELIMITER` statements (which are not recognized by MySQL Server), the connector will parse such statements to remove them from the script and substitute delimiters as needed. This pre-processing may cause a performance hit when using long scripts. Note that when enabling `map_results`, the script is expected to use `DELIMITER` statements in order to split the script into multiple query strings. Args: sql_code: MySQL script. map_results: If True, each sub-script is `statement-result` mappable. Returns: A generator of typed dictionaries with keys `single_stmts` and `mappable_stmts`. If mapping disabled and no delimiters detected, it returns a 1-item generator, the field `single_stmts` is an empty list and the `mappable_stmt` field corresponds to the unmodified script, that may be mappable. If mapping disabled and delimiters detected, it returns a 1-item generator, the field `single_stmts` is a list including all the single statements found in the script and the `mappable_stmt` field corresponds to the processed script (delimiters are stripped) that may be mappable. If maping enabled, the script is broken into mappable partitions. It returns an N-item generator (as many items as computed partitions), the field `single_stmts` is a list including all the single statements of the partition and the `mappable_stmt` field corresponds to the sub-script (partition) that is guaranteed to be mappable. Raises: `InterfaceError` if an invalid delimiter string is found. ) single_stmts mappable_stmtN)rr's; rc3TK|] \}}|ddjdk(s|"yw)NsCALL )upper).0jstmts r% z(split_multi_statement..js+W&671d$r(..:Jh:VQ&6s(()rrr)rrOr rr~r2 enumeraterj)rrtokstmtsrn partition_idsrs r%split_multi_statementr$sZL  , ,X 6{ #b RR  2C    E #se CPP #uV[[5G    AWi&6WM  q5$"(++eAaj"9!&uQqz!2  #(az1B   E 3u:~ $kk%CJ*?@"5SZ#89  sEEscriptctjdtj|tj}|rt |ddk7r t gSt |Dcgc]}|djdc}Scc}w)alScans the MySQL script looking for `filenames` (one for each `LOCAL INFILE` statement found). Arguments: script: a MySQL script that may include one or more `LOCAL INFILE` statements. Returns: filenames: a list of filenames (one for each `LOCAL INFILE` statement found). An empty list is returned if no matches are found. s2LOCAL\s+INFILE\s+(["'])((?:\\\1|(?:(?!\1)).)*)(\1))rwrIrrrr)r0findallrru IGNORECASErjrr,)rmatchesmatchs r%get_local_infile_filenamesrstjjJ"226:mmG c'!*o*Ry @u%(//'*@ AA@s!B)F)rr0r@ collectionsrtypingrrrerrorsrtypesr ryr-r1r MULTILINErPattern__annotations__rrfrhrrrrXr'r%rs:? --"',               E * M --",, &!2::D\*\*BZ Z Z #T4/0Z zBuBsBr'