Files
PowerToys/PythonHome/Lib/lib2to3/fixes/fix_urllib.pyc

54 lines
6.9 KiB
Plaintext
Raw Normal View History

2014-07-09 18:15:23 +08:00
<03>
<EFBFBD>W`Sc@ssdZddlmZmZddlmZddlmZmZm Z m
Z
m Z m Z m Z iddddd d
d d d gfddddddddddddddddgfddgfgd 6dd
d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7gfdd8d9gfgd:6Zed:jed d;<19>d<<00>Zd=efd><00><00>YZd?S(@s<>Fix changes imports of urllib which are now incompatible.
This is rather similar to fix_imports, but because of the more
complex nature of the fixing for urllib, it has its own fixer.
i<EFBFBD><EFBFBD><EFBFBD><EFBFBD>(t
alternatest
FixImports(t
fixer_base(tNametCommat
FromImporttNewlinetfind_indentationtNodetsymssurllib.requestt URLopenertFancyURLopenert urlretrievet
_urlopenerturlopent
urlcleanupt pathname2urlt url2pathnames urllib.parsetquotet
quote_plustunquotet unquote_plust urlencodet splitattrt splithostt
splitnportt splitpasswdt splitportt
splitquerytsplittagt splittypet splitusert
splitvalues urllib.errortContentTooShortErrorturllibtinstall_openert build_openertRequesttOpenerDirectort BaseHandlertHTTPDefaultErrorHandlertHTTPRedirectHandlertHTTPCookieProcessort ProxyHandlertHTTPPasswordMgrtHTTPPasswordMgrWithDefaultRealmtAbstractBasicAuthHandlertHTTPBasicAuthHandlertProxyBasicAuthHandlertAbstractDigestAuthHandlertHTTPDigestAuthHandlertProxyDigestAuthHandlert HTTPHandlert HTTPSHandlert FileHandlert
FTPHandlertCacheFTPHandlertUnknownHandlertURLErrort HTTPErrorturllib2iccs<>t<00>}x<>tj<00>D]w\}}xh|D]`}|\}}t|<00>}d||fVd|||fVd|Vd|Vd||fVq)WqWdS(Ns<4E>import_name< 'import' (module=%r
| dotted_as_names< any* module=%r any* >) >
s<>import_from< 'from' mod_member=%r 'import'
( member=%s | import_as_name< member=%s 'as' any > |
import_as_names< members=any* >) >
sIimport_from< 'from' module_star=%r 'import' star='*' >
stimport_name< 'import'
dotted_as_name< module_as=%r 'as' any > >
sKpower< bare_with_attr=%r trailer< '.' member=%s > any* >
(tsettMAPPINGtitemsR(tbaret
old_moduletchangestchanget
new_moduletmembers((s!.\Lib\lib2to3\fixes\fix_urllib.pyt build_pattern1s      t FixUrllibcBs5eZd<00>Zd<00>Zd<00>Zd<00>Zd<00>ZRS(cCsdjt<00><00>S(Nt|(tjoinRF(tself((s!.\Lib\lib2to3\fixes\fix_urllib.pyRFJscCs<>|jd<00>}|j}g}x?t|jd D],}|jt|dd|<00>t<00>g<00>q0W|jtt|jddd|<00><01>|j|<00>dS(s<>Transform for the basic import case. Replaces the old
import name with a comma separated list of its
replacements.
tmodulei<65><69><EFBFBD><EFBFBD>itprefixN( tgetRLR>tvaluetextendRRtappendtreplace(RJtnodetresultst
import_modtpreftnamestname((s!.\Lib\lib2to3\fixes\fix_urllib.pyttransform_importMs *(cCs<>|jd<00>}|j}|jd<00>}|r<>t|t<00>rI|d}nd }x6t|jD]'}|j|dkr]|d}Pq]q]W|r<>|jt|d|<00><01>q<>|j |d<00>n/g}i} |d}
x<>|
D]<5D>}|j
t j kr|j dj} |j dj} n|j} d } | d kr<>xlt|jD]Z}| |dkr>|d| krx|j|d<19>n| j|dg<00>j|<00>q>q>Wq<57>q<>Wg} t|<00>}t}d
<00>}x<>|D]<5D>}| |}g}x8|d D],}|j|||<00><00>|jt<00><00>q<>W|j||d |<00><00>t||<00>}| sa|jjj|<00>rm||_n| j|<00>t}q<>W| r<>g}x(| d D]}|j|t<00>g<00>q<>W|j| d <19>|j|<00>n|j |d <00>d S(s<>Transform for imports of specific module elements. Replaces
the module to be imported from with the appropriate new
module.
t
mod_membertmemberiiRLs!This is an invalid module elementREiu,cSsz|jtjkrdt|jdjd|<00>|jdj<00>|jdj<00>g}ttj|<00>gSt|jd|<00>gS(NiRLii(ttypeR timport_as_nameRtchildrenRNtcloneR(RWRLtkids((s!.\Lib\lib2to3\fixes\fix_urllib.pyt handle_name<6D>s i<><69><EFBFBD><EFBFBD>sAll module elements are invalidN(RMRLt
isinstancetlisttNoneR>RNRQRtcannot_convertR[R R\R]RPt
setdefaultRtTrueRORRtparenttendswithtFalseR(RJRRRSRYRURZtnew_nameRCtmodulestmod_dictREtas_namet member_namet new_nodest indentationtfirstR`RKteltsRVtelttnewtnodestnew_node((s!.\Lib\lib2to3\fixes\fix_urllib.pyttransform_member]sh  

   +   
  
cCs<>|jd<00>}|jd<00>}d}t|t<00>r@|d}nx6t|jD]'}|j|dkrN|d}PqNqNW|r<>|jt|d|j<00><01>n|j |d<00>dS(s.Transform for calls to module members in code.tbare_with_attrRZiiRLs!This is an invalid module elementN(
RMRcRaRbR>RNRQRRLRd(RJRRRSt
module_dotRZRjRC((s!.\Lib\lib2to3\fixes\fix_urllib.pyt transform_dot<6F>s 
cCs<>|jd<00>r"|j||<00>n<>|jd<00>rD|j||<00>nf|jd<00>rf|j||<00>nD|jd<00>r<>|j|d<00>n"|jd<00>r<>|j|d<00>ndS(NRKRYRxt module_starsCannot handle star imports.t module_ass#This module is now multiple modules(RMRXRwRzRd(RJRRRS((s!.\Lib\lib2to3\fixes\fix_urllib.pyt transform<72>s(t__name__t
__module__RFRXRwRzR}(((s!.\Lib\lib2to3\fixes\fix_urllib.pyRGHs
   L N(t__doc__tlib2to3.fixes.fix_importsRRtlib2to3Rtlib2to3.fixer_utilRRRRRRR R>RPRFRG(((s!.\Lib\lib2to3\fixes\fix_urllib.pyt<module>sD4