uawdijnntqw1x1x1
IP : 3.146.255.135
Hostname : host45.registrar-servers.com
Kernel : Linux host45.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
jackpotjunglegam
/
..
/
..
/
lib64
/
python2.7
/
ensurepip
/
..
/
site-packages
/
..
/
lib2to3
/
refactor.pyc
/
/
� {fc@�s�dZddlmZdZddlZddlZddlZddlZddlZddl Z ddl Z ddlmZddl mZmZmZddlmZdd lmZmZdd lmZddlmZed�Zd efd��YZd�Zd�Zd�Z d�Z!ej"ddfkrgddl#Z#e#j$Z%d�Z&d�Z'ne$Z%e!Z&e!Z'd�Z(defd��YZ)de*fd��YZ+defd��YZ,de+fd��YZ-dS( s�Refactoring framework. Used as a main program, this can refactor any number of files and/or recursively descend down directories. Imported as a module, this provides infrastructure to write your own refactoring tool. i����(twith_statements#Guido van Rossum <guido@python.org>N(tchaini(tdriverttokenizettoken(t find_root(tpytreetpygram(t btm_utils(tbtm_matchercC�szt|ggdg�}g}xUtj|j�D]A\}}}|jd�r1|rb|d}n|j|�q1q1W|S(sEReturn a sorted list of all available fix names in the given package.t*tfix_i(t __import__tpkgutiltiter_modulest__path__t startswithtappend(t fixer_pkgt remove_prefixtpkgt fix_namestfindertnametispkg((s(/usr/lib64/python2.7/lib2to3/refactor.pytget_all_fix_names"s" t _EveryNodecB�seZRS((t__name__t __module__(((s(/usr/lib64/python2.7/lib2to3/refactor.pyR.scC�s�t|tjtjf�rC|jdkr3t�nt|jg�St|tj�rt|j rkt |j �St�nt|tj�r�t�}x5|j D]*}x!|D]}|jt |��q�Wq�W|St d|��dS(sf Accepts a pytree Pattern Node and returns a set of the pattern types which will match first. s$Oh no! I don't understand pattern %sN(t isinstanceRtNodePatterntLeafPatternttypetNoneRtsettNegatedPatterntcontentt_get_head_typestWildcardPatterntupdatet Exception(tpattrtptx((s(/usr/lib64/python2.7/lib2to3/refactor.pyR%2s cC�stjt�}g}x�|D]�}|jr�yt|j�}Wntk r^|j|�q�XxU|D]}||j|�qfWq|jdk r�||jj|�q|j|�qWx:t t jjj �t jj�D]}||j|�q�Wt|�S(s^ Accepts a list of fixers and returns a dictionary of head node type --> fixer list. N(tcollectionstdefaultdicttlisttpatternR%RRt_accept_typeR!RRtpython_grammart symbol2numbert itervaluesttokenstextendtdict(t fixer_listt head_nodesteverytfixertheadst node_type((s(/usr/lib64/python2.7/lib2to3/refactor.pyt_get_headnode_dictNs" cC�s(gt|t�D]}|d|^qS(sN Return the fully qualified names for fixers in the package pkg_name. t.(RtFalse(tpkg_nametfix_name((s(/usr/lib64/python2.7/lib2to3/refactor.pytget_fixers_from_packagegscC�s|S(N((tobj((s(/usr/lib64/python2.7/lib2to3/refactor.pyt _identitynsiicC�s|jdd�S(Nu u (treplace(tinput((s(/usr/lib64/python2.7/lib2to3/refactor.pyt_from_system_newlinesuscC�s*tjdkr"|jdtj�S|SdS(Ns u (tostlinesepRF(RG((s(/usr/lib64/python2.7/lib2to3/refactor.pyt_to_system_newlineswsc�s�t}tjtj|�j���fd�}ttjtjtj f�}t �}ykxdtr�|�\}}||kr�q]q]|tjkr�|r�Pnt}q]|tj kr�|dkr�|�\}}|tj ks�|dkr�Pn|�\}}|tj ks|dkrPn|�\}}|tjkrY|dkrY|�\}}nxa|tj kr�|j|�|�\}}|tjks�|dkr�Pn|�\}}q\Wq]Pq]WWntk r�nXt|�S(Nc�s�j�}|d|dfS(Nii(tnext(ttok(tgen(s(/usr/lib64/python2.7/lib2to3/refactor.pytadvance�sufromu __future__uimportu(u,(R@Rtgenerate_tokenstStringIOtreadlinet frozensetRtNEWLINEtNLtCOMMENTR"tTruetSTRINGtNAMEtOPtaddt StopIteration(tsourcethave_docstringROtignoretfeaturesttptvalue((RNs(/usr/lib64/python2.7/lib2to3/refactor.pyt_detect_future_features�sD t FixerErrorcB�seZdZRS(sA fixer could not be loaded.(RRt__doc__(((s(/usr/lib64/python2.7/lib2to3/refactor.pyRd�stRefactoringToolcB�s!eZied6ed6ZdZdZddd�Zd�Zd�Z d�Z d�Zd �Zeed �Z eed�Zd�Zeed �Zd�Zed�Zd�Zd�Zdedd�Zdd�ZdZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(tprint_functiontwrite_unchanged_filestFixRcC�s�||_|pg|_|jj�|_|dk rI|jj|�n|jdretj|_ ntj |_ |jjd�|_g|_ tjd�|_g|_t|_tj|j dtjd|j�|_|j�\|_|_g|_tj�|_g|_g|_ x}t!|j|j�D]f}|j"rT|jj#|�q2||jkrv|jj$|�q2||jkr2|j j$|�q2q2Wt%|j�|_&t%|j �|_'dS(s�Initializer. Args: fixer_names: a list of fixers to import options: a dict with configuration. explicit: a list of fixers to run even if they are explicit. RgRhRftconverttloggerN((tfixerstexplicitt_default_optionstcopytoptionsR!R'Rt!python_grammar_no_print_statementtgrammarR2tgetRhterrorstloggingt getLoggerRkt fixer_logR@twroteRtDriverRRjt get_fixerst pre_ordert post_ordertfilestbmt BottomMatchertBMt bmi_pre_ordertbmi_post_orderRt BM_compatiblet add_fixerRR>tbmi_pre_order_headstbmi_post_order_heads(tselftfixer_namesRpRmR;((s(/usr/lib64/python2.7/lib2to3/refactor.pyt__init__�s< cC�s�g}g}x�|jD]�}t|iidg�}|jdd�d}|j|j�rr|t|j�}n|jd�}|jdjg|D]}|j �^q��}yt ||�} Wn'tk r�td||f��nX| |j |j�} | jr?|jtk r?||jkr?|jd|�qn|jd |�| jd krn|j| �q| jdkr�|j| �qtd| j��qWtjd �}|jd|�|jd|�||fS(sInspects the options to load the requested patterns and handlers. Returns: (pre_order, post_order), where pre_order is the list of fixers that want a pre-order AST traversal, and post_order is the list that want post-order traversal. R R?ii����t_tsCan't find %s.%ssSkipping optional fixer: %ssAdding transformation: %stpretpostsIllegal fixer order: %rt run_ordertkey(RlRtrsplitRtFILE_PREFIXtlentsplittCLASS_PREFIXtjointtitletgetattrtAttributeErrorRdRpRwRmRWtlog_messaget log_debugtorderRtoperatort attrgettertsort(R�tpre_order_fixerstpost_order_fixerstfix_mod_pathtmodRBtpartsR+t class_namet fix_classR;tkey_func((s(/usr/lib64/python2.7/lib2to3/refactor.pyRz�s8/ cO�s�dS(sCalled when an error occurs.N((R�tmsgtargstkwds((s(/usr/lib64/python2.7/lib2to3/refactor.pyt log_errorscG�s'|r||}n|jj|�dS(sHook to log a message.N(Rktinfo(R�R�R�((s(/usr/lib64/python2.7/lib2to3/refactor.pyR�s cG�s'|r||}n|jj|�dS(N(Rktdebug(R�R�R�((s(/usr/lib64/python2.7/lib2to3/refactor.pyR�s cC�sdS(sTCalled with the old version, new version, and filename of a refactored file.N((R�told_texttnew_texttfilenametequal((s(/usr/lib64/python2.7/lib2to3/refactor.pytprint_output!scC�sPxI|D]A}tjj|�r5|j|||�q|j|||�qWdS(s)Refactor a list of files and directories.N(RItpathtisdirtrefactor_dirt refactor_file(R�titemstwritet doctests_onlytdir_or_file((s(/usr/lib64/python2.7/lib2to3/refactor.pytrefactor&s cC�s�tjd}x�tj|�D]�\}}}|jd|�|j�|j�xe|D]]}|jd�rWtjj|�d|krWtjj||�} |j | ||�qWqWWg|D]} | jd�s�| ^q�|(qWdS(s�Descends down a directory and refactor every Python file found. Python files are assumed to have a .py extension. Files and subdirectories starting with '.' are skipped. tpysDescending into %sR?iN( RItextseptwalkR�R�RR�tsplitextR�R�(R�tdir_nameR�R�tpy_exttdirpathtdirnamest filenamesRtfullnametdn((s(/usr/lib64/python2.7/lib2to3/refactor.pyR�/s cC�s�yt|d�}Wn'tk r<}|jd||�dSXztj|j�d}Wd|j�Xt|dd|��}t |j ��|fSWdQXdS(sG Do our best to decode a Python source file correctly. trbsCan't open %s: %siNR*tencoding(NN(topentIOErrorR�R!Rtdetect_encodingRRtcloset_open_with_encodingRHtread(R�R�tfterrR�((s(/usr/lib64/python2.7/lib2to3/refactor.pyt_read_python_sourceCscC�s|j|�\}}|dkr%dS|d7}|r�|jd|�|j||�}|jsl||kr�|j|||||�q�|jd|�nc|j||�}|js�|r�|jr�|jt|�d |d|d|�n|jd|�dS( sRefactors a file.Nu sRefactoring doctests in %ssNo doctest changes in %si����R�R�sNo changes in %s( R�R!R�trefactor_docstringRhtprocessed_filetrefactor_stringtwas_changedtunicode(R�R�R�R�RGR�toutputttree((s(/usr/lib64/python2.7/lib2to3/refactor.pyR�Ss cC�s�t|�}d|kr*tj|j_nzMy|jj|�}Wn0tk ru}|jd||jj |�dSXWd|j|j_X||_ |jd|�|j||�|S(sFRefactor a given input string. Args: data: a string holding the code to be refactored. name: a human-readable name for use in error/log messages. Returns: An AST corresponding to the refactored input stream; None if there were errors during the parse. RgsCan't parse %s: %s: %sNsRefactoring %s( RcRRqRRrtparse_stringR(R�t __class__Rtfuture_featuresR�t refactor_tree(R�tdataRR`R�R�((s(/usr/lib64/python2.7/lib2to3/refactor.pyR�js cC�s�tjj�}|ro|jd�|j|d�}|jsI||kr_|j|d|�q�|jd�nS|j|d�}|js�|r�|jr�|jt |�d|�n |jd�dS(NsRefactoring doctests in stdins<stdin>sNo doctest changes in stdinsNo changes in stdin( tsyststdinR�R�R�RhR�R�R�R�(R�R�RGR�R�((s(/usr/lib64/python2.7/lib2to3/refactor.pytrefactor_stdin�s c C�s�x-t|j|j�D]}|j||�qW|j|j|j��|j|j|j��|jj|j ��}x�t |j��rcx�|jjD]�}||kr�||r�||j dtjjdt�|jr�||j dtjj�nx[t||�D]F}|||kr9||j|�nyt|�Wntk r]qnX|jr|||jkr|qn|j|�}|r|j||�}|dk rU|j|�x9|j�D]+}|js�g|_n|jj|�q�W|jj|j ��}x?|D]4} | |kr6g|| <n|| j|| �qWqUqqWq�q�Wq}Wx-t|j|j�D]}|j||�qzW|j S(s�Refactors a parse tree (modifying the tree in place). For compatible patterns the bottom matcher module is used. Otherwise the tree is traversed node-to-node for matches. Args: tree: a pytree.Node instance representing the root of the tree to be refactored. name: a human-readable name for this tree. Returns: True if the tree was modified, False otherwise. R�treverseN(!RR{R|t start_treettraverse_byR�R�R�truntleavestanytvaluesRlR�RtBasetdepthRWtkeep_line_ordert get_linenoR/tremoveRt ValueErrortfixers_appliedtmatcht transformR!RFRR6tfinish_treeR�( R�R�RR;t match_settnodetresultstnewtnew_matchestfxr((s(/usr/lib64/python2.7/lib2to3/refactor.pyR��sJ .cC�s�|s dSxr|D]j}xa||jD]R}|j|�}|r%|j||�}|dk rw|j|�|}qwq%q%WqWdS(sTraverse an AST, applying a set of fixers to each node. This is a helper method for refactor_tree(). Args: fixers: a list of fixer instances. traversal: a generator that yields AST nodes. Returns: None N(R R�R�R!RF(R�Rlt traversalR�R;R�R�((s(/usr/lib64/python2.7/lib2to3/refactor.pyR��s cC�s�|jj|�|dkrB|j|�d}|dkrBdSn||k}|j||||�|r�|jd|�|js�dSn|r�|j||||�n|jd|�dS(sR Called when a file has been refactored and there may be changes. iNsNo changes to %ssNot writing changes to %s(R}RR!R�R�R�Rht write_file(R�R�R�R�R�R�R�((s(/usr/lib64/python2.7/lib2to3/refactor.pyR��s cC�s�yt|dd|�}Wn*tjk rE}|jd||�dSXzGy|jt|��Wn)tjk r�}|jd||�nXWd|j�X|jd|�t|_ dS(s�Writes a string to a file. It first shows a unified diff between the old text and the new text, and then rewrites the file; the latter is only done if the write option is set. twR�sCan't create %s: %sNsCan't write %s: %ssWrote changes to %s( R�RIterrorR�R�RKR�R�RWRx(R�R�R�R�R�R�R�((s(/usr/lib64/python2.7/lib2to3/refactor.pyR�ss>>> s... c C�s�g}d}d}d}d}x+|jt�D]}|d7}|j�j|j�r�|dk r�|j|j||||��n|}|g}|j|j�} || }q.|dk r|j||j �s�|||j j �dkr|j|�q.|dk r/|j|j||||��nd}d}|j|�q.W|dk rz|j|j||||��ndj|�S(s�Refactors a docstring, looking for doctests. This returns a modified version of the input string. It looks for doctests, which start with a ">>>" prompt, and may be continued with "..." prompts, as long as the "..." is indented the same as the ">>>". (Unfortunately we can't use the doctest module's parser, since, like most parsers, it is not geared towards preserving the original source.) iiu uN( R!t splitlinesRWtlstripRtPS1R6trefactor_doctesttfindtPS2trstripRR�( R�RGR�tresulttblocktblock_linenotindenttlinenotlineti((s(/usr/lib64/python2.7/lib2to3/refactor.pyR�(s: c C�ssy|j|||�}Wnutk r�}|jjtj�rmx*|D]}|jd|jd��qGWn|jd|||j j |�|SX|j||�rot|�j t�}||d ||d} }| dg|dks�t| ��|djd�s|dcd7<n||j|jd�g}|ro|g|D]}||j|^qK7}qon|S(s�Refactors one doctest. A doctest is given as a block of lines, the first of which starts with ">>>" (possibly indented), while the remaining lines start with "..." (identically indented). s Source: %su s+Can't parse docstring in %s line %s: %s: %sii����i(tparse_blockR(RktisEnabledForRutDEBUGR�RR�R�RR�R�R�RWtAssertionErrortendswithR�tpopR( R�RRRR�R�R�RR�tclipped((s(/usr/lib64/python2.7/lib2to3/refactor.pyR�Ss& #.cC�s|jrd}nd}|js4|jd|�n1|jd|�x|jD]}|j|�qNW|jr�|jd�x!|jD]}|j|�q�Wn|jrt|j�dkr�|jd�n|jdt|j��x0|jD]"\}}}|j|||�q�WndS( Ntweres need to besNo files %s modified.sFiles that %s modified:s$Warnings/messages while refactoring:isThere was 1 error:sThere were %d errors:(RxR}R�RwRtR�(R�RtfiletmessageR�R�R�((s(/usr/lib64/python2.7/lib2to3/refactor.pyt summarizeps$ cC�s1|jj|j|||��}t�|_|S(s�Parses a block into a tree. This is necessary to get correct line number / offset information in the parser diagnostics and embedded into the parse tree. (Rtparse_tokenst wrap_toksRSR�(R�RRRR�((s(/usr/lib64/python2.7/lib2to3/refactor.pyR �s!cc�s�tj|j||�j�}xe|D]]\}}\}}\} } }||d7}| |d7} ||||f| | f|fVq%WdS(s;Wraps a tokenize stream to systematically modify start/end.iN(RRPt gen_linesRL(R�RRRR5R Rbtline0tcol0tline1tcol1t line_text((s(/usr/lib64/python2.7/lib2to3/refactor.pyR�s (cc�s�||j}||j}|}xi|D]a}|j|�rN|t|�Vn4||j�dkrldVntd||f��|}q'Wxtr�dVq�WdS(s�Generates lines as expected by tokenize from a list of lines. This strips the first len(indent + self.PS1) characters off each line. u sline=%r, prefix=%rR�N(R�RRR�RRRW(R�RRtprefix1tprefix2tprefixR((s(/usr/lib64/python2.7/lib2to3/refactor.pyR�s N(RRR@RnR�R�R!R�RzR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�RR�R�RR RR(((s(/usr/lib64/python2.7/lib2to3/refactor.pyRf�s: 4 ( O + tMultiprocessingUnsupportedcB�seZRS((RR(((s(/usr/lib64/python2.7/lib2to3/refactor.pyR�stMultiprocessRefactoringToolcB�s5eZd�Zeedd�Zd�Zd�ZRS(cO�s/tt|�j||�d|_d|_dS(N(tsuperR R�R!tqueuetoutput_lock(R�R�tkwargs((s(/usr/lib64/python2.7/lib2to3/refactor.pyR��s ic C�sf|dkr(tt|�j|||�Syddl}Wntk rQt�nX|jdk rptd��n|j �|_|j �|_gt|�D]}|j d|j�^q�}z;x|D]}|j�q�Wtt|�j|||�Wd|jj�x$t|�D]}|jjd�qWx'|D]}|j�r5|j�q5q5Wd|_XdS(Nii����s already doing multiple processesttarget(R!R R�tmultiprocessingtImportErrorRR"R!tRuntimeErrort JoinableQueuetLockR#txrangetProcesst_childtstartR�tputtis_alive( R�R�R�R�t num_processesR&Rt processesR+((s(/usr/lib64/python2.7/lib2to3/refactor.pyR��s2 + cC�so|jj�}xY|dk rj|\}}ztt|�j||�Wd|jj�X|jj�}qWdS(N(R"RsR!R!R R�t task_done(R�ttaskR�R$((s(/usr/lib64/python2.7/lib2to3/refactor.pyR-�scO�sE|jdk r(|jj||f�ntt|�j||�SdS(N(R"R!R/R!R R�(R�R�R$((s(/usr/lib64/python2.7/lib2to3/refactor.pyR��s(RRR�R@R�R-R�(((s(/usr/lib64/python2.7/lib2to3/refactor.pyR �s (.Ret __future__Rt __author__RIR R�RuR�R-RQt itertoolsRtpgen2RRRt fixer_utilRR�RRRtbuR R~RWRR(RR%R>RCREtversion_infotcodecsR�R�RHRKRcRdtobjectRfRR (((s(/usr/lib64/python2.7/lib2to3/refactor.pyt<module> sH (��
/home/jackpotjunglegam/../../lib64/python2.7/ensurepip/../site-packages/../lib2to3/refactor.pyc