Files
wg-backend-django/acer-env/lib/python3.10/site-packages/sqlparse/__pycache__/sql.cpython-310.pyc

200 lines
21 KiB
Plaintext
Raw Normal View History

2022-11-30 15:58:16 +07:00
o
<00>Ԅc<D484>O<00>@s<>dZddlZddlmZddlmZmZGdd<06>d<06>ZGdd<08>d<08>Z Gd d
<EFBFBD>d
e <09>Z
Gd d <0C>d e
<EFBFBD>Z Gd d<0E>dee
<EFBFBD>Z Gdd<10>de
<EFBFBD>Z Gdd<12>de
<EFBFBD>ZGdd<14>de
<EFBFBD>ZGdd<16>de
<EFBFBD>ZGdd<18>de
<EFBFBD>ZGdd<1A>de
<EFBFBD>ZGdd<1C>de
<EFBFBD>ZGdd<1E>de
<EFBFBD>ZGdd <20>d e
<EFBFBD>ZGd!d"<22>d"e
<EFBFBD>ZGd#d$<24>d$e
<EFBFBD>ZGd%d&<26>d&e
<EFBFBD>ZGd'd(<28>d(ee
<EFBFBD>ZGd)d*<2A>d*e
<EFBFBD>ZGd+d,<2C>d,e
<EFBFBD>ZGd-d.<2E>d.e
<EFBFBD>ZGd/d0<64>d0e
<EFBFBD>ZdS)1zFThis module contains classes representing syntactical elements of SQL.<2E>N<><01>tokens)<02>imt<6D> remove_quotesc@s eZdZdZdd<03>Zdd<05>ZdS)<07>NameAliasMixinz'Implements get_real_name and get_alias.cCs$|jtjdfd<02>\}}|j|dd<04>S)<05>7Returns the real name (object name) of this identifier.<2E>.<2E><01>mT)<01> real_name)<04> token_next_by<62>T<> Punctuation<6F>_get_first_name)<03>self<6C>dot_idx<64>_<>r<00>_/home/infidel/Sync/Project/ocp-wg-backend/acer-env/lib/python3.10/site-packages/sqlparse/sql.py<70> get_real_nameszNameAliasMixin.get_real_namecCsl|jtjdfd<02>\}}|dur|j|ddd<06>S|jtjd<07>\}}t|j<06>dkr2|dur4|jdd <09>SdSdS)
<EFBFBD>2Returns the alias for this identifier or ``None``.<2E>ASr N<>T)<01>keywords<64><01>t<><00><01>reverse)r r <00>Keywordr<00>
Whitespace<EFBFBD>lenr)r<00>kw_idx<64>kwr<00>wsrrr<00> get_aliass <08>zNameAliasMixin.get_aliasN)<06>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__rr%rrrrrs rc@sfeZdZdZdZdd<04>Zdd<06>Zdd<08>Zd d
<EFBFBD>Zd d <0C>Z d d<0E>Z
ddd<11>Z dd<13>Z dd<15>Z dd<17>ZdS)<1A>Tokenz<6E>Base class for all other classes in this module.
It represents a single token and has two instance attributes:
``value`` is the unchanged value of the token and ``ttype`` is
the type of the token.
)<07>value<75>ttype<70>parent<6E>
normalized<EFBFBD>
is_keyword<EFBFBD>is_group<75> is_whitespacecCsXt|<02>}||_||_d|_d|_|tjv|_|jtjv|_ |jr'|<02>
<EFBFBD>|_ dS||_ dS)NF) <0C>strr+r,r-r0r rr/r r1<00>upperr.)rr,r+rrr<00>__init__2s zToken.__init__cC<00>|jS<00>N<>r+<00>rrrr<00>__str__<sz Token.__str__cCsF|<00><00>}|<00><01>}|<02>d<01>r|<02>d<01>rdnd}djddt|<00>it<06><00><01>S)N<>'<27>"z"<{cls} {q}{value}{q} at 0x{id:2X}><3E>idr)<07>_get_repr_name<6D>_get_repr_value<75>
startswith<EFBFBD>endswith<74>formatr<<00>locals)r<00>clsr+<00>qrrr<00>__repr__Cs<02><06>zToken.__repr__cCst|j<01><01>d<01>dS)Nr<00><><EFBFBD><EFBFBD><EFBFBD>)r2r,<00>splitr8rrrr=KszToken._get_repr_namecCs2t|<00>}t|<01>dkr|dd<02>d}t<02>dd|<01>S)N<><00>z...z\s+<2B> )r2r!<00>re<72>sub)r<00>rawrrrr>Ns zToken._get_repr_valueccs <00>|VdS)zResolve subgroups.Nrr8rrr<00>flattenTs<02>
z Token.flattenFcs<>|j|u}|r |dur |St|t<02>r|f}|r8|jrtjnd<02><00>fdd<04>|D<00>}|D] }|<05>|j<07>r5dSq*dS|jrBdd<04>|D<00>}|j|vS)a,Checks whether the token matches the given arguments.
*ttype* is a token type. If this token doesn't match the given token
type.
*values* is a list of possible values for this token. The values
are OR'ed together so if only one of the values matches ``True``
is returned. Except for keyword tokens the comparison is
case-sensitive. For convenience it's OK to pass in a single string.
If *regex* is ``True`` (default is ``False``) the given values are
treated as regular expressions.
Nrc3s<00>|] }t<00>|<01><00>VqdSr6)rK<00>compile<6C><02>.0<EFBFBD>v<><01>flagrr<00> <genexpr>ns<02>zToken.match.<locals>.<genexpr>TFcss<00>|]}|<01><00>VqdSr6)r3rPrrrrUvs<02>)r,<00>
isinstancer2r/rK<00>
IGNORECASE<EFBFBD>searchr.)rr,<00>values<65>regex<65> type_matched<65>patternrrSr<00>matchXs

 <02>
z Token.matchcCs&|j}|rt||<01>r dS|j}|sdS)z<>Returns ``True`` if this token is within *group_cls*.
Use this method for example to check if an identifier is within
a function: ``t.within(sql.Function)``.
TF)r-rV)r<00> group_clsr-rrr<00>withinzs
<04>z Token.withincCs
|j|kS)z<Returns ``True`` if this token is a direct child of *other*.<2E>r-)r<00>otherrrr<00> is_child_of<6F><00>
zToken.is_child_ofcCs$|j}|r||kr dS|j}|sdS)z7Returns ``True`` if *other* is in this tokens ancestry.TFr`)rrar-rrr<00> has_ancestor<6F>s<04>zToken.has_ancestorN<72>F)r&r'r(r)<00> __slots__r4r9rEr=r>rNr]r_rbrdrrrrr*'s

" r*cseZdZdZdZd?<3F>fdd<05> Zdd<07>Zdd <09>Zd
d <0B>Zd d <0A>Z d@dd<11>Z
dd<13>Z dd<15>Z dd<17>Z edd<19><00>ZdAdd<1C>ZdBdd<1F>ZdCd!d"<22>Zd#d$<24>Zd%d&<26>ZdBd'd(<28>ZdDd)d*<2A>ZdEd+d,<2C>Z  dBd-d.<2E>Zd/d0<64>ZdFd1d2<64>Zd3d4<64>Zd5d6<64>Zd7d8<64>Zd9d:<3A>Zd;d<<3C>Z  dGd=d><3E>Z <20>Z!S)H<> TokenListzwA group of tokens.
It has an additional instance attribute ``tokens`` which holds a
list of child-tokens.
rNcs:|pg<00>_<00>fdd<02><08>jD<00>t<01><00>dt<03><00><01>d<03>_dS)Ncsg|]}t|d<00><00><03>qSr`)<01>setattr<74>rQ<00>tokenr8rr<00>
<listcomp><3E><00>z&TokenList.__init__.<locals>.<listcomp>T)r<00>superr4r2r0)rr<00><01> __class__r8rr4<00>s

zTokenList.__init__cCsd<01>dd<03>|<00><01>D<00><01>S)N<>css<00>|]}|jVqdSr6r7rirrrrU<00>s<02>z$TokenList.__str__.<locals>.<genexpr>)<02>joinrNr8rrrr9<00>szTokenList.__str__cCs
t|j<01>Sr6)<02>iterrr8rrr<00>__iter__<5F><00>
zTokenList.__iter__cCs
|j|Sr6r)r<00>itemrrr<00> __getitem__<5F>rtzTokenList.__getitem__cCs
t|<00>jSr6)<02>typer&r8rrrr=<00>rtzTokenList._get_repr_namerrpcCs<>t|j<01>}t|j<01>D]P\}}|<07><03>}|<07><04>} ||dk}
|
r dnd} | <09>d<04>r.| <09>d<04>r.dnd} tdjd it <09><00><01>|d<07>|j
rZ|dusH||krZ|
rLd nd
} |<07> ||d||| <00>q
dS) zPretty-print the object tree.rz`- z|- r:r;z${_pre}{pre}{idx} {cls} {q}{value}{q})<01>fileNz z| r) r!r<00> enumerater=r>r?r@<00>printrArBr0<00> _pprint_tree)r<00> max_depth<74>depth<74>f<>_pre<72> token_count<6E>idxrjrCr+<00>last<73>prerD<00>
parent_prerrrr{<00>s&
  <04><04><06> <02><04>zTokenList._pprint_treecCsDd}|<00><00>D]}|t|j<02>}||kr|kr|S|}qdS)z-Returns the token that is on position offset.rN)rNr!r+)r<00>offsetr<74>rj<00>endrrr<00>get_token_at_offset<65>s <02><04>zTokenList.get_token_at_offsetccs.<00>|jD]}|jr|<01><02>EdHq|VqdS)znGenerator yielding ungrouped tokens.
This method is recursively called for all child tokens.
N)rr0rN<00>rrjrrrrN<00>s <02>
<04>zTokenList.flattenccs<00>|jD]}|jr |VqdSr6)rr0r<>rrr<00> get_sublists<74>s <02>
<02><04>zTokenList.get_sublistscCr5r6rr8rrr<00>_groupable_tokens<6E>szTokenList._groupable_tokensFc Cs<>|durdSt|ttf<02>s|f}|r!|dusJ<00>t|ddd<03>}n|dur*t|j<05>}t||<03>}|D]}|j|}|D]}||<07>rH||fSq:q1dS)znext token that match functionsNrrF<00>NN)rV<00>list<73>tuple<6C>ranger!r) r<00>funcs<63>startr<74>r<00>indexesr<73>rj<00>funcrrr<00>_token_matching<6E>s$ 


<02><02>zTokenList._token_matchingTcs<00><00>fdd<02>}|<00>|<03>dS)z<>Returns the first child token.
If *skip_ws* is ``True`` (the default), whitespace
tokens are ignored.
if *skip_cm* is ``True`` (default: ``False``), comments are
ignored too.
c<00> <00>r|jp<0E>ot|tjtd<01> S<00>N)r<00>i<>r1rr <00>Comment<6E><01>tk<74><02>skip_cm<63>skip_wsrr<00>matcher<00>
<04>z&TokenList.token_first.<locals>.matcherr<00>r<>)rr<>r<>r<>rr<>r<00> token_first<73>s
zTokenList.token_firstrFcs"|d7}|<00><00><00><01>fdd<03>||<05>S)Nrcst|<00><00><01><02>Sr6)rr<><00>r<>r
rrr<00><lambda>
sz)TokenList.token_next_by.<locals>.<lambda>r<>)rr<>r
rr<>r<>rr<>rr szTokenList.token_next_bycCs2t|ttf<02>s
|fn|}dd<02>|D<00>}|<00>||<02>S)Ncsg|]<08><00>fdd<01><08>qS)cs
<00>|<00> Sr6rr<><00>r<>rrr<>s
z9TokenList.token_not_matching.<locals>.<listcomp>.<lambda>r)rQrr<>rrkrlz0TokenList.token_not_matching.<locals>.<listcomp>)rVr<>r<>r<><00>rr<>r<>rrr<00>token_not_matching s zTokenList.token_not_matchingcCs|<00>||<02>dS)Nrr<>r<>rrr<00>token_matchingszTokenList.token_matchingcCs|j|||dd<02>S)z<>Returns the previous token relative to *idx*.
If *skip_ws* is ``True`` (the default) whitespace tokens are ignored.
If *skip_cm* is ``True`` comments are ignored.
``None`` is returned if there's no previous token.
T)<01>_reverse)<01>
token_next)rr<>r<>r<>rrr<00>
token_prevszTokenList.token_prevcs2|durdS|d7}<01><00>fdd<05>}|j|||d<06>S)z<>Returns the next token relative to *idx*.
If *skip_ws* is ``True`` (the default) whitespace tokens are ignored.
If *skip_cm* is ``True`` comments are ignored.
``None`` is returned if there's no next token.
Nr<4E>rcr<>r<>r<>r<>r<>rrr<>)r<>z%TokenList.token_next.<locals>.matcherrr<>)rr<>r<>r<>r<>r<>rr<>rr<>s
zTokenList.token_nextcCs0t|t<01>r|n|<00>|<02>}||j|d<01><00>|<01>S)zReturn list index of token.N)rV<00>int<6E> token_indexr<00>index)rrjr<>rrrr<>.szTokenList.token_indexc Cs<>|}|j|}||}|r1t||<01>r1|j|d|<07>}|} | j<00>|<08>|j|d|<07>=t|<02>| _n|j||<07>}||<08>} | g|j||<07><|| _|D]}
| |
_qI| S)z+Replace tokens by an instance of *grp_cls*.r)rrV<00>extendr2r+r-) r<00>grp_clsr<73>r<><00> include_endr<64><00> start_idx<64>end_idx<64> subtokens<6E>grprjrrr<00> group_tokens3s 
  zTokenList.group_tokenscCs,t|t<01>s
|<00>|<01>}||_|j<04>||<02>dS)zInserts *token* before *where*.N)rVr<>r<>r-r<00>insert)r<00>whererjrrr<00> insert_beforeQs

zTokenList.insert_beforecCsVt|t<01>s
|<00>|<01>}|j||d<01>\}}||_|dur"|j<05>|<02>dS|j<05>||<02>dS)zInserts *token* after *where*.<2E>r<>N)rVr<>r<>r<>r-r<00>appendr<64>)rr<>rjr<><00>nidx<64>next_rrr<00> insert_afterXs

zTokenList.insert_aftercCs |<00><00>duS)z(Returns ``True`` if an alias is present.N)r%r8rrr<00> has_aliascs zTokenList.has_aliascC<00>dS)rNrr8rrrr%g<00>zTokenList.get_aliascCs|<00><00>p|<00><01>S)aReturns the name of this identifier.
This is either it's alias or it's real name. The returned valued can
be considered as the name under which the object corresponding to
this identifier is known within the current statement.
)r%rr8rrr<00>get_namekszTokenList.get_namecCr<>)rNrr8rrrrtr<>zTokenList.get_real_namecCs:|jtjdfd<02>\}}|<00>|<01>\}}|durt|j<05>SdS)ztReturn name of the parent object if any.
A parent object is identified by the first occurring dot.
rr N)r r rr<>rr+)rrr<00>prev_rrr<00>get_parent_namexszTokenList.get_parent_namecCs<>|r |j|d<01>n|j}|rt|<05>n|}tjtjtjjg}|r%|<06>tj<08>|D]#}|j |vr5t
|j <0B>St |t tf<02>rJ|rD|<07><0F>S|<07><10>Sq'dS)z/Returns the name of the first token with a nameN)r<00>reversedr <00>Name<6D>Wildcard<72>String<6E>Symbolr<6C>rr,rr+rV<00>
Identifier<EFBFBD>Functionrr<>)rr<>rrr r<00>typesrjrrrr<00>s 
<02><04>zTokenList._get_first_namer6)NrNrp)rNF)TF)NNNrFN)TFF)r)T)NFFF)"r&r'r(r)rfr4r9rsrvr=r{r<>rNr<><00>propertyr<79>r<>r<>r r<>r<>r<>r<>r<>r<>r<>r<>r<>r%r<>rr<>r<00> __classcell__rrrnrrg<00>sF
  






<EFBFBD>
   <12>rgc@<00>eZdZdZdd<03>ZdS)<05> StatementzRepresents a SQL statement.cCs<>|jdd<02>}|dur dS|jtjjtjjfvr|jS|jtjjkrM|<00>|<01>}|j |dd<05>\}}t
|t t f<02>rM|j |dd<05>\}}|durM|jtjjkrM|jSdS)aMReturns the type of a statement.
The returned value is a string holding an upper-cased reprint of
the first DML or DDL keyword. If the first token in this group
isn't a DML or DDL keyword "UNKNOWN" is returned.
Whitespaces and comments at the beginning of the statement
are ignored.
T)r<>N<>UNKNOWNr<4E>) r<>r,r r<00>DML<4D>DDLr.<00>CTEr<45>r<>rVr<><00>IdentifierList)r<00> first_token<65>fidx<64>tidxrjr<00> dml_keywordrrr<00>get_type<70>s

 <02>zStatement.get_typeN)r&r'r(r)r<>rrrrr<><00><00> r<>c@s0eZdZdZdd<03>Zdd<05>Zdd<07>Zdd <09>Zd
S) r<>zNRepresents an identifier.
Identifiers may have aliases or typecasts.
cCs|jtjd<01>\}}|duS)z7Return ``True`` if this identifier contains a wildcard.rN)r r r<>)rrrjrrr<00> is_wildcard<72>szIdentifier.is_wildcardcCs6|jtjdfd<02>\}}|j|dd<04>\}}|r|jSdS)z<Returns the typecast or ``None`` of this object as a string.z::r Fr<46>N)r r rr<>r+)r<00>midx<64>markerr<72>r<>rrr<00> get_typecast<73>szIdentifier.get_typecastcCs"|jtjjd<01>\}}|r|jSdS)z5Returns the ordering or ``None`` as uppercase string.rN)r r r<00>Orderr.)rr<00>orderingrrr<00> get_ordering<6E>szIdentifier.get_orderingccs,<00>|jD]}t|t<02>r|jdd<02>VqdS)z(Returns an iterator of index token listsrrFN)rrV<00>SquareBracketsr<73>rrr<00>get_array_indices<65>s <02>

<02><04>zIdentifier.get_array_indicesN)r&r'r(r)r<>r<>r<>r<>rrrrr<><00>s  r<>c@r<>)r<>z.A list of :class:`~sqlparse.sql.Identifier`'s.ccs,<00>|jD]}|js|<01>tjd<01>s|VqdS)zkReturns the identifiers.
Whitespaces and punctuations are not included in this generator.
<20>,N)rr1r]r rr<>rrr<00>get_identifiers<72>s <02>
<02><04>zIdentifierList.get_identifiersN)r&r'r(r)r<>rrrrr<><00>r<>r<>c@s<eZdZdZejjdfejdfgZej j
dfZ ejdfZ dS)<05> TypedLiteralzEA typed literal, such as "date '2001-09-28'" or "interval '2 hours'".N<> TIMESTAMP)<06>DAY<41>HOUR<55>MINUTE<54>MONTH<54>SECOND<4E>YEAR) r&r'r(r)r r<><00>Builtinr<00>M_OPENr<4E><00>Single<6C>M_CLOSE<53>M_EXTENDrrrrr<><00>s
 r<>c@<00>0eZdZdZejdfZejdfZedd<05><00>Z dS)<07> ParenthesiszTokens between parenthesis.<2E>(<28>)cC<00>|jdd<02>S<00>NrrFrr8rrrr<><00><00>zParenthesis._groupable_tokensN<73>
r&r'r(r)r rr<>r<>r<>r<>rrrrr<><00><00> 

r<>c@r<>)r<>zTokens between square brackets<74>[<5B>]cCr<>r<>rr8rrrr<><00>r<>z SquareBrackets._groupable_tokensNr<4E>rrrrr<><00>r<>r<>c@<00>eZdZdZdS)<03>
Assignmentz An assignment like 'var := val;'N<>r&r'r(r)rrrrr<><00>r<>c@<00>$eZdZdZejdfZejdfZdS)<05>Ifz7An 'if' clause with possible 'else if' or 'else' parts.<2E>IFzEND IFN<46>r&r'r(r)r rr<>r<>rrrrr<00>
rc@r)<05>Forz A 'FOR' loop.)<02>FOR<4F>FOREACHzEND LOOPNrrrrrr rrc@s(eZdZdZedd<03><00>Zedd<05><00>ZdS)<07>
Comparisonz/A comparison used for example in WHERE clauses.cC<00>
|jdS<00>Nrrr8rrr<00>leftrczComparison.leftcCr )NrFrr8rrr<00>rightrczComparison.rightN)r&r'r(r)r<>r rrrrrr
s 
r
c@r<>)r<>z
A comment.cCs|jo |jdjtjjkSr )rr,r r<><00> Multiliner8rrr<00> is_multiline szComment.is_multilineN)r&r'r(r)rrrrrr<>r<>r<>c@r)<05>WherezA WHERE clause.<2E>WHERE) <09>ORDER BYzGROUP BY<42>LIMIT<49>UNIONz UNION ALL<4C>EXCEPT<50>HAVING<4E> RETURNING<4E>INTONrrrrrr$rrc@r)<05>HavingzA HAVING clause.r)rrNrrrrrr,rrc@s.eZdZdZejdfZejdfZddd<06>ZdS) <09>CasezAA CASE statement with one or more WHEN and possibly an ELSE part.<2E>CASE<53>ENDFcCs<>d}d}g}|}|jD]n}|<06>tjd<03>rq |r|jtjvrq |<06>tjd<04>r/|<04>ggf<02>|}n$|<06>tjd<05>r9|}n|<06>tjd<06>rJ|<04>dgf<02>|}n |<06>tjd<08>rSd}|r^|s^|<04>ggf<02>||krl|d d
<00>|<06>q ||kry|d d<00>|<06>q |S) zeReturns a list of 2-tuples (condition, value).
If an ELSE exists condition is None.
rrr<00>WHEN<45>THEN<45>ELSENrrFr)rr]r rr,r r<>)rr<><00> CONDITION<4F>VALUE<55>ret<65>moderjrrr<00> get_cases7s6
<02>zCase.get_casesNre) r&r'r(r)r rr<>r<>r%rrrrr2s


rc@r<>)r<>zA function or procedure call.cCsN|jd}|jD]}t|t<02>r|<02><03>St|ttftjd<02>r$|gSqgS)zReturn a list of parameters.rF)r<>r) rrVr<>r<>rr<>r<>r <00>Literal)r<00> parenthesisrjrrr<00>get_parametersjs


 
<02>zFunction.get_parametersN)r&r'r(r)r(rrrrr<>gr<>r<>c@r)<05>BeginzA BEGIN/END block.<2E>BEGINrNrrrrrr)urr)c@r<>)<03> OperationzGrouping of operationsNrrrrrr+{rr+c@r<>)<03>ValueszGrouping of valuesNrrrrrr,rr,c@r<>)<03>CommandzGrouping of CLI commands.Nrrrrrr-<00>rr-)r)rK<00>sqlparserr <00>sqlparse.utilsrrrr*rgr<>r<>r<>r<>r<>r<>r<>rrr
r<>rrrr<>r)r+r,r-rrrr<00><module>s6 n' 

 5