AlkantarClanX12
Current Path : /proc/self/root/lib/python3.6/site-packages/dns/__pycache__/ |
Current File : //proc/self/root/lib/python3.6/site-packages/dns/__pycache__/e164.cpython-36.pyc |
3 �b�WK � @ s\ d Z ddlZddlZddlZddlmZ ejjd�Z e fdd�Z e dfd d �Zd dd�ZdS )z�DNS E.164 helpers @var public_enum_domain: The DNS public ENUM domain, e164.arpa. @type public_enum_domain: dns.name.Name object � N� )�string_typesz e164.arpa.c C s, dd� | D �}|j � tjjdj|�|d�S )au Convert an E.164 number in textual form into a Name object whose value is the ENUM domain name for that number. @param text: an E.164 number in textual form. @type text: str @param origin: The domain in which the number should be constructed. The default is e164.arpa. @type origin: dns.name.Name object or None @rtype: dns.name.Name object c S s g | ]}|j � r|�qS � )�isdigit)�.0�dr r �/usr/lib/python3.6/e164.py� <listcomp>) s zfrom_e164.<locals>.<listcomp>�.)�origin)�reverse�dns�name� from_text�join)�textr �partsr r r � from_e164 s r Tc C sb |dk r| j |�} dd� | jD �}t|�t| j�kr@tjjd��|j� dj|�}|r^d| }|S )a� Convert an ENUM domain name into an E.164 number. @param name: the ENUM domain name. @type name: dns.name.Name object. @param origin: A domain containing the ENUM domain name. The name is relativized to this domain before being converted to text. @type origin: dns.name.Name object or None @param want_plus_prefix: if True, add a '+' to the beginning of the returned number. @rtype: str Nc S s$ g | ]}|j � rt|�d kr|�qS )r )r �len)r r r r r r ; s zto_e164.<locals>.<listcomp>z$non-digit labels in ENUM domain name� � +)Z relativizeZlabelsr r Z exception�SyntaxErrorr r )r r Zwant_plus_prefixZdlabelsr r r r �to_e164. s r c C s� |dkrt jj� }t jj� }xl|D ]d}t|t�r<t jj|�}t jj | |�}y|j |d�S t jjk r� } z||7 }W Y dd}~X q"X q"W |�dS )z�Look for NAPTR RRs for the specified number in the specified domains. e.g. lookup('16505551212', ['e164.dnspython.org.', 'e164.arpa.']) NZNAPTR)r �resolverZget_default_resolverZNXDOMAIN� isinstancer r r Ze164r �query)ZnumberZdomainsr Ze_nxZdomainZqname�er r r r E s r )N) �__doc__Z dns.exceptionr Zdns.nameZdns.resolverZ_compatr r r Zpublic_enum_domainr r r r r r r �<module> s