o
    n#f                     @   s   d dl mZmZ ddlmZmZ ddlmZmZm	Z	m
Z
mZ ddlmZ dddddddddd	d	eeef d
ee dedee dee dee dee dee dee dee defddZdS )    )OptionalUnion   )EmailSyntaxErrorValidatedEmail)split_emailvalidate_email_local_partvalidate_email_domain_namevalidate_email_domain_literalvalidate_email_length)CASE_INSENSITIVE_MAILBOX_NAMESNF)	allow_smtputf8allow_empty_localallow_quoted_localallow_domain_literalcheck_deliverabilitytest_environmentglobally_deliverabletimeoutdns_resolveremailr   r   r   r   r   r   r   r   r   returnc      	      
   C   s  ddl m}
m}m}m}m}m}m} |du r|
}|du r|}|du r$|}|du r*|}|du r0|}|du r6|}|du r@|	du r@|}t| t	s^z| 
d} W n ty] } ztd|d}~ww t| \}}}t }| |_t||||d}|d |_|d |_|d	 |_|r|std
|jdur|j tv r|jdur|j |_|j |_d}t|dkrtd|dr|drt|dd }|std|d |_|d |_|d |_d}nt|||d}|d |_|d |_|jd |j |_|js|jstd|jpdd |j |_ nd|_ t!| |rA|sA|r"|S ddl"m#} ||j|j||	}|$ D ]\}}t%||| q5|S )z
    Given an email address, and some options, returns a ValidatedEmail instance
    with information about the address if it is valid or, if the address is not
    valid, raises an EmailNotValidError. This is the main function of the module.
    r   )ALLOW_SMTPUTF8ALLOW_QUOTED_LOCALALLOW_DOMAIN_LITERALGLOBALLY_DELIVERABLECHECK_DELIVERABILITYTEST_ENVIRONMENTDEFAULT_TIMEOUTNasciiz%The email address is not valid ASCII.)r   r   quoted_local_part
local_partascii_local_partsmtputf8z7Quoting the part before the @-sign is not allowed here.Fr   z)There must be something after the @-sign.[]z<A bracketed IP address after the @-sign is not allowed here.domaindomain_addressT)r   r   ascii_domain@zMissing ASCII domain. )validate_email_deliverability)&r+   r   r   r   r   r   r   r   
isinstancestrdecode
ValueErrorr   r   r   originalr   r!   r"   r#   lowerr   len
startswithendswithr
   r'   r)   r(   r	   
normalized	Exceptionascii_emailr   deliverabilityr,   itemssetattr)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   er!   domain_partis_quoted_local_partretlocal_part_infois_domain_literaldomain_part_infor,   deliverability_infokeyvalue rF   T/home/ubuntu/dev/venv/lib/python3.10/site-packages/email_validator/validate_email.pyvalidate_email   s   $

	









rH   )typingr   r   exceptions_typesr   r   syntaxr   r   r	   r
   r   rfc_constantsr   r.   bytesboolintobjectrH   rF   rF   rF   rG   <module>   sH    
	
