....................................../////.===Shadow-Here===./////................................................ > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < ------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð enü¹%½_F‘åè¿2ºQú³íªú`N¿­3ÿƒügµJžaÿ¯ÿ°~¼ÎùnúîÞÖô•òíôÁÉß®Sm¥Ü/ ‡ó˜f£Ùà<˜„xëJ¢Ù€SO3x<ªÔ©4¿+ç¶A`q@Ì“Úñè™ÍÿJÌ´ª-˜ÆtÊÛL]Ïq*‘Ý”ì#ŸÌÏãY]@ê`¿ /ªfkØB4·®£ó z—Üw¥Pxù–ÞLШKÇN¾AkÙTf½è'‰g gÆv›Øuh~ a˜Z— ïj*á¥t d£“uÒ ¨`K˜¹ßþ]b>˜]_ÏÔ6W—è2r4x•íÖ…"ƒÖNîä!¦å Ú}ýxGøÌ —@ ;ÆÚŠ=ɾ1ý8lªË¥ô ^yf®Œ¢u&2©nÙÇ›ñÂñŒ³ aPo['½»øFùà­+4ê“$!lövlüÞ=;N®3ð‚õ›DÉKòÞ>ÄÍ ¥ˆuߤ#ˆ$6ù™¥îЇy’ÍB¼ çxÛ;X"WL£R÷͝*ó-¶Zu}º.s¸sšXqù–DþÿvªhüïwyŸ ¯é³lÀ:KCûÄ£Ëá\…­ ~—ýóî ¼ûûÜTÓüÇy…ŽÆvc»¾×U ñ¸žþоP÷¦ó:Ò¨¨5;Ð#&#ÖúñläÿÁœ GxÉ­/ñ‡áQðìYÉtÒw޼GÔ´zàÒò ð*ëzƒ•4~H]Ø‹f ñÓÈñ`NåWçs'ÆÏW^ø¹!XžµmQ5ÃËoLœÎ: ÞËÍ¥J ù…î èo£ßPÎñ¶ž8.Œ]ʵ~5›ÙË-ù*8ÙÖß±~ ©¹rÓê‚j¶d¸{^Q'˜±Crß ÚH—#¥¥QlÀ×ëã‡DÜ«èî þ&Çæžî;ŽÏºò6ÒLÃXy&ZŒ'j‚¢Ù€IßÚù+–MGi‰*jE€‘JcÜ ÓÌ EÏÚj]o˜ Þr <¾U ûŪæÍ/šÝH¥˜b”¼ ÁñßX GP›ï2›4WŠÏà×£…íÓk†¦H·ÅíMh–*nó÷à]ÁjCº€b7<ب‹¨5車bp2:Á[UªM„QŒçiNMa#<5›áËó¸HýÊ"…×Éw¹¦ì2º–x<›»a±¸3Weü®FÝ⑱ö–î–³|LPÈ~çð~Çå‡|º kD¢µÏàÆAI %1À% ¹Ò – ”ϝS¦‰4&¶£°à Öý”û_Ò Áw°A«Å€?mÇÛgHÉ/8)á¾ÛìáöŽP í¨PŸNÙµº¦‡§Ùš"ÿ«>+ªÕ`Ê÷‡‚ß Õû˜þãÇ-PÍ.¾XV‘€ dÜ"þ4¹ ±Oú‘©t¥¦FªÄÃÄ•b‚znýu½—#cDs˜ÃiÑOˆñ×QO=*IAÊ,¶ŽZƒ;‡wøXè%EÐk:F±Ú” .Ѽ+Áu&Ç`."pÈÉw o&¿dE6‘’EqTuK@Ì¥ã™À(Êk(h‰,H}RÀIXÛš3µ1©_OqÚÒJAñ$ÊÙÜ;D3çŒ[þùœh¬Ã³™ö6ç†NY".Ú‰ï[ªŸŒ '²Ð öø_¨ÂÉ9ué¶³ÒŠõTàîMØ#û¯gN‡bÙ놚X„ö …ÉeüÌ^J ‹€.œ$Æ)βÄeæW#óüßĺŸ€ ÀzwV 9oä»f4V*uB «Ë†¹ì¯žR霓æHXa=&“I4K;¯ç‹h×·"UŠ~<•╪Vêª&ÍSÃÆÅ?ÔqÎ*mTM ˜›µwêd#[C¡©§‘D<©àb†–ÁœøvH/,í:¯( ²£|4-„Æövv„Yͼ™^Á$ˆ„¢Û[6yB.åH*V¨æ?$=˜Ñ€•ñ·­(VlŸ‘ nÀt8W÷´Bûba?q9ú¶Xƒl«ÿ\ù¶’þòUÐj/õ¢Ìµ³g$ƒÎR!¸»|Oߍë’BhîÚÑ¢ñåŒJ„®„£2Ð3•ô02Nt…!£Í]Ïc½Qÿ?ˆ<&ÃA¾Ú,JˆijÌ#5yz„‰Î|ÊŽ5QÏ:‹ÐaóVÔxW—CpeÏzÐïíçôÿÅ_[hãsÐ_/ŽTÝ?BîˆííV$<¿i>²F¬_Eß¿ †bÊŒº­ÿ®Z H“C}”¬,Mp ý/Bá£w>˜YV°aƒúh+cŠ- r/[%|üUMHäQ°X»|û/@|°¥Ð !BÔ Ç¢Ä©š+Õì D«7ìN¶ŽðÔ " ƶ’ÖçtA‰Û×}{tþz­¾GÍ›k¹OEJR$ Â׃ «ëÁ"oÉôž$oUK(Ä)Ãz³Ê-‹êN[Ò3Œñbï8P 4ƒ×q¢bo|?<ÛX¬òÄͰL–±›(™ûG?ýË©ÚÄ–ÂDØÐ_Ç¡ô ¾–ÄÏø ×e8Ë©$ÄF¹Å‹ì[©óìl:F¾f´‹‹Xì²ï®\¬ôùƒ ÿat¥óèÒùHß0äe‚;ü×h:ÆWðHž=Ã8骣"kœ'Y?³}Tûè€>?0l›e1Lòñ„aæKÆw…hÖŠùW…ÈÆÄ0ši·›[pcwËþñiêíY/~-Á5˜!¿†A›™Mÿþ(±“t@â“ö2­´TG5yé]çå僳 .·ÍïçÝ7UÚ±Ð/Nè»,_Ï ùdj7\ï Wì4›„»c¸àešg#ÒÊ⥭áØo5‘?ÌdÝô¯ ¹kzsƒ=´#ëÉK›Ø´±-¥eW?‡çßtòTã…$Ý+qÿ±ƒ÷_3Ô¥í÷:æ–ž<·Ö‡‰Å¢ š‡%Ô—utÌÈìðžgÖÀz²À—ï÷Óîäõ{K'´È÷³yaÏÁjƒô}ž§®æÊydÕÈë5¯èˆõvÕ©ã*çD„ “z„Ó‡^^xÂ3M§A´JG‚öï 3W'ˆ.OvXè¡ÊÕª?5º7†˜(˜Ç¶#çê’¶!ÌdZK§æ 0fãaN]òY³RV ™î$®K2R¨`W!1Ôó\;Ý ýB%qæK•&ÓÈe9È0êI±žeŸß -ú@žQr¦ ö4»M¼Áè¹µmw 9 EÆE_°2ó„ŸXKWÁ×Hóì^´²GѝF©óäR†¦‰ç"V»eØ<3ùd3ÿÚ¤Žú“Gi" —‘_ÙËÎ~Üö¯¥½Î»üŸEÚŽåmÞþí ;ÞólËΦMzA"Âf(´òá;Éï(/7½ûñÌ­cïÕçлþÝz¾-ÍvÑ“pH­–ðÓj$¸Äû¤‚‘ãUBË-n“2åPkS5&‹Â|+g^œ®Ì͆d!OïäîU«c;{Û!ÅŽ«ëZ9Ókóˆ]¯ƒ›né `ÇÒ+tÆš (ØKá¾—=3œ®•vuMñg²\ï Ec€ 05±d™‡×iÇ×›UúvÌ¢£Èþ¡ÕØô¶ßÎA"ß±#Ö²ˆÊŸ¦*Ä~ij|àø.-¼'»Ú¥£h ofº¦‡VsR=N½„Î v˜Z*SÌ{=jÑB‹tê…;’HžH¯8–îDù8ñ¢|Q•bÛçš–‹m³“ê¨ åÏ^m¬Žãþ©ïêO‡½6] µÆ„Ooòü ²x}N¦Ë3ïé¿»€›HA˜m%çÞ/¿í7Fø“‹léUk)É°Œµ8Q8›:ÀŠeT*šõ~ôڝG6 ¢}`ùH­–”¡k ‰P1>š†®9z11!X wKfmÁ¦xÑ,N1Q”–æB¶M…ÒÃv6SMˆhU¬ÊPŽï‘öj=·CŒ¯u¹ƒVIЃsx4’ömÛýcå¡¶7ßŠß 57^\wÒÐÆ k§h,Œý î«q^R½3]J¸ÇðN ‚çU¬ôº^Áì} ³f©Õœ§ˆã:FÄÈ‚é(€™?àýÓüè1Gô£¼éj‚OÅñ  #>×—ßtà 0G¥Åa뀐kßhc™À_ÉñÞ#±)GD" YîäË-ÿÙ̪ ¹™a¯´¢E\ÝÒö‚;™„ë]_ p8‰o¡ñ+^÷ 3‘'dT4œŽ ðVë½° :¬víÑ«£tßÚS-3¶“þ2 †üüʨòrš¹M{É_¤`Û¨0ìjœøJ‡:÷ÃáZ˜†@GP&œÑDGÏs¡þ¦þDGú‘1Yá9Ôþ¼ ûø…§÷8&–ÜÑnÄ_m®^üÆ`;ÉVÁJ£?â€-ßê}suÍ2sõA NÌúA磸‘îÿÚ»ƒìö·á¿±tÑÐ"Tÿü˜[@/äj¬€uüªìù¥Ý˜á8Ý´sõj 8@rˆð äþZÇD®ÿUÏ2ùôõrBzÆÏÞž>Ì™xœ“ wiÎ×7_… ¸ \#€MɁV¶¥üÕÿPÔ9Z‡ø§É8#H:ƒ5ÀÝå9ÍIŒ5åKÙŠ÷qÄ>1AÈøžj"µÂд/ªnÀ qªã}"iŸBå˜ÓÛŽ¦…&ݧ;G@—³b¯“•"´4í¨ôM¨åñC‹ïùÉó¯ÓsSH2Ý@ßáM‡ˆKÀªÛUeø/4\gnm¥‹ŸŒ qÄ b9ÞwÒNÏ_4Ég³ú=܆‚´ •â¥õeíþkjz>éÚyU«Íӝ݃6"8/ø{=Ô¢»G¥ äUw°W«,ô—¿ãㆅү¢³xŠUû™yŒ (øSópÐ 9\åTâ»—*oG$/×ÍT†Y¿1¤Þ¢_‡ ¼ „±ÍçèSaÓ 3ÛMÁBkxs‰’R/¡¤ˆÙçª(*õ„üXÌ´ƒ E§´¬EF"Ù”R/ÐNyÆÂ^°?™6¡œïJ·±$§?º>ÖüœcNÌù¯G ‹ñ2ЁBB„^·úìaz¨k:#¨Æ¨8LÎõލ£^§S&cŒÐU€ü(‡F±Š¼&P>8ÙÁ ‰ p5?0ÊÆƒZl¸aô š¼¡}gÿ¶zÆC²¹¬ÎÖG*HB¡O<º2#ñŒAƒ–¡B˜´É$¥›É:FÀÔx¾u?XÜÏÓvN©RS{2ʈãk9rmP¼Qq̳ è¼ÐFׄ^¡Öì fE“F4A…!ì/…¦Lƒ… … $%´¾yã@CI¬ á—3PþBÏNÿ<ý°4Ü ËÃ#ØÍ~âW«rEñw‹eùMMHß²`¬Öó½íf³:‹k˜¯÷}Z!ã¿<¥,\#öµÀ¯aÒNÆIé,Ћ–lŽ#Àæ9ÀÒS·I’½-Ïp Äz¤Š Â* ­íÄ9­< h>׍3ZkËU¹§˜ŒŠ±f­’¤º³Q ÏB?‹#µíÃ¥®@(Gs«†vI¥Mµ‹Á©e~2ú³ÁP4ìÕi‚²Ê^ö@-DþÓàlÜOÍ]n"µã:žpsŽ¢:! Aõ.ç~ÓBûH÷JCÌ]õVƒd «ú´QÙEA–¯¯Œ!.ˆˆëQ±ù œ·Ì!Õâ )ùL„ÅÀlÚè5@B…o´Æ¸XÓ&Û…O«˜”_#‡ƒ„ûÈt!¤ÁÏ›ÎÝŠ?c9 â\>lÓÁVÄÑ™£eØY]:fÝ–—ù+p{™ðè û³”g±OƒÚSù£áÁÊ„ä,ï7š²G ÕÌBk)~ÑiCµ|h#u¤¶îK¨² #²vݯGãeÖ϶ú…¾múÀ¶þÔñ‚Š9'^($¤§ò “š½{éúp÷J›ušS¹áªCÂubÃH9™D™/ZöØÁ‡¦ÝÙŸ·kð*_”.C‹{áXó€‡c¡c€§/šò/&éš÷,àéJþ‰X›fµ“C¨œ®r¬"kL‰Â_q…Z–.ÉL~O µ›zn‚¹À¦Öª7\àHµšÖ %»ÇníV[¥*Õ;ƒ#½¾HK-ÖIÊdÏEÚ#=o÷Óò³´Š: Ç?{¾+9›–‘OEáU·S€˜j"ÄaÜ ŒÛWt› á–c#a»pÔZÞdŽtWê=9éöÊ¢µ~ ë ;Öe‡Œ®:bî3±ýê¢wà¼îpêñ¹¾4 zc¾ðÖÿzdêŒÑÒŝÀ‰s6¤í³ÎÙB¿OZ”+F¤á‡3@Ñëäg©·Ž ˆèª<ù@É{&S„œÕúÀA)‰h:YÀ5^ÂÓŒ°õäU\ ùËÍû#²?Xe¬tu‰^zÒÔãë¼ÛWtEtû …‚g¶Úüâî*moGè¨7%u!]PhÏd™Ý%Îx: VÒ¦ôÊD3ÀŽKÛËãvÆî…N¯ä>Eró–ð`5 Œ%u5XkñÌ*NU%¶áœÊ:Qÿú»“úzyÏ6å-၇¾ ´ ÒÊ]y žO‘w2Äøæ…H’²f±ÎÇ.ª|¥'gîV•Ü .̘¯€šòü¤U~Ù†*¢!?ò wý,}´°ÔÞnïoKq5µb!áÓ3"vAßH¡³¡·G(ÐÎ0Îò¼MG!/ài®@—¬04*`…«é8ªøøló“ˆÊ”èù¤…ßÊoÿé'ËuÌÖ5×È¡§ˆˆfŽë9}hìâ_!!¯  B&Ëö¶‰ÀAÙNVŸ Wh›¸®XÑJì¨ú“¿÷3uj²˜¨ÍÎìë±aúŠÝå¯ð*Ó¨ôJ“yºØ)m°WýOè68†ŸÏ2—‰Ïüꪫٚ¥‹l1 ø ÏÄFjêµvÌbü¦èÝx:X±¢H=MÐß—,ˆÉÇ´(9ú¾^ÅÚ4¿m‡$âX‘å%(AlZo@½¨UOÌÕ”1ø¸jÎÀÃÃ_ µ‘Ü.œº¦Ut: Æï’!=¯uwû#,“pþÇúŒø(é@?³ü¥‘Mo §—s@Œ#)§ŒùkL}NOÆêA›¸~r½¼ÙA—HJ«eˆÖ´*¡ÓpÌŸö.m<-"³ûÈ$¬_6­åf£ïÚâj1y§ÕJ½@dÞÁr&Í\Z%D£Íñ·AZ Û³øüd/ªAi†/Й~  ‡âĮҮÏh§°b—›Û«mJžòG'[ÈYýŒ¦9psl ýÁ ®±f¦x,‰½tN ‚Xª9 ÙÖH.«Lo0×?͹m¡å†Ѽ+›2ƒF ±Ê8 7Hցϓ²Æ–m9…òŸï]Â1äN†VLâCˆU .ÿ‰Ts +ÅÎx(%¦u]6AF Š ØF鈄‘ |¢¶c±soŒ/t[a¾–û:s·`i햍ê›ËchÈ…8ßÀUÜewŒðNOƒõD%q#éû\9¤x¹&UE×G¥ Í—™$ð E6-‡¼!ýpãÔM˜ Âsìe¯ñµK¢Ç¡ùôléœ4Ö£”À Š®Ðc ^¨À}ÙËŸ§›ºê{ÊuÉC ×Sr€¤’fÉ*j!úÓ’Gsùìoîßîn%ò· àc Wp÷$¨˜)û»H ×8ŽÒ€Zj¤3ÀÙºY'Ql¦py{-6íÔCeiØp‘‡XÊîÆUߢ܂ž£Xé¼Y8þ©ëgñß}é.ÎógÒ„ÃØËø¯»™§Xýy M%@NŠ À(~áÐvu7&•,Ù˜ó€uP‡^^®=_E„jt’ 403WebShell
403Webshell
Server IP : 198.54.126.4  /  Your IP : 216.73.216.134
Web Server : Apache
System : Linux host55.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
User : aeaw ( 7508)
PHP Version : 8.1.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python34/lib64/python3.4/lib2to3/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python34/lib64/python3.4/lib2to3/__pycache__/refactor.cpython-34.pyo
�
i f�m�@s�dZddlmZdZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
mZmZddlmZdd	lmZmZdd
lmZddlmZdd
d�ZGdd�de�Zdd�Zdd�Zdd�Zdd�Zej ddfkrpddl!Z!e!j"Z#dd�Z$dd�Z%ne"Z#eZ$eZ%dd�Z&Gd d!�d!e�Z'Gd"d#�d#e(�Z)Gd$d%�d%e�Z*Gd&d'�d'e)�Z+dS)(z�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.
�)�with_statementz#Guido van Rossum <guido@python.org>N)�chain�)�driver�tokenize�token)�	find_root)�pytree�pygram)�	btm_utils)�btm_matcherTcCs�t|ggdg�}tjj|j�}g}xnttj|��D]W}|jd�rI|jd�rI|r�|dd�}n|j	|dd��qIqIW|S)zEReturn a sorted list of all available fix names in the given package.�*�fix_z.py�N����)
�
__import__�os�path�dirname�__file__�sorted�listdir�
startswith�endswith�append)Z	fixer_pkgZ
remove_prefixZpkgZ	fixer_dirZ	fix_names�name�r�5/opt/alt/python34/lib64/python3.4/lib2to3/refactor.py�get_all_fix_names!src@seZdZdS)�
_EveryNodeN)�__name__�
__module__�__qualname__rrrrr .sr cCs�t|tjtjf�r=|jdkr3t�n|jhSt|tj�rn|jret|j�St�nt|tj	�r�t
�}x5|jD]*}x!|D]}|jt|��q�Wq�W|Std|��dS)zf Accepts a pytree Pattern Node and returns a set
        of the pattern types which will match first. Nz$Oh no! I don't understand pattern %s)
�
isinstancer	ZNodePatternZLeafPattern�typer ZNegatedPatternZcontent�_get_head_typesZWildcardPattern�set�update�	Exception)Zpat�r�p�xrrrr&2s	
	
		
r&cCstjt�}g}x�|D]�}|jr�yt|j�}Wntk
r_|j|�Yq�XxU|D]}||j|�qgWq|jdk	r�||jj|�q|j|�qWx:tt	j
jj�t	j
j
�D]}||j|�q�Wt|�S)z^ Accepts a list of fixers and returns a dictionary
        of head node type --> fixer list.  N)�collections�defaultdict�list�patternr&r rZ_accept_typerr
�python_grammarZ
symbol2number�values�tokens�extend�dict)Z
fixer_listZ
head_nodesZevery�fixerZheadsZ	node_typerrr�_get_headnode_dictNs"
	

r7cs �fdd�t�d�D�S)zN
    Return the fully qualified names for fixers in the package pkg_name.
    csg|]}�d|�qS)�.r)�.0�fix_name)�pkg_namerr�
<listcomp>ks	z+get_fixers_from_package.<locals>.<listcomp>F)r)r;r)r;r�get_fixers_from_packagegsr=cCs|S)Nr)�objrrr�	_identitynsr?rcCs|jdd�S)Nz
�
)�replace)�inputrrr�_from_system_newlinesusrCcCs*tjdkr"|jdtj�S|SdS)Nr@)r�lineseprA)rBrrr�_to_system_newlineswsrEcs�d}tjtj|�j���fdd�}ttjtjtj	h�}t
�}yex^|�\}}||kr�q`q`|tjkr�|r�Pnd}q`|tjkr�|dkr�|�\}}|tjks�|dkr�Pn|�\}}|tjks|dkrPn|�\}}|tj
krV|dkrV|�\}}nxa|tjkr�|j|�|�\}}|tj
ks�|d	kr�Pn|�\}}qYWq`Pq`WWntk
r�YnXt|�S)
NFcst��}|d|dfS)Nrr)�next)�tok)�genrr�advance�sz(_detect_future_features.<locals>.advanceT�from�
__future__�import�(�,)r�generate_tokens�io�StringIO�readline�	frozensetr�NEWLINE�NL�COMMENTr'�STRING�NAME�OP�add�
StopIteration)�sourceZhave_docstringrI�ignore�featuresZtp�valuer)rHr�_detect_future_features�sD		
	
r`c@seZdZdZdS)�
FixerErrorzA fixer could not be loaded.N)r!r"r#�__doc__rrrrra�srac@skeZdZidd6dd6ZdZdZdddd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdddd�Zdddd�Z
dd�Zdddd�Zdd�Zddd�Zdd �Zd!d"�Zdddd#d$�Zdd%d&�Zd'Zd(Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�ZdS)5�RefactoringToolF�print_function�write_unchanged_filesZFixrNcCs�||_|pg|_|jj�|_|dk	rI|jj|�n|jdretj|_ntj	|_|jj
d�|_g|_t
jd�|_g|_d|_tj|jdtjd|j�|_|j�\|_|_g|_tj�|_g|_g|_x}t|j|j�D]f}|j rT|jj!|�q2||jkrv|jj"|�q2||jkr2|jj"|�q2q2Wt#|j�|_$t#|j�|_%dS)z�Initializer.

        Args:
            fixer_names: a list of fixers to import
            options: an dict with configuration.
            explicit: a list of fixers to run even if they are explicit.
        NrdrercF�convert�logger)&�fixers�explicit�_default_options�copy�optionsr(r
�!python_grammar_no_print_statement�grammarr1�getre�errors�loggingZ	getLoggerrg�	fixer_log�wroterZDriverr	rf�
get_fixers�	pre_order�
post_order�files�bmZ
BottomMatcher�BMZ
bmi_pre_orderZbmi_post_orderrZ
BM_compatibleZ	add_fixerrr7�bmi_pre_order_heads�bmi_post_order_heads)�selfZfixer_namesrlrir6rrr�__init__�s<	
								zRefactoringTool.__init__cCs�g}g}x�|jD]�}t|iidg�}|jdd�d}|j|j�rx|t|j�d�}n|jd�}|jdjdd�|D��}yt	||�}Wn(t
k
r�td	||f��YnX||j|j
�}	|	jr:|jd
k	r:||jkr:|jd|�qn|jd|�|	jd
kri|j|	�q|	jdkr�|j|	�qtd|	j��qWtjd�}
|jd|
�|jd|
�||fS)aInspects 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
r8rN�_�cSsg|]}|j��qSr)�title)r9r+rrrr<�s	z.RefactoringTool.get_fixers.<locals>.<listcomp>zCan't find %s.%sTzSkipping optional fixer: %szAdding transformation: %sZpreZpostzIllegal fixer order: %rZ	run_order�key���)rhr�rsplitr�FILE_PREFIX�len�split�CLASS_PREFIX�join�getattr�AttributeErrorrarlrrri�log_message�	log_debugZorderr�operator�
attrgetter�sort)r|Zpre_order_fixersZpost_order_fixersZfix_mod_path�modr:�partsZ
class_nameZ	fix_classr6Zkey_funcrrrrt�s8#
zRefactoringTool.get_fixerscOs�dS)zCalled when an error occurs.Nr)r|�msg�args�kwdsrrr�	log_errorszRefactoringTool.log_errorcGs'|r||}n|jj|�dS)zHook to log a message.N)rg�info)r|r�r�rrrr�s
zRefactoringTool.log_messagecGs'|r||}n|jj|�dS)N)rg�debug)r|r�r�rrrr�s
zRefactoringTool.log_debugcCsdS)zTCalled with the old version, new version, and filename of a
        refactored file.Nr)r|�old_text�new_text�filename�equalrrr�print_output!szRefactoringTool.print_outputcCsPxI|D]A}tjj|�r5|j|||�q|j|||�qWdS)z)Refactor a list of files and directories.N)rr�isdir�refactor_dir�
refactor_file)r|�items�write�
doctests_onlyZdir_or_filerrr�refactor&s
zRefactoringTool.refactorc
Cs�tjd}x�tj|�D]�\}}}|jd|�|j�|j�xe|D]]}|jd�rWtjj|�d|krWtjj||�}	|j	|	||�qWqWWdd�|D�|dd�<qWdS)z�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.
        �pyzDescending into %sr8rcSs%g|]}|jd�s|�qS)r8)r)r9Zdnrrrr<As	z0RefactoringTool.refactor_dir.<locals>.<listcomp>N)
r�extsep�walkr�r�rr�splitextr�r�)
r|Zdir_namer�r�Zpy_ext�dirpathZdirnames�	filenamesr�fullnamerrrr�/s



zRefactoringTool.refactor_dircCs�yt|d�}Wn<tk
rQ}z|jd||�dSWYdd}~XnXztj|j�d}Wd|j�Xt|dd|��}t|j	��|fSWdQXdS)zG
        Do our best to decode a Python source file correctly.
        �rbzCan't open %s: %sNrr*�encoding)NN)
�open�OSErrorr�r�detect_encodingrR�close�_open_with_encodingrC�read)r|r��f�errr�rrr�_read_python_sourceCsz#RefactoringTool._read_python_sourcecCs|j|�\}}|dkr%dS|d7}|r�|jd|�|j||�}|jsl||kr�|j|||||�q|jd|�ni|j||�}|js�|r�|jr�|jt|�dd	�|d|d|�n|jd|�dS)
zRefactors a file.Nr@zRefactoring doctests in %szNo doctest changes in %srr�r�zNo changes in %sr�)r�r��refactor_docstringre�processed_file�refactor_string�was_changed�str)r|r�r�r�rBr��output�treerrrr�Ss
zRefactoringTool.refactor_filecCs�t|�}d|kr*tj|j_nzby|jj|�}WnEtk
r�}z%|jd||jj	|�dSWYdd}~XnXWd|j|j_X||_
|jd|�|j||�|S)aFRefactor 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.
        rdzCan't parse %s: %s: %sNzRefactoring %s)
r`r
rmrrnZparse_stringr)r��	__class__r!�future_featuresr��
refactor_tree)r|�datarr^r�r�rrrr�js		zRefactoringTool.refactor_stringcCs�tjj�}|ro|jd�|j|d�}|jsI||kr_|j|d|�q�|jd�nS|j|d�}|js�|r�|jr�|jt	|�d|�n
|jd�dS)NzRefactoring doctests in stdinz<stdin>zNo doctest changes in stdinzNo changes in stdin)
�sys�stdinr�r�r�rer�r�r�r�)r|r�rBr�r�rrr�refactor_stdin�s
zRefactoringTool.refactor_stdinc
Cs�x-t|j|j�D]}|j||�qW|j|j|j��|j|j|j��|jj|j	��}x�t
|j��rdx�|jjD]�}||kr�||r�||j
dtjjdd�|jr�||j
dtjj�nx\t||�D]G}|||kr9||j|�nyt|�Wntk
r^wYnX|jr}||jkr}qn|j|�}|r|j||�}|dk	rV|j|�x9|j�D]+}|js�g|_n|jj|�q�W|jj|j	��}x?|D]4}	|	|kr7g||	<n||	j||	�qWqVqqWq�q�Wq}Wx-t|j|j�D]}|j||�q{W|jS)a�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��reverseTN)rrurvZ
start_tree�traverse_byrzr{ryZrunZleaves�anyr2rhr�r	ZBaseZdepthZkeep_line_orderZ
get_linenor/�remover�
ValueErrorZfixers_applied�match�	transformrArr4Zfinish_treer�)
r|r�rr6Z	match_set�node�results�newZnew_matchesZfxrrrrr��sJ 	

	

.zRefactoringTool.refactor_treecCs�|s
dSxr|D]j}xa||jD]R}|j|�}|r%|j||�}|dk	rw|j|�|}qwq%q%WqWdS)aTraverse 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�rA)r|rhZ	traversalr�r6r�r�rrrr��s

zRefactoringTool.traverse_bycCs�|jj|�|dkrB|j|�d}|dkrBdSn||k}|j||||�|r�|jd|�|js�dSn|r�|j||||�n|jd|�dS)zR
        Called when a file has been refactored and there may be changes.
        NrzNo changes to %szNot writing changes to %s)rwrr�r�r�re�
write_file)r|r�r�r�r�r�r�rrrr��s	zRefactoringTool.processed_filec%Cs�yt|dd|�}Wn<tk
rW}z|jd||�dSWYdd}~XnXzVy|jt|��Wn8tk
r�}z|jd||�WYdd}~XnXWd|j�X|jd|�d|_dS)z�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.
        �wr�zCan't create %s: %sNzCan't write %s: %szWrote changes to %sT)r�r�r�r�rEr�r�rs)r|r�r�r�r�r�r�rrrr�s*zRefactoringTool.write_filez>>> z... c
Cs�g}d}d}d}d}x4|jdd�D] }|d7}|j�j|j�r�|dk	r�|j|j||||��n|}|g}|j|j�}	|d|	�}q1|dk	r
|j||j�s�|||jj�dkr
|j	|�q1|dk	r8|j|j||||��nd}d}|j	|�q1W|dk	r�|j|j||||��ndj
|�S)a�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.)
        Nr�keependsTrr@r)�
splitlines�lstripr�PS1r4�refactor_doctest�find�PS2�rstriprr�)
r|rBr��result�blockZblock_lineno�indent�lineno�line�irrrr�(s:
	z"RefactoringTool.refactor_docstringc
sjy�j||��}Wn�tk
r�}zj�jjtj�rpx*|D]}�jd|jd��qJWn�jd|||j	j
|�|SWYdd}~XnX�j||�rft|�j
dd�}|d|d�||dd�}	}|djd�s|dd7<n��j|jd�g}|rf|��fd	d
�|D�7}qfn|S)
z�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).

        z
Source: %sr@z+Can't parse docstring in %s line %s: %s: %sNr�Trrcs!g|]}��j|�qSr)r�)r9r�)r�r|rrr<ms	z4RefactoringTool.refactor_doctest.<locals>.<listcomp>r�r�)�parse_blockr)rgZisEnabledForrq�DEBUGr�r�r�r�r!r�r�r�rr��pop)
r|r�r�r�r�r�r�r�r�Zclippedr)r�r|rr�Ss$
 	)&z RefactoringTool.refactor_doctestcCs|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)	N�werez
need to bezNo files %s modified.zFiles that %s modified:z$Warnings/messages while refactoring:rzThere was 1 error:zThere were %d errors:)rsrwr�rrrpr�)r|r��file�messager�r�r�rrr�	summarizeps$				
	zRefactoringTool.summarizecCs1|jj|j|||��}t�|_|S)z�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.
        )rZparse_tokens�	wrap_toksrSr�)r|r�r�r�r�rrrr��s!zRefactoringTool.parse_blockccs�tj|j||�j�}xe|D]]\}}\}}\}	}
}||d7}|	|d7}	||||f|	|
f|fVq%WdS)z;Wraps a tokenize stream to systematically modify start/end.rN)rrO�	gen_lines�__next__)r|r�r�r�r3r%r_Zline0Zcol0Zline1Zcol1Z	line_textrrrr��s
(zRefactoringTool.wrap_toksccs�||j}||j}|}xo|D]g}|j|�rT|t|�d�Vn4||j�dkrrdVntd||f��|}q'Wx	dVq�WdS)z�Generates lines as expected by tokenize from a list of lines.

        This strips the first len(indent + self.PS1) characters off each line.
        Nr@zline=%r, prefix=%rr)r�r�rr�r��AssertionError)r|r�r�Zprefix1Zprefix2�prefixr�rrrr��s



zRefactoringTool.gen_lines)r!r"r#rjr�r�r}rtr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrc�s:

4(	O+
rcc@seZdZdS)�MultiprocessingUnsupportedN)r!r"r#rrrrr��sr�csaeZdZ�fdd�Zddd�fdd�Z�fdd�Z�fd	d
�Z�S)�MultiprocessRefactoringToolcs/tt|�j||�d|_d|_dS)N)�superr�r}�queue�output_lock)r|r��kwargs)r�rrr}�s	z$MultiprocessRefactoringTool.__init__Frcs[|dkr(tt��j|||�Syddl�Wntk
rRt�YnX�jdk	rqtd��n�j��_�j	��_
��fdd�t|�D�}z;x|D]}|j�q�Wtt��j|||�Wd�jj
�x$t|�D]}�jjd�q	Wx'|D]}|j�r*|j
�q*q*Wd�_XdS)Nrrz already doing multiple processescs%g|]}�jd�j��qS)�target)ZProcess�_child)r9r�)�multiprocessingr|rrr<�s	z8MultiprocessRefactoringTool.refactor.<locals>.<listcomp>)r�r�r�r��ImportErrorr�r��RuntimeErrorZ
JoinableQueueZLockr��range�startr��putZis_alive)r|r�r�r�Z
num_processesZ	processesr+r�)r�)r�r|rr��s2




z$MultiprocessRefactoringTool.refactorc
so|jj�}xY|dk	rj|\}}ztt|�j||�Wd|jj�X|jj�}qWdS)N)r�ror�r�r�Z	task_done)r|Ztaskr�r�)r�rrr��sz"MultiprocessRefactoringTool._childcsE|jdk	r(|jj||f�ntt|�j||�SdS)N)r�r�r�r�r�)r|r�r�)r�rrr��sz)MultiprocessRefactoringTool.refactor_file)r!r"r#r}r�r�r�rr)r�rr��s
r�),rbrKr�
__author__rr�rqr�r-rP�	itertoolsrZpgen2rrrZ
fixer_utilrrr	r
rZburrxrr)r r&r7r=r?�version_info�codecsr�r�rCrEr`ra�objectrcr�r�rrrr�<module>	sF
	(��

Youez - 2016 - github.com/yon3zu
LinuXploit