|
Server : Apache System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64 User : njnconst ( 1116) PHP Version : 8.4.18 Disable Function : NONE Directory : /usr/lib64/python2.7/site-packages/django/utils/ |
Upload File : |
�
r�\c @ sv d d l m Z d d l m Z d d l m Z e e d � d � Z d � Z d � Z
d � Z d � Z d
� Z
d S( i����( t ValidationError( t
ugettext_lazy( t xranges! This is not a valid IPv6 address.c C s� d } d } d } d } t | � s9 t | d d �� n t | � } t | � } | rp t | � } | rp | Sn | j d � } x� t t | � � D]� } | | j d � | | <| | s� d | | <n | | d k r| d 7} | d k r� | } n | | k r| } | } qq� d } d } q� W| d k r�| | }
|
t | � k r[| d g 7} n d g | | |
+| d k r�d g | } q�n d j | � } | j
� S( sS
Cleans a IPv6 address string.
Validity is checked by calling is_valid_ipv6_address() - if an
invalid address is passed, ValidationError is raised.
Replaces the longest continious zero-sequence with "::" and
removes leading zeroes and makes sure all hextets are lowercase.
Args:
ip_str: A valid IPv6 address.
unpack_ipv4: if an IPv4-mapped address is found,
return the plain IPv4 address (default=False).
error_message: A error message for in the ValidationError.
Returns:
A compressed IPv6 address, or the same value
i����i t codet invalidt :t 0i t ( t is_valid_ipv6_addressR t _explode_shorthand_ip_stringt _sanitize_ipv4_mappingt _unpack_ipv4t splitt ranget lent lstript joint lower( t ip_strt unpack_ipv4t
error_messaget best_doublecolon_startt best_doublecolon_lent doublecolon_startt doublecolon_lent
ipv4_unpackedt hextetst indext best_doublecolon_endt result( ( s3 /tmp/pip-install-XxeQeY/django/django/utils/ipv6.pyt clean_ipv6_address sH
c C s� | j � j d � s | S| j d � } d | d k r<