Your IP : 3.22.242.169


Current Path : /opt/alt/python312/lib64/python3.12/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/lib2to3/fixes/__pycache__/fix_urllib.cpython-312.opt-1.pyc

�

�Q�f� ����dZddlmZmZddlmZmZmZmZm	Z	m
Z
mZdgd�fdgd�fdd	gfgdgd
�fdddgfgd
�Zedjedd�d�ZGd�de�Zy)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>�c	#��K�t�}tj�D]N\}}|D]D}|\}}t|�}d|�d|�d���d|�d|�d|�d���d|z��d	|z��d
|�d|�d����F�Py�w)
Nzimport_name< 'import' (module=zB
                                  | dotted_as_names< any* module=z any* >) >
                  zimport_from< 'from' mod_member=z* 'import'
                       ( member=z | import_as_name< member=z] '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 > >
                  zpower< bare_with_attr=z trailer< '.' member=z > any* >
                  )�set�MAPPING�itemsr)�bare�
old_module�changes�change�
new_module�memberss      �?/opt/alt/python312/lib64/python3.12/lib2to3/fixes/fix_urllib.py�
build_patternrL0s������5�D�&�}�}���
�G��F�"(��J�� ��)�G�$�Z�1�
1�$�W�g�7�
7��"�#�
#��"�#�
#�
$�W�.�
.�!� /�s�A1A3c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�	FixUrllibc�4�djt��S)N�|)�joinrL)�selfs rKrLzFixUrllib.build_patternIs���x�x�
��(�(�c�R�|jd�}|j}g}t|jddD]+}|j	t|d|��t
�g��-|jtt|jdd|���|j|�y)z�Transform for the basic import case. Replaces the old
           import name with a comma separated list of its
           replacements.
        �moduleN���r��prefix)	�getrXrC�value�extendrr�append�replace)rR�node�results�
import_mod�pref�names�names       rK�transform_importzFixUrllib.transform_importLs���
�[�[��*�
�� � �����J�,�,�-�c�r�2�D��L�L�$�t�A�w�t�4�e�g�>�?�3�
���T�'�*�"2�"2�3�B�7��:�4�H�I����5�!rSc�D�|jd�}|j}|jd�}|ryt|t�r|d}d}t|j
D]}|j
|dvs�|d}n|r|j
t||���y|j|d�yg}i}	|d}
|
D]�}|jtjk(r3|jd	j
}|jdj
}n|j
}d}|d
k7s�gt|j
D]I}||dvs�|d|	vr|j|d�|	j|dg�j|��K��g}
t|�}d}d�}|D]�}|	|}g}|dd
D]3}|j!|||��|jt#���5|j!||d
|��t%||�}|r%|j&jj)|�r||_|
j|�d}��|
rMg}|
dd
D]}|j!|t+�g��|j|
d
�|j
|�y|j|d�y)z�Transform for imports of specific module elements. Replaces
           the module to be imported from with the appropriate new
           module.
        �
mod_member�memberrNr@rW�!This is an invalid module elementrJ��,Tc�\�|jtjk(rxt|jdj
|��|jdj
�|jdj
�g}ttj|�gSt|j
|��gS)NrrWr@ri)�typer�import_as_namer�childrenrZ�cloner
)rcrX�kidss   rK�handle_namez/FixUrllib.transform_member.<locals>.handle_name�s����9�9�� 3� 3�3� ����q�!1�!7�!7��G� �M�M�!�,�2�2�4� �M�M�!�,�2�2�4�6�D�!��!4�!4�d�;�<�<��T�Z�Z��7�8�8rSrVFzAll module elements are invalid)rYrX�
isinstance�listrCrZr]r�cannot_convertrlrrmrnr\�
setdefaultr	r[rr�parent�endswithr)rRr^r_rfrarg�new_namerH�modules�mod_dictrJ�as_name�member_name�	new_nodes�indentation�firstrqrU�eltsrb�elt�new�nodes�new_nodes                        rK�transform_memberzFixUrllib.transform_member\s���
�[�[��.�
�� � �����X�&����&�$�'������H�!�*�"2�"2�3���<�<�6�!�9�,�%�a�y�H��4���"�"�4���#>�?��#�#�D�*M�N�
�G��H��i�(�G�!���;�;�$�"5�"5�5�$�o�o�a�0�6�6�G�"(�/�/�!�"4�":�":�K�"(�,�,�K�"�G��#�%�")�*�*:�*:�";��&�&��)�3�%�a�y��8� '���v�a�y� 9�$�/�/��q�	�2�>�E�E�f�M�	#<�"��I�*�4�0�K��E�
9�"����'�������9�C��L�L��S�$�!7�8��L�L���)�%����[��b��4�8�9� ���/������ 2� 2� ;� ;�K� H�!,�C�J�� � ��%���"���� )�#�2��H��L�L�(�G�I�!6�7�!/����Y�r�]�+����U�#��#�#�D�*K�LrSc�L�|jd�}|jd�}d}t|t�r|d}t|jD]}|j|dvs�|d}n|r'|jt
||j���y|j|d�y)z.Transform for calls to module members in code.�bare_with_attrrgNrr@rWrh)	rYrrrsrCrZr]rrXrt)rRr^r_�
module_dotrgrxrHs       rK�
transform_dotzFixUrllib.transform_dot�s����[�[�!1�2�
����X�&�����f�d�#��A�Y�F��j�.�.�/�F��|�|�v�a�y�(�!�!�9���0�����t�H�+5�+<�+<� >�
?�
����&I�JrSc�l�|jd�r|j||�y|jd�r|j||�y|jd�r|j||�y|jd�r|j	|d�y|jd�r|j	|d�yy)NrUrfr��module_starzCannot handle star imports.�	module_asz#This module is now multiple modules)rYrdr�r�rt)rRr^r_s   rK�	transformzFixUrllib.transform�s����;�;�x� ��!�!�$��0�
�[�[��
&��!�!�$��0�
�[�[�)�
*����t�W�-�
�[�[��
'�����&C�D�
�[�[��
%�����&K�L�&rSN)�__name__�
__module__�__qualname__rLrdr�r�r��rSrKrNrNGs ��)�"� JM�XK�"MrSrNN)�__doc__�lib2to3.fixes.fix_importsrr�lib2to3.fixer_utilrrrrr	r
rrCr\rLrNr�rSrK�<module>r�s����=�>�>�>�"�C�D� �?�@�
 �+�,�.�/�"�'�
(� ���-�/�
���B�	����'�(�+�A�.�/�.�.}M�
�}MrS

?>