%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/internet/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/internet/__pycache__/_resolver.cpython-312.pyc

�

Ϫ�f�%�
�d�dZddlmZmZmZmZmZmZmZm	Z	m
Z
ddlmZm
Z
mZmZmZmZmZmZmZddlmZddlmZddlmZmZddlmZddlmZdd	l m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&dd
l'm(Z(ddl)m*Z*ddl+m,Z,erdd
l-m.Z.ee#�Gd�d��Z/e0eeg�Z1e0eg�ee0eg�ee1eiZ2eeeeiZ3eed�Z4edediZ5eeeee6e7eee7e6fee7e6e6e6fffZ8ee"�Gd�d��Z9ee"�Gd�d��Z:ee%�Gd�d��Z;ee&�Gd�d��Z<y)z=
IPv6-aware hostname resolution.

@see: L{IHostnameResolver}
�)	�AF_INET�AF_INET6�	AF_UNSPEC�
SOCK_DGRAM�SOCK_STREAM�
AddressFamily�
SocketKind�gaierror�getaddrinfo)	�
TYPE_CHECKING�Callable�List�NoReturn�Optional�Sequence�Tuple�Type�Union)�implementer)�
_idnaBytes)�IPv4Address�IPv6Address)�Deferred)�DNSLookupError)�IAddress�IHostnameResolver�IHostResolution�IReactorThreads�IResolutionReceiver�IResolverSimple)�deferToThreadPool)�Logger)�nativeString)�
ThreadPoolc�(�eZdZdZdefd�Zdefd�Zy)�HostResolutionz9
    The in-progress resolution of a given hostname.
    �namec��||_y)zA
        Create a L{HostResolution} with the given name.
        N)r')�selfr's  �</usr/lib/python3/dist-packages/twisted/internet/_resolver.py�__init__zHostResolution.__init__?s����	��returnc��t���N)�NotImplementedError�r)s r*�cancelzHostResolution.cancelEs��!�#�#r,N)�__name__�
__module__�__qualname__�__doc__�strr+rr2�r,r*r&r&9s����S��$��$r,r&)�TCP�UDPr9r:c
��eZdZdZdefdedeegdfdeee	e	e	ge
ffd�Z			dded	ed
e	dee
eeded
efd�Zy)�GAIResolverzp
    L{IHostnameResolver} implementation that resolves hostnames by calling
    L{getaddrinfo} in a thread.
    N�reactor�
getThreadPoolr$rc�J�||_|�|jn||_||_y)a�
        Create a L{GAIResolver}.

        @param reactor: the reactor to schedule result-delivery on
        @type reactor: L{IReactorThreads}

        @param getThreadPool: a function to retrieve the thread pool to use for
            scheduling name resolutions.  If not supplied, the use the given
            C{reactor}'s thread pool.
        @type getThreadPool: 0-argument callable returning a
            L{twisted.python.threadpool.ThreadPool}

        @param getaddrinfo: a reference to the L{getaddrinfo} to use - mainly
            parameterized for testing.
        @type getaddrinfo: callable with the same signature as L{getaddrinfo}
        N)�_reactorr>�_getThreadPool�_getaddrinfo)r)r=r>rs    r*r+zGAIResolver.__init__ts-��, ��
�%2�%:�G�!�!�
�	
��(��r,�resolutionReceiver�hostName�
portNumber�addressTypes�transportSemanticsr-c�8��������j�}t|�tn
t|��t|�dt
f�����fd�}t
�j||�}t��}	�j|	�|jdt
ddf�fd��}
|	S)�<
        See L{IHostnameResolver.resolveHostName}

        @param resolutionReceiver: see interface

        @param hostName: see interface

        @param portNumber: see interface

        @param addressTypes: see interface

        @param transportSemantics: see interface

        @return: see interface
        Nr-c�P��	�j�����S#t$rgcYSwxYwr/)rBr
)�
addressFamilyrDrEr)�
socketTypes�����r*�getz(GAIResolver.resolveHostName.<locals>.get�s:���
��(�(��j�-������
��	�
�s��%�%�resultc	���|D]=\}}}}}t|}�j|tj|d�g|�����?�j	�y�Nr9)�	_afToType�addressResolved�_socktypeToTyperM�resolutionComplete)rN�family�socktype�proto�	cannoname�sockaddr�addrTyperCs       �r*�deliverResultsz3GAIResolver.resolveHostName.<locals>.deliverResults�s]���@F�
�<���%��H�$�V�,��"�2�2��_�0�0��5�A�M�H�M��
�

�1�1�3r,)rA�
_typesToAF�_any�	frozenset�_transportToSocket�_GETADDRINFO_RESULTr!r@r&�resolutionBegan�addCallback)
r)rCrDrErFrG�poolrM�d�
resolutionr[rKrLs
````       @@r*�resolveHostNamezGAIResolver.resolveHostName�s����.�"�"�$��"� �(�D�i��.E�
�
�(�(:�;�
�	�(�	�	�
�d�m�m�T�3�7��#�H�-�
��*�*�:�6�	
���	4�#6�	4�4�	4�
�	4��r,�rNr9)r3r4r5r6rrrr
r7�intr`r+rrrrrrfr8r,r*r<r<ms����?C�KV�	(� �(� ���\�)9� :�;�(��s�C��c�2�4G�G�H�	(�@�;?�"'�
2�/�2��2��	2�
�x��X��7�8�2� �
2�
�2r,r<c
�d�eZdZdZe�Zdefd�Z			ddede	de
deee
ed	e	d
efd�Zy)
�SimpleResolverComplexifierzF
    A converter from L{IResolverSimple} to L{IHostnameResolver}.
    �simpleResolverc��||_y)zW
        Construct a L{SimpleResolverComplexifier} with an L{IResolverSimple}.
        N)�_simpleResolver)r)rks  r*r+z#SimpleResolverComplexifier.__init__�s�� .��r,NrCrDrErFrGr-c�Z�����	�jd�}t|��t	��}�j|��jj��j��fd��j��fd��j�fd��|S#t$rt��}Y��wxYw)rI�asciic�<���jtd|���SrP)rRr)�addressrErCs ��r*�<lambda>z<SimpleResolverComplexifier.resolveHostName.<locals>.<lambda>�s��� 2� B� B���w�
�;�!�r,c���|jt�rdS�jjd|��j��S)Nz'while looking up {name} with {resolver})r'�resolver)�checkr�_log�failurerm)�errorrDr)s ��r*rrz<SimpleResolverComplexifier.resolveHostName.<locals>.<lambda>sD����;�;�~�.�#���Y�Y�&�&�=��!�!�1�1�	'��r,c�$���j�Sr/)rT)�nothingrCs �r*rrz<SimpleResolverComplexifier.resolveHostName.<locals>.<lambda>
s���);�)N�)N�)P�r,)
�encode�UnicodeEncodeErrorrr#r&rarm�
getHostByNamerb�
addErrback)r)rCrDrErFrG�hostName_bytesres````    r*rfz*SimpleResolverComplexifier.resolveHostName�s����0	2�%�_�_�W�5�N� ��/��#�H�-�
��*�*�:�6�� � �.�.�x�8�
�[���
�Z��	��[�P�
Q����?"�	2�
(��1�N�	2�s�B�B*�)B*rg)r3r4r5r6r"rvr r+rr7rhrrrrrrfr8r,r*rjrj�st����8�D�.��.��;?�"'�
9�/�9��9��	9�
�x��X��7�8�9� �
9�
�9r,rjc�@�eZdZdZd
d�Zdeddfd�Zdeddfd�Zdd	�Z	y)�FirstOneWinszT
    An L{IResolutionReceiver} which fires a L{Deferred} with its first result.
    c� �||_d|_y)zp
        @param deferred: The L{Deferred} to fire when the first resolution
            result arrives.
        FN)�	_deferred�	_resolved)r)�deferreds  r*r+zFirstOneWins.__init__s��
"�����r,rer-Nc��||_y)z�
        See L{IResolutionReceiver.resolutionBegan}

        @param resolution: See L{IResolutionReceiver.resolutionBegan}
        N)�_resolution)r)res  r*razFirstOneWins.resolutionBegans��&��r,rqc��|jryd|_t|t�sJ�|jj	|j
�y)z�
        See L{IResolutionReceiver.addressResolved}

        @param address: See L{IResolutionReceiver.addressResolved}
        NT)r��
isinstancerr��callback�host)r)rqs  r*rRzFirstOneWins.addressResolved%s=���>�>������'�;�/�/�/���������-r,c��|jry|jjt|jj
��y)z?
        See L{IResolutionReceiver.resolutionComplete}
        N)r�r��errbackrr�r'r1s r*rTzFirstOneWins.resolutionComplete3s1���>�>�������~�d�.>�.>�.C�.C�D�Er,)r��
Deferred[str])r-N)
r3r4r5r6r+rrarrRrTr8r,r*r�r�s8����&�/�&�d�&�.�x�.�D�.�Fr,r�c�8�eZdZdZdefd�Zd
dedeeddfd�Z	y	)�ComplexResolverSimplifierzE
    A converter from L{IHostnameResolver} to L{IResolverSimple}
    �nameResolverc��||_y)z�
        Create a L{ComplexResolverSimplifier} with an L{IHostnameResolver}.

        @param nameResolver: The L{IHostnameResolver} to use.
        N)�
_nameResolver)r)r�s  r*r+z"ComplexResolverSimplifier.__init__Bs��*��r,r'�timeoutsr-r�c�r�t�}|jjt|�|dtg�|S)z�
        See L{IResolverSimple.getHostByName}

        @param name: see L{IResolverSimple.getHostByName}

        @param timeouts: see L{IResolverSimple.getHostByName}

        @return: see L{IResolverSimple.getHostByName}
        r)rr�rfr�r)r)r'r�rNs    r*r}z'ComplexResolverSimplifier.getHostByNameJs1��#+�*�����*�*�<��+?��q�;�-�X��
r,N)r8)
r3r4r5r6rr+r7rrhr}r8r,r*r�r�<s2���*�%6�*��#���#����r,r�N)=r6�socketrrrrrrr	r
r�typingrr
rrrrrrr�zope.interfacer�twisted.internet._idnar�twisted.internet.addressrr�twisted.internet.deferr�twisted.internet.errorr�twisted.internet.interfacesrrrrrr �twisted.internet.threadsr!�twisted.loggerr"�twisted.python.compatr#�twisted.python.threadpoolr$r&r^r]r\rQr_rSrhr7r`r<rjr�r�r8r,r*�<module>r�s���
�
�
�
�
�
�
�'�-�=�+�1���7�!�.��4�
�_��
$�
$��
$� �+�{�+�,���{�m��g�
�{�m��h��)��
��[��k�
�	������������	�����
�e�C��H�o�u�S�#�s�C�%7�8�8�9�		;����
�
��T�T� �T�n
�
��F�F� �F�R
�
 �!�)F�)F�"�)F�X
�_�����r,

Zerion Mini Shell 1.0