CasperSecurity

Current Path : /lib/python3.10/lib2to3/fixes/__pycache__/
Upload File :
Current File : //lib/python3.10/lib2to3/fixes/__pycache__/fix_urllib.cpython-310.pyc

o

��bc� �@s�dZddlmZmZddlmZmZmZmZm	Z	m
Z
mZdgd�fdgd�fdd	gfgdgd
�fdddgfgd
�Zed�
edd�dd�ZGdd�de�ZdS)z�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.request)	�	URLopener�FancyURLopener�urlretrieve�
_urlopener�urlopen�
urlcleanup�pathname2url�url2pathname�
getproxieszurllib.parse)�quote�
quote_plus�unquote�unquote_plus�	urlencode�	splitattr�	splithost�
splitnport�splitpasswd�	splitport�
splitquery�splittag�	splittype�	splituser�
splitvaluezurllib.error�ContentTooShortError)r�install_opener�build_opener�Request�OpenerDirector�BaseHandler�HTTPDefaultErrorHandler�HTTPRedirectHandler�HTTPCookieProcessor�ProxyHandler�HTTPPasswordMgr�HTTPPasswordMgrWithDefaultRealm�AbstractBasicAuthHandler�HTTPBasicAuthHandler�ProxyBasicAuthHandler�AbstractDigestAuthHandler�HTTPDigestAuthHandler�ProxyDigestAuthHandler�HTTPHandler�HTTPSHandler�FileHandler�
FTPHandler�CacheFTPHandler�UnknownHandler�URLError�	HTTPError)�urllib�urllib2r>r=�ccsx�t�}t��D]1\}}|D]*}|\}}t|�}d||fVd|||fVd|Vd|Vd||fVqqdS)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)�bare�
old_module�changes�change�
new_module�members�rI�//usr/lib/python3.10/lib2to3/fixes/fix_urllib.py�
build_pattern0s.��������rKc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�	FixUrllibcCsd�t��S)N�|)�joinrK)�selfrIrIrJrKIszFixUrllib.build_patterncCsv|�d�}|j}g}t|jdd�D]}|�t|d|d�t�g�q|�tt|jdd|d��|�|�dS)z�Transform for the basic import case. Replaces the old
           import name with a comma separated list of its
           replacements.
        �moduleN���r��prefix)	�getrSrA�value�extendrr�append�replace)rO�node�results�
import_mod�pref�names�namerIrIrJ�transform_importLs
 zFixUrllib.transform_importcCs|�d�}|j}|�d�}|rDt|t�r|d}d}t|jD]}|j|dvr.|d}nq|r<|�t||d��dS|�|d�dSg}i}	|d}
|
D]D}|j	t
jkrc|jd	j}|jdj}n|j}d}|d
kr�t|jD] }||dvr�|d|	vr�|�
|d�|	�|dg��
|�qqqNg}
t|�}d}dd
�}|D]A}|	|}g}|dd�D]}|�|||��|�
t��q�|�||d|��t||�}|r�|jj�|�r�||_|
�
|�d}q�|
�rg}|
dd�D]
}|�|t�g�q�|�
|
d�|�|�dS|�|d�dS)z�Transform for imports of specific module elements. Replaces
           the module to be imported from with the appropriate new
           module.
        �
mod_member�memberrNr?rR�!This is an invalid module elementrH��,TcSsX|jtjkr$t|jdj|d�|jd��|jd��g}ttj|�gSt|j|d�gS)NrrRr?rc)�typer
�import_as_namer�childrenrU�cloner	)r^rS�kidsrIrIrJ�handle_name�s�z/FixUrllib.transform_member.<locals>.handle_namerQFzAll module elements are invalid)rTrS�
isinstance�listrArUrXr�cannot_convertrer
rfrgrW�
setdefaultrrVrr�parent�endswithr)rOrYrZr`r\ra�new_namerF�modules�mod_dictrH�as_name�member_name�	new_nodes�indentation�firstrjrP�eltsr]�elt�new�nodes�new_noderIrIrJ�transform_member\sl


��

zFixUrllib.transform_membercCs�|�d�}|�d�}d}t|t�r|d}t|jD]}|j|dvr)|d}nq|r8|�t||jd��dS|�|d�dS)z.Transform for calls to module members in code.�bare_with_attrraNrr?rRrb)	rTrkrlrArUrXrrSrm)rOrYrZ�
module_dotrarqrFrIrIrJ�
transform_dot�s


��zFixUrllib.transform_dotcCs�|�d�r
|�||�dS|�d�r|�||�dS|�d�r'|�||�dS|�d�r4|�|d�dS|�d�rA|�|d�dSdS)NrPr`r�module_starzCannot handle star imports.�	module_asz#This module is now multiple modules)rTr_r~r�rm)rOrYrZrIrIrJ�	transform�s




�zFixUrllib.transformN)�__name__�
__module__�__qualname__rKr_r~r�r�rIrIrIrJrLGsLrLN)�__doc__�lib2to3.fixes.fix_importsrr�lib2to3.fixer_utilrrrrrr	r
rArWrKrLrIrIrIrJ�<module>s0$����
����!
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY