ok
Direktori : /lib64/python3.6/lib2to3/fixes/__pycache__/ |
Current File : //lib64/python3.6/lib2to3/fixes/__pycache__/fix_urllib.cpython-36.opt-1.pyc |
3 \� � @ s� d Z ddlmZmZ ddlmZmZmZmZm Z m Z mZ dddddd d ddgfd dddddddddddddddgfddgfgdd dd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5gfdd6d7gfgd8�Zed9 j ed: d; � d<d=� ZG d>d?� d?e�Zd@S )Az�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. � )� alternates� FixImports)�Name�Comma� FromImport�Newline�find_indentation�Node�symszurllib.requestZ URLopenerZFancyURLopenerZurlretrieveZ _urlopenerZurlopenZ urlcleanupZpathname2urlZurl2pathnamezurllib.parseZquoteZ quote_plusZunquoteZunquote_plusZ urlencodeZ splitattrZ splithostZ splitnportZsplitpasswdZ splitportZ splitqueryZsplittagZ splittypeZ splituserZ splitvaluezurllib.errorZContentTooShortErrorZinstall_openerZbuild_openerZRequestZOpenerDirectorZBaseHandlerZHTTPDefaultErrorHandlerZHTTPRedirectHandlerZHTTPCookieProcessorZProxyHandlerZHTTPPasswordMgrZHTTPPasswordMgrWithDefaultRealmZAbstractBasicAuthHandlerZHTTPBasicAuthHandlerZProxyBasicAuthHandlerZAbstractDigestAuthHandlerZHTTPDigestAuthHandlerZProxyDigestAuthHandlerZHTTPHandlerZHTTPSHandlerZFileHandlerZ FTPHandlerZCacheFTPHandlerZUnknownHandlerZURLErrorZ HTTPError)�urllib�urllib2r r � c c s~ t � } xrtj� D ]f\}}x\|D ]T}|\}}t|�}d||f V d|||f V d| V d| V d||f V qW qW d S )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 �0/usr/lib64/python3.6/lib2to3/fixes/fix_urllib.py� build_pattern0 s r c @ s4 e Zd Zdd� Zdd� Zdd� Zdd� Zd d � ZdS )� FixUrllibc C s dj t� �S )N�|)�joinr )�selfr r r r I s zFixUrllib.build_patternc C sz |j d�}|j}g }x6t|j dd� D ] }|jt|d |d�t� g� q(W |jtt|j d d |d�� |j|� dS )z�Transform for the basic import case. Replaces the old import name with a comma separated list of its replacements. �moduleNr r )�prefix���r ) �getr r �value�extendr r �append�replace)r �node�resultsZ import_mod�pref�names�namer r r �transform_importL s zFixUrllib.transform_importc C s> |j d�}|j}|j d�}|r�t|t�r0|d }d}x*t|j D ]}|j|d kr@|d }P q@W |rx|jt||d�� n| j|d� �n�g }i } |d } x�| D ]�}|j t jkr�|jd j}|jd j}n |j}d}|d kr�xPt|j D ]B}||d kr�|d | k�r|j |d � | j|d g �j |� q�W q�W g } t|�}d}dd � }x�|D ]�}| | }g }x2|dd� D ]"}|j|||�� |j t� � �qlW |j||d |�� t||�}| �s�|jjj|��r�||_| j |� d}�qNW | �r.g }x&| dd� D ]}|j|t� g� �q�W |j | d � |j|� n| j|d� dS )z�Transform for imports of specific module elements. Replaces the module to be imported from with the appropriate new module. � mod_member�memberr Nr )r z!This is an invalid module elementr � �,Tc S sX | j tjkrHt| jd j|d�| jd j� | jd j� g}ttj|�gS t| j|d�gS )Nr )r r r* )�typer �import_as_namer �childrenr Zcloner )r&