o
    7Di                     @   s\   d Z ddlZddlmZ ddlmZ eddddddded	ed
edededefddZdS )zeMail.    N   )hostname)	validatorF)ipv6_addressipv4_addresssimple_hostrfc_1034rfc_2782valuer   r   r   r   r	   c            
   C   s   | r	|  ddkrdS | dd\}}t|dkst|dkr!dS |s%|r:|dr8|dr8|dd}ndS td|tj	rQt
t|| | d|||d	S dS )
a  Validate an email address.

    This was inspired from [Django's email validator][1].
    Also ref: [RFC 1034][2], [RFC 5321][3] and [RFC 5322][4].

    [1]: https://github.com/django/django/blob/main/django/core/validators.py#L174
    [2]: https://www.rfc-editor.org/rfc/rfc1034
    [3]: https://www.rfc-editor.org/rfc/rfc5321
    [4]: https://www.rfc-editor.org/rfc/rfc5322

    Examples:
        >>> email('someone@example.com')
        True
        >>> email('bogus@@')
        ValidationError(func=email, args={'value': 'bogus@@'})

    Args:
        value:
            eMail string to validate.
        ipv6_address:
            When the domain part is an IPv6 address.
        ipv4_address:
            When the domain part is an IPv4 address.
        simple_host:
            When the domain part is a simple hostname.
        rfc_1034:
            Allow trailing dot in domain name.
            Ref: [RFC 1034](https://www.rfc-editor.org/rfc/rfc1034).
        rfc_2782:
            Domain name is of type service record.
            Ref: [RFC 2782](https://www.rfc-editor.org/rfc/rfc2782).

    Returns:
        (Literal[True]): If `value` is a valid eMail.
        (ValidationError): If `value` is an invalid eMail.
    @r   F@      []a  (^[\u0100-\u017F\u0180-\u024F\u00A0-\u00FF]|[\u0100-\u017F\u0180-\u024F\u00A0-\u00FF0-9a-z!#$%&'*+/=?^_`{}|~\-]+(\.[\u0100-\u017F\u0180-\u024F\u00A0-\u00FF0-9a-z!#$%&'*+/=?^_`{}|~\-]+)*$|^"([\u0100-\u017F\u0180-\u024F\u00A0-\u00FF\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\011.])*")$)skip_ipv6_addrskip_ipv4_addrmay_have_portmaybe_simpler   r	   )countrsplitlen
startswithendswithlstriprstriprematch
IGNORECASEboolr   )r
   r   r   r   r   r	   username_partdomain_part r!   I/var/www/Datamplify/venv/lib/python3.10/site-packages/validators/email.pyemail   s8   /	r#   )__doc__r   r   utilsr   strr   r#   r!   r!   r!   r"   <module>   s.    