Your IP : 3.144.37.178


Current Path : /opt/alt/python311/lib64/python3.11/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/lib2to3/fixes/__pycache__/fix_urllib.cpython-311.pyc

�

c��f� ����dZddlmZmZddlmZmZmZmZm	Z	m
Z
mZdgd�fdgd�fdd	gfgdgd
�fdddgfgd
�Zed�
edd��d�ZGd�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>�c	#�K�t��}t���D]P\}}|D]H}|\}}t|��}d|�d|�d�V�d|�d|�d|�d�V�d|zV�d	|zV�d
|�d|�d�V��I�QdS)
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/python311/lib64/python3.11/lib2to3/fixes/fix_urllib.py�
build_patternrL0s�����5�5�D�&�}�}���.�.��
�G��	.�	.�F�"(��J�� ��)�)�G�G�$���Z�Z�Z�1�
1�
1�
1�
1�$���W�W�W�g�g�g�7�
7�
7�
7��"�#�
#�
#�
#��"�#�
#�
#�
#�
#�
$���W�W�W�.�
.�
.�
.�
.�!	.�.�.�c�,�eZdZd�Zd�Zd�Zd�Zd�ZdS)�	FixUrllibc�D�d�t����S)N�|)�joinrL)�selfs rKrLzFixUrllib.build_patternIs���x�x�
���(�(�(rMc��|�d��}|j}g}t|jdd�D]:}|�t|d|���t
��g���;|�tt|jdd|�����|�|��dS)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)rS�node�results�
import_mod�pref�names�names       rK�transform_importzFixUrllib.transform_importLs���
�[�[��*�*�
�� �����J�,�-�c�r�c�2�	@�	@�D��L�L�$�t�A�w�t�4�4�4�e�g�g�>�?�?�?�?�
���T�'�*�"2�3�B�7��:�4�H�H�H�I�I�I����5�!�!�!�!�!rMc���|�d��}|j}|�d��}|r�t|t��r|d}d}t|jD]}|j|dvr
|d}n�|r&|�t||�����dS|�|d��dSg}i}	|d}
|
D]�}|j	tjkr%|jd	j}|jdj}n	|j}d}|d
krst|jD]`}||dvrT|d|	vr|�
|d��|	�|dg���
|���a��g}
t|��}d}d�}|D]�}|	|}g}|dd
�D]B}|�|||����|�
t#�����C|�||d
|����t%||��}|r|jj�|��r||_|
�
|��d}��|
rdg}|
dd
�D]%}|�|t+��g���&|�
|
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@rW�!This is an invalid module elementrJ��,Tc�L�|jtjkryt|jdj|���|jd���|jd���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�� 3�3�3� ���q�!1�!7��G�G�G� �M�!�,�2�2�4�4� �M�!�,�2�2�4�4�6�D�!��!4�d�;�;�<�<��T�Z��7�7�7�8�8rMrVFzAll module elements are invalid)rYrX�
isinstance�listrCrZr]r�cannot_convertrlrrmrnr\�
setdefaultr	r[rr�parent�endswithr)rSr^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�&�&���@	M��&�$�'�'�
#������H�!�*�"2�3�
�
���<�6�!�9�,�,�%�a�y�H��E�-��
O��"�"�4���#>�#>�#>�?�?�?�?�?��#�#�D�*M�N�N�N�N�N�
�G��H��i�(�G�!�

N�

N���;�$�"5�5�5�$�o�a�0�6�G�"(�/�!�"4�":�K�K�"(�,�K�"�G��#�%�%�")�*�*:�";�N�N��&�&��)�3�3�%�a�y��8�8� '���v�a�y� 9� 9� 9�$�/�/��q�	�2�>�>�E�E�f�M�M�M����I�*�4�0�0�K��E�
9�
9�
9�"�
�
����'��������9�*�*�C��L�L���S�$�!7�!7�8�8�8��L�L����)�)�)�)����[�[��b��4�8�8�9�9�9� ���/�/���-��� 2� ;� ;�K� H� H�-�!,�C�J�� � ��%�%�%�����
M��� )�#�2�#��8�8�H��L�L�(�G�I�I�!6�7�7�7�7����Y�r�]�+�+�+����U�#�#�#�#�#��#�#�D�*K�L�L�L�L�LrMc�z�|�d��}|�d��}d}t|t��r|d}t|jD]}|j|dvr
|d}n�|r+|�t
||j�����dS|�|d��dS)z.Transform for calls to module members in code.�bare_with_attrrgNrr@rWrh)	rYrrrsrCrZr]rrXrt)rSr^r_�
module_dotrgrxrHs       rK�
transform_dotzFixUrllib.transform_dot�s����[�[�!1�2�2�
����X�&�&�����f�d�#�#�	��A�Y�F��j�.�/�	�	�F��|�v�a�y�(�(�!�!�9����)��	K����t�H�+5�+<� >� >� >�
?�
?�
?�
?�
?�
����&I�J�J�J�J�JrMc���|�d��r|�||��dS|�d��r|�||��dS|�d��r|�||��dS|�d��r|�|d��dS|�d��r|�|d��dSdS)NrUrfr��module_starzCannot handle star imports.�	module_asz#This module is now multiple modules)rYrdr�r�rt)rSr^r_s   rK�	transformzFixUrllib.transform�s���;�;�x� � �
	M��!�!�$��0�0�0�0�0�
�[�[��
&�
&�	M��!�!�$��0�0�0�0�0�
�[�[�)�
*�
*�	M����t�W�-�-�-�-�-�
�[�[��
'�
'�	M�����&C�D�D�D�D�D�
�[�[��
%�
%�	M�����&K�L�L�L�L�L�	M�	MrMN)�__name__�
__module__�__qualname__rLrdr�r�r��rMrKrOrOGsn������)�)�)�"�"�"� JM�JM�JM�XK�K�K�"M�M�M�M�MrMrON)�__doc__�lib2to3.fixes.fix_importsrr�lib2to3.fixer_utilrrrrr	r
rrCr\rLrOr�rMrK�<module>r�s�����=�<�<�<�<�<�<�<�>�>�>�>�>�>�>�>�>�>�>�>�>�>�>�>�>�>�"�C�C�C�D� �?�?�?�@�
 �+�,�.�/�"�'�'�'�
(� ���-�/�
����B�	����'�(�+�A�.�/�/�/�.�.�.�.}M�}M�}M�}M�}M�
�}M�}M�}M�}M�}MrM

?>