%PDF- %PDF-
Direktori : /lib/python3/dist-packages/netaddr/__pycache__/ |
Current File : //lib/python3/dist-packages/netaddr/__pycache__/fbsocket.cpython-312.pyc |
� ӊ�^7 � �N � d Z ddlmZmZ ddlmZmZ dZ dZ d� Zd� Zd� Z d � Zd � Zy)z=Fallback routines for Python's standard library socket module� )�unpack�pack)�_bytes_join�_is_str� � c � � t | � st dt | � z � �t | � dk7 rt d� �dt d| � z S )zR Convert an IP address from 32-bit packed binary format to string format. zstring type expected, not %s� �*invalid length of packed IP address stringz%d.%d.%d.%d�4B)r � TypeError�type�len� ValueError�_unpack)� packed_ips �2/usr/lib/python3/dist-packages/netaddr/fbsocket.py� inet_ntoar sK � � �9���6��i��H�I�I� �9�~����E�F�F��7�4��3�3�3� c �� � g }g }d }d}t | � D ]A \ }}|dk( r |�|}|dz }n|dkD r|j ||f� d }d}|j |� �C |dkD r|j ||f� t |� dk7 rw|j d� �� |d }|D ] }|d |d kD s�|}� |\ } } |d| dgz || | z d z }|d dk( r|j dd� |d dk( r|j d� |S )Nr �0� c � � | d S )Nr � )�xs r �<lambda>z&_compact_ipv6_tokens.<locals>.<lambda>9 s � �Q�q�T� r )�key� ���)� enumerate�appendr �sort�insert)�tokens� new_tokens� positions�start_index� num_tokens�idx�token� best_position�position�length� start_idxs r �_compact_ipv6_tokensr/ sR � ��J��I��K��J� ��'� !� ��U��C�<��"�!���!�O�J��A�~�� � �*�k�!:�;��K��J����%� �!� �A�~����*�k�2�3� �9�~������>��*�!�!�� �!� )�H���{�]�1�-�-� (� � )� ,������)�,��t�3�j��V�AS�AT�6U�U� � �a�=�B�����a��$��b�>�R�����b�!��r c �D � | t k( rt |� S | t k( r�t |� dk7 st |� st d� �t d|� D �cg c] }d|z �� }}t t d|� � }d}t t |� � D ] \ }}|}|d|z z }||z }� d|cxk rdk s n |dz dk( r;t d g|d d D �cg c] }t |d� �� c}��� }t |� } |dd | gz }dj t |� � S t d | z � �c c}w c c}w )zBConvert an packed IP address of the given family to string format.� r z>8H�%xr � l �� � z>2H���N�:zunknown address family %d)�AF_INETr �AF_INET6r r r r �listr �reversed�_pack�int�joinr/ ) �afr �ir$ �words�int_val�num�word�packed_ipv4�ipv4_strs r � inet_ntoprF L s4 � � �W�}���#�#� �x���y�>�R��w�y�'9��I�J�J�$+�E�9�$=�>�q�$��(�>��>� �W�U�I�.�/��������0� %�F�A�s��D��2��6�>�D���n�G� %� �G�)�z�)�W��]�f�-D���J�V�B�C�[�(I���Q���(I�J�K� ��-�H��A�b�\�X�J�.�F��x�x�,�V�4�5�5��4�r�9�:�:��% ?�� )Js �D�D c � � t | � r�t d| z � }| j d� }t |� dk( rwg }|D ]e }|j d� s|j d� rt |� dkD r|� t |� }|dz dk7 r|�|j t d |� � �g t |� S |�t d t | � z � �# t $ r |�w xY w)a Convert an IP address in string format (123.45.67.89) to the 32-bit packed binary format used in low-level network functions. Differs from inet_aton by only support decimal octets. Using octal or hexadecimal values will raise a ValueError exception. �illegal IP address string %r�.r �0xr r � r �Bz#argument should be a string, not %s) r r �splitr � startswithr<