й¼]À ã@snddlmZmZddlmZddlmZmZmZm Z m Z m Z m Z dddddd d d d d gfddddddddddddddddgfddgfgd dd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7gfdd8d9gfgiZ e d je dd:ƒd;d<„ZGd=d>„d>eƒZd?S)@é)Ú alternatesÚ FixImports)Ú fixer_base)ÚNameÚCommaÚ FromImportÚNewlineÚfind_indentationÚNodeÚsymsÚurllibzurllib.requestZ URLopenerZFancyURLopenerÚ urlretrieveZ _urlopenerÚurlopenÚ urlcleanupÚ pathname2urlÚ url2pathnamez urllib.parseÚquoteÚ quote_plusÚunquoteÚ unquote_plusÚ urlencodeZ splitattrZ splithostZ splitnportZ splitpasswdZ splitportZ splitqueryZsplittagZ splittypeZ splituserZ splitvaluez urllib.errorÚContentTooShortErrorÚurllib2Zinstall_openerZ build_openerZRequestZOpenerDirectorZ BaseHandlerZHTTPDefaultErrorHandlerZHTTPRedirectHandlerZHTTPCookieProcessorZ ProxyHandlerZHTTPPasswordMgrZHTTPPasswordMgrWithDefaultRealmZAbstractBasicAuthHandlerZHTTPBasicAuthHandlerZProxyBasicAuthHandlerZAbstractDigestAuthHandlerZHTTPDigestAuthHandlerZProxyDigestAuthHandlerZ HTTPHandlerZ HTTPSHandlerÚ FileHandlerZ FTPHandlerZCacheFTPHandlerZUnknownHandlerÚURLErrorÚ HTTPErroréccs•tƒ}x…tjƒD]w\}}xh|D]`}|\}}t|ƒ}d||fVd|||fVd|Vd|Vd||fVq)WqWdS)Nz�import_name< 'import' (module=%r | dotted_as_names< any* module=%r any* >) > zÆimport_from< 'from' mod_member=%r 'import' ( member=%s | import_as_name< member=%s 'as' any > | import_as_names< members=any* >) > zIimport_from< 'from' module_star=%r 'import' star='*' > ztimport_name< 'import' dotted_as_name< module_as=%r 'as' any > > zKpower< bare_with_attr=%r trailer< '.' member=%s > any* > )ÚsetÚMAPPINGÚitemsr)ZbareZ old_moduleZchangesÚchangeZ new_moduleÚmembers©r"ú//opt/alt/python35/lib64/python3.5/fix_urllib.pyÚ build_pattern1s      r$c@sLeZdZdd„Zdd„Zdd„Zdd„Zd d „Zd S) Ú FixUrllibcCsdjtƒƒS)Nú|)Újoinr$)Úselfr"r"r#r$JszFixUrllib.build_patterncCsŸ|jdƒ}|j}g}xEt|jdd…D],}|jt|dd|ƒtƒgƒq6W|jtt|jddd|ƒƒ|j|ƒdS)NÚmodulerrÚprefixéÿÿÿÿr+) Úgetr*rÚvalueÚextendrrÚappendÚreplace)r(ÚnodeÚresultsZ import_modÚprefÚnamesÚnamer"r"r#Útransform_importMs *(zFixUrllib.transform_importcCsí|jdƒ}|j}|jdƒ}|r·t|tƒrF|d}d}x3t|jD]$}|j|dkrZ|d}PqZW|r¤|jt|d|ƒƒqé|j|dƒn2g}i} |d} xÄ| D]¼}|j t j kr|j dj} |j dj} n|j} d} | d krÔxct|jD]T}| |dkr8|d| kro|j |dƒ| j|dgƒj |ƒq8WqÔWg} t|ƒ}d }d d „}xÀ|D]¸}| |}g}x>|dd…D],}|j|||ƒƒ|j tƒƒqæW|j||d|ƒƒt||ƒ}| s[|jjj|ƒrd||_| j |ƒd }q¿W| rÙg}x.| dd…D]}|j|tƒgƒq˜W|j | dƒ|j|ƒn|j|dƒdS)NÚ mod_memberÚmemberrrr*z!This is an invalid module elementr!éú,TcSsz|jtjkrdt|jdjd|ƒ|jdjƒ|jdjƒg}ttj|ƒgSt|jd|ƒgS)Nrr*rr9)Útyper Úimport_as_namerÚchildrenr-Zcloner )r5r*Zkidsr"r"r#Ú handle_name�s z/FixUrllib.transform_member..handle_nameFzAll module elements are invalidr+r+r+r+)r,r*Ú isinstanceÚlistrr-r0rÚcannot_convertr;r r<r=r/Ú setdefaultr r.rrÚparentÚendswithr)r(r1r2r7r3r8Únew_namer ÚmodulesZmod_dictr!Zas_nameÚ member_nameZ new_nodesZ indentationÚfirstr>r)Zeltsr4ZeltÚnewZnodesZnew_noder"r"r#Útransform_member]sh       %       zFixUrllib.transform_membercCs¬|jdƒ}|jdƒ}d}t|tƒr=|d}x3t|jD]$}|j|dkrK|d}PqKW|r˜|jt|d|jƒƒn|j|dƒdS)NÚbare_with_attrr8rrr*z!This is an invalid module element) r,r?r@rr-r0rr*rA)r(r1r2Z module_dotr8rEr r"r"r#Ú transform_dot©s  zFixUrllib.transform_dotcCs«|jdƒr"|j||ƒn…|jdƒrD|j||ƒnc|jdƒrf|j||ƒnA|jdƒrˆ|j|dƒn|jdƒr§|j|dƒdS)Nr)r7rKZ module_starzCannot handle star imports.Z module_asz#This module is now multiple modules)r,r6rJrLrA)r(r1r2r"r"r#Ú transformºszFixUrllib.transformN)Ú__name__Ú __module__Ú __qualname__r$r6rJrLrMr"r"r"r#r%Hs    L r%N)Zlib2to3.fixes.fix_importsrrZlib2to3rZlib2to3.fixer_utilrrrrr r r rr/r$r%r"r"r"r#ÚsD4