HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/dns/__pycache__/e164.cpython-310.pyc
o

!we��	@s�dZddlmZmZmZddlZddlZddlZej	�
d�Zefdedeej	j
dej	j
fdd	�Zed
fdej	j
deej	j
dedefd
d�Z	ddedeeej	j
efdeejjdejjfdd�ZdS)zDNS E.164 helpers.�)�Iterable�Optional�UnionNz
e164.arpa.�text�origin�returncCs,dd�|D�}|��tjjd�|�|d�S)a�Convert an E.164 number in textual form into a Name object whose
    value is the ENUM domain name for that number.

    Non-digits in the text are ignored, i.e. "16505551212",
    "+1.650.555.1212" and "1 (650) 555-1212" are all the same.

    *text*, a ``str``, is an E.164 number in textual form.

    *origin*, a ``dns.name.Name``, the domain in which the number
    should be constructed.  The default is ``e164.arpa.``.

    Returns a ``dns.name.Name``.
    cSsg|]}|��r|�qS�)�isdigit��.0�drr�A/home/arjun/projects/env/lib/python3.10/site-packages/dns/e164.py�
<listcomp>/szfrom_e164.<locals>.<listcomp>�.)r)�reverse�dns�name�	from_text�join)rr�partsrrr
�	from_e164srTr�want_plus_prefixcCsf|dur	|�|�}dd�|jD�}t|�t|j�kr tj�d��|��d�|�}|r/d|}|��S)a�Convert an ENUM domain name into an E.164 number.

    Note that dnspython does not have any information about preferred
    number formats within national numbering plans, so all numbers are
    emitted as a simple string of digits, prefixed by a '+' (unless
    *want_plus_prefix* is ``False``).

    *name* is a ``dns.name.Name``, the ENUM domain name.

    *origin* is a ``dns.name.Name``, a domain containing the ENUM
    domain name.  The name is relativized to this domain before being
    converted to text.  If ``None``, no relativization is done.

    *want_plus_prefix* is a ``bool``.  If True, add a '+' to the beginning of
    the returned number.

    Returns a ``str``.

    NcSs$g|]}|��rt|�dkr|�qS)�)r	�lenr
rrr
rNs$zto_e164.<locals>.<listcomp>z$non-digit labels in ENUM domain name��+)	�
relativize�labelsrr�	exception�SyntaxErrorrr�decode)rrr�dlabelsrrrr
�to_e1644s

r"�number�domains�resolvercCs�|dur	tj��}tj��}|D]5}t|t�rtj�|�}tj�	||�}z	|�
|d�WStjjyE}z
||7}WYd}~qd}~ww|�)a~Look for NAPTR RRs for the specified number in the specified domains.

    e.g. lookup('16505551212', ['e164.dnspython.org.', 'e164.arpa.'])

    *number*, a ``str`` is the number to look for.

    *domains* is an iterable containing ``dns.name.Name`` values.

    *resolver*, a ``dns.resolver.Resolver``, is the resolver to use.  If
    ``None``, the default resolver is used.
    N�NAPTR)rr%�get_default_resolver�NXDOMAIN�
isinstance�strrr�e164r�resolve)r#r$r%�e_nx�domain�qname�errr
�queryXs


��r1)N)�__doc__�typingrrr�
dns.exceptionr�dns.name�dns.resolverrr�public_enum_domainr*�Namer�boolr"r%�Resolver�Answerr1rrrr
�<module>sF��
�
���
��
�'���
��