Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips
System : Linux server1.richineiserver.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : fdshops ( 1003)
PHP Version : 8.2.21
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/libfuturize/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/libfuturize/fixer_util.pyo
�
,�]c@s�dZddlmZmZmZmZmZmZddlm	Z	m
Z
ddlmZ
mZddlmZddlm
Z
mZmZm
Z
mZmZddlZd�Zdd	�Zdd
�Zdd�Zd�Zd
�Zd�Zd�Zddd�Ze
je
je
j e
j!e
j"fZ#e
j$e
j%fZ&d�Z'dd�Z(d�Z)d�Z*d�Z+d�Z,d�Z-d�Z.d�Z/dZ0dZ1d�Z2d�Z3dd�Z4dS(s�
Utility functions from 2to3, 3to2 and python-modernize (and some home-grown
ones).

Licences:
2to3: PSF License v2
3to2: Apache Software License (from 3to2/setup.py)
python-modernize licence: BSD (from python-modernize/LICENSE)
i����(t
FromImporttNewlinet	is_importt	find_roottdoes_tree_importtComma(tLeaftNode(tpython_symbolstpython_grammar(ttoken(RtCalltNametsymsRtNumberNcCs�d|kr|S|jd�r,|d}ng|D]$}|jdj|��r3|^q3}t|�dkr�tddjd�|D����n!t|�d	kr�td
��n|d	SdS(sl
    Examples:
    >>> canonical_fix_name('fix_wrap_text_literals')
    'libfuturize.fixes.fix_wrap_text_literals'
    >>> canonical_fix_name('wrap_text_literals')
    'libfuturize.fixes.fix_wrap_text_literals'
    >>> canonical_fix_name('wrap_te')
    ValueError("unknown fixer name")
    >>> canonical_fix_name('wrap')
    ValueError("ambiguous fixer name")
    s.fix_tfix_isfix_{0}isOAmbiguous fixer name. Choose a fully qualified module name instead from these:
s
css|]}d|VqdS(s  N((t.0tmyf((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pys	<genexpr>-sis1Unknown fixer. Use --list-fixes or -l for a list.N(t
startswithtendswithtformattlent
ValueErrortjoin(tfixtavail_fixestftfound((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pytcanonical_fix_names

$ cCsttjdd|�S(Nu*tprefix(RR
tSTAR(R((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pytStar6scCsttjdd|�S(Nu**R(RR
t
DOUBLESTAR(R((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pyt
DoubleStar9scCsttjdd|�S(Nu-R(RR
tMINUS(R((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pytMinus<scCs?g}x+|D]#}|j|�|jt��q
W|d=|S(s{
    Accepts/turns: (Name, Name, ..., Name, Name)
    Returns/into: (Name, Comma, Name, Comma, ..., Name, Comma, Name)
    i����(tappendR(tleafst	new_leafstleaf((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pyt	commatize?s

cCs�x1|jdk	r3|jjtjkr3|j}qW|jdkrGdS|jtjkr`|jS|jdk	r�|jjtjkr�|jjS|jdkr�dS|j	SdS(sf
    Returns the indentation for this node
    Iff a node is in a suite, then it has indentation.
    uN(
tparenttNonettypeR
tsuiteR
tINDENTtvaluetprev_siblingR(tnode((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pytindentationKs'
$
cCs@t|�}td�|j�D��}|s2dSt|�SdS(s
    Dirty little trick to get the difference between each indentation level
    Implemented by finding the shortest indentation string
    (technically, the "least" of all of the indentation strings, but
    tabs and spaces mixed won't get this far, so those are synonymous.)
    css*|] }|jtjkr|jVqdS(N(R+R
R-R.(Rti((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pys	<genexpr>isu    N(Rtsett	pre_ordertmin(R0trtall_indents((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pytindentation_step`s
cCs�x'|jD]}|jtjkr
dSq
Wx?t|j�D]"\}}|jtjkr:Pq:q:Wtd��ttjt	�t
tjt|�t
|��g�}|j|d}|j�d|_|j|�|j|�dS(sj
    Turn the stuff after the first colon in parent's children
    into a suite, if it wasn't already
    NuNo class suite and no ':'!iu(tchildrenR+R
R,t	enumerateR
tCOLONRRRRR-R1R8tremoveRtappend_child(R)R0R2R,tone_node((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pytsuitifyps7
	
cCsw|dkrd}ntdd|�|g}|dk	rg|jtddd�t|dd�g�nttj|�S(s�
    Accepts a package (Name node), name to import it as (string), and
    optional prefix and returns a node:
    import <package> [as <as_name>]
    uuimportRuasu N(R*RtextendRR
timport_name(tpackagetas_nameRR9((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pyt
NameImport�s	ccsZ|j}xC|jtjkrN|j}|jtjkr=Pn|V|j}qW|j}|j}x|dk	r�|V|j}qdW|j}|jtkr�|}x$|jdk	r�|jV|j}q�W|j}n|j}|dkr�dSxg|jtkrU|jtj	kr|Vn|j}|dkr�|j}|j}|dkrRPqRq�q�WdS(s�
    Generator yields all nodes for which a node (an import_stmt) has scope
    The purpose of this is for a call to _find() on each of them
    N(
tnext_siblingR+R
tSEMItNEWLINER)R*t_compound_stmtsR
R,(R0ttesttnxtR)tcontexttctp((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pytimport_binding_scope�s>		
		
	
				cCsgt|�}tddd�}t|dd�}ttj|||g�}|dk	rc||_n|S(NuasRu (RRR
timport_as_nameR*R(tnameRCRtnew_nametnew_astnew_as_nametnew_node((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pytImportAsName�scCs>|jtjko=t|j�dko=|jdjtjkS(s<
    Returns True if the node appears to be a docstring
    i(R+R
tsimple_stmtRR9R
tSTRING(R0((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pytis_docstring�scCs2t|�}td||�r"dSd}xvt|j�D]e\}}t|�s\t|�re|}nt|�rwq8nt|�}|s�Pn||kr8dSq8Wt	dt
tj|dd�g�}|dkr|dkr|jdj
|_
d|jd_
n|t�g}|j|ttj|��dS(s
    This seems to work
    u
__future__NRt iu(RRR*R:R9tis_shebang_commenttis_encoding_commentRXtcheck_future_importRRR
tNAMERRtinsert_childRR
RV(tfeatureR0troottshebang_encoding_idxtidxtnamestimport_R9((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pyt
future_import�s(	$c	Cs6t|�}td||�r"dSd}x_t|j�D]N\}}|jtjkr8|jr8|jdjtjkr8|d}Pq8q8WxP|j|D];}|jtj	kr�|d7}q�n|j
}d|_
Pq�Wd}tdttj
|dd�g�}|t�g}|j|ttj|d|��dS(sD
    An alternative to future_import() which might not work ...
    u
__future__NiiuRu (RRR:R9R+R
RVR
RWRGRRRR]RR^R(	R_R0R`t
insert_posRbtthing_afterRRdR9((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pytfuture_import2s(

		$cCs�g|D]}|jtjkr|^q}tg|D]}|df^q5�}x}t|�D]o\}}|jtjkr�|jdjtj	kr�|jdj
}|jd||<q]||}|||<q]W|S(u/
    Parse a list of arguments into a dict
    iiiN(R+R
tCOMMAtdictR*R:R
targumentR9tEQUALR.(targlisttschemeR2tktret_mappingtargtslot((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pyt
parse_args.s+%+
cCs,|jtjko+|jo+t|jd�S(Ni(R+R
RVR9R(R0((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pytis_import_stmtHscCs�t|�}t|||�r"dSt}x6ddddgD]"}td||�r;t}Pq;q;W|r�d\}}xot|j�D]^\}}t|�r�|}|}	x3|r�|j}|	d7}	t|�s�|	}Pq�q�WPq�q�W|}
nLxCt|j�D]2\}}|j	t
jkr Pnt|�s�Pq�q�W|}
|dkrt
t
jttjd�ttj|d	d
�g�}n�t|ttj|d	d
�g�}|dkrKt
t
jt
t
jttjd�t
t
jttjd�ttjd
�g�t
t
jttjd�ttjd�g�g�g�}|t�g}
ng}
|t�g}|j|
j}d|j|
_|j|
t
t
j|d	|��t|
�dkr�|j|
dt
t
j|
��ndS(s�Works like `does_tree_import` but adds an import statement at the
    top if it was not imported (but below any __future__ imports) and below any
    comments such as shebang lines).

    Based on lib2to3.fixer_util.touch_import()

    Calling this multiple times adds the imports in reverse order.

    Also adds "standard_library.install_aliases()" after "from future import
    standard_library".  This should probably be factored into another function.
    Ntabsolute_importtdivisiontprint_functiontunicode_literalst
__future__iuimportRu ustandard_libraryu.uinstall_aliasesu(u)ui(NN(RRtFalsetTrueR*R:R9R\RER+R
RVRXRRARR
R]RtpowerttrailertDOTtLPARtRPARRRR^R(RBtname_to_importR0R`RRPtstarttendRbtidx2RfRdt
install_hookstchildren_hookstchildren_importt
old_prefix((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pyttouch_import_topMsd

		
		!$		$"cCs�|}|jtjko|js(t�S|jd}|jtjkopt|jdd�op|jdjdkszt�S|jdjtj	kr�|jd}n
|jd}|jtj
kr:t�}xh|jD]]}|jtjkr|j|j�q�|jtj
kr�|jd}|j|j�q�q�W|S|jtj
kri|jd}t|jg�S|jtjkr�t|jg�SdS(sZIf this is a future import, return set of symbols that are imported,
    else return None.iiR.u
__future__iiN(R+R
RVR9R3timport_fromthasattrR.R
Rtimport_as_namesR]taddRO(R0tsavenodetresulttn((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pyR\�s4

	

s^#!.*pythons^#.*coding[:=]\s*([-\w.]+)cCsttjt|j��S(s�
    Comments are prefixes for Leaf nodes. Returns whether the given node has a
    prefix that looks like a shebang line or an encoding line:

        #!/usr/bin/env python
        #!/usr/bin/python3
    (tbooltretmatcht
SHEBANG_REGEXR(R0((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pyRZ�scCsttjt|j��S(s
    Comments are prefixes for Leaf nodes. Returns whether the given node has a
    prefix that looks like an encoding line:

        # coding: utf-8
        # encoding: utf-8
        # -*- coding: <encoding name> -*-
        # vim: set fileencoding=<encoding name> :
    (R�R�R�tENCODING_REGEXR(R0((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pyR[�s
cCsRt|�dkr3|\}}|t�|g}n|}tt|�|d|�S(s�
    Example:
    >>> wrap_in_fn_call("oldstr", (arg,))
    oldstr(arg)

    >>> wrap_in_fn_call("olddiv", (arg1, arg2))
    olddiv(arg1, arg2)

    >>> wrap_in_fn_call("olddiv", [arg1, comma, arg2, comma, arg3])
    olddiv(arg1, arg2, arg3)
    iR(RRRR(tfn_nametargsRtexpr1texpr2tnewargs((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pytwrap_in_fn_call�s

(5t__doc__tlib2to3.fixer_utilRRRRRRtlib2to3.pytreeRRtlib2to3.pygramRR
R	R
RRRR�RR*RR!R#R(R1R8R?RDtif_stmtt
while_stmttfor_stmtttry_stmtt	with_stmtRHRAR�t
_import_stmtsRNRURXReRhRsRtR�R\R�R�RZR[R�(((s:/usr/lib/python2.7/site-packages/libfuturize/fixer_util.pyt<module>	s>..	"				$	;
		(	 			c	*		

Spamworldpro Mini