o
    ×ŸŽi5  ã                   @   s>   d dl Z d dlmZ d dlmZ dedƒfdd„Zdd	„ ZdS )
é    N)ÚValidationError)Úgettext_lazyFz!This is not a valid IPv6 address.c                 C   sd   zt  tt  | ¡ƒ¡}W n ty   t|dd�‚w |r$|jr$t|jƒS |jr.dt|jƒ S t|ƒS )aý  
    Clean an IPv6 address string.

    Raise ValidationError if the address is invalid.

    Replace the longest continuous zero-sequence with "::", remove leading
    zeroes, and make 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: An error message used in the ValidationError.

    Return a compressed IPv6 address or the same value.
    Úinvalid)Úcodez	::ffff:%sN)Ú	ipaddressÚIPv6AddressÚintÚ
ValueErrorr   Úipv4_mappedÚstr)Úip_strZunpack_ipv4Úerror_messageÚaddr© r   ú[C:\Users\psant\Downloads\Anu Raj Backend\school\venv\Lib\site-packages\django/utils/ipv6.pyÚclean_ipv6_address   s   ÿ

r   c                 C   s&   zt  | ¡ W dS  ty   Y dS w )zL
    Return whether or not the `ip_str` string is a valid IPv6 address.
    FTN)r   r   r	   )r   r   r   r   Úis_valid_ipv6_address'   s   þÿr   )r   Zdjango.core.exceptionsr   Zdjango.utils.translationr   Ú_r   r   r   r   r   r   Ú<module>   s    
ÿ 