o
    Òó·i¹  ã                   @   s.  d Z ddlZddlmZmZ ddlmZ ddlmZ ddl	Z	ddl
mZ ddlmZ ddlmZmZ dd	lmZ eeƒe	jd
d
d�G dd„ dƒƒƒZeeƒe	jd
d
d�G dd„ dƒƒƒZeeƒG dd„ dƒƒZe	jd
d
d�eeƒG dd„ dƒƒƒZe	jdddd
d�eeƒG dd„ dƒƒƒZG dd„ deƒZdS )z*
Address objects for network connections.
é    N)ÚOptionalÚUnion)Úwarn)Úimplementer)ÚLiteral)ÚIAddress)Ú_asFilesystemBytesÚ_coerceToFilesystemEncoding)ÚplatformT)Úunsafe_hashÚauto_attribsc                   @   sR   e Zd ZU dZejej ddg¡d�Ze	e
d e
d f ed< eed< eed< dS )	ÚIPv4Addressat  
    An L{IPv4Address} represents the address of an IPv4 socket endpoint.

    @ivar type: A string describing the type of transport, either 'TCP' or
        'UDP'.

    @ivar host: A string containing a dotted-quad IPv4 address; for example,
        "127.0.0.1".
    @type host: C{str}

    @ivar port: An integer representing the port number.
    @type port: C{int}
    ÚTCPÚUDP©Z	validatorÚtypeÚhostÚportN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚattrÚibÚ
validatorsÚin_r   r   r   Ú__annotations__ÚstrÚint© r   r   ú^C:\Users\psant\Downloads\PAF backend\school\venv\Lib\site-packages\twisted/internet/address.pyr      s   
 ÿr   c                   @   sr   e Zd ZU dZejej ddg¡d�Ze	e
d e
d f ed< eed< eed< dZeed	< dZe	eef ed
< dS )ÚIPv6Addressaõ  
    An L{IPv6Address} represents the address of an IPv6 socket endpoint.

    @ivar type: A string describing the type of transport, either 'TCP' or
        'UDP'.

    @ivar host: A string containing a colon-separated, hexadecimal formatted
        IPv6 address; for example, "::1".
    @type host: C{str}

    @ivar port: An integer representing the port number.
    @type port: C{int}

    @ivar flowInfo: the IPv6 flow label.  This can be used by QoS routers to
        identify flows of traffic; you may generally safely ignore it.
    @type flowInfo: L{int}

    @ivar scopeID: the IPv6 scope identifier - roughly analagous to what
        interface traffic destined for this address must be transmitted over.
    @type scopeID: L{int} or L{str}
    r   r   r   r   r   r   r   ÚflowInfoÚscopeIDN)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r"   r#   r   r   r   r    r!   /   s   
 ÿr!   c                   @   s   e Zd ZdZdS )Ú_ProcessAddresszD
    An L{interfaces.IAddress} provider for process transports.
    N)r   r   r   r   r   r   r   r    r$   Q   s    r$   c                   @   s"   e Zd ZU dZeed< eed< dS )ÚHostnameAddressa  
    A L{HostnameAddress} represents the address of a L{HostnameEndpoint}.

    @ivar hostname: A hostname byte string; for example, b"example.com".
    @type hostname: L{bytes}

    @ivar port: An integer representing the port number.
    @type port: L{int}
    Úhostnamer   N)r   r   r   r   Úbytesr   r   r   r   r   r    r%   X   s   
 
r%   F)r   ÚreprÚeqr   c                   @   s€   e Zd ZU dZejej e¡d�Z	e
e ed< eejddƒdur*dedefdd	„Zn	dedefd
d	„Zdefdd„Zdd„ ZdS )ÚUNIXAddressz‰
    Object representing a UNIX socket endpoint.

    @ivar name: The filename associated with this socket.
    @type name: C{bytes}
    )Ú	converterÚnameÚsamefileNÚotherÚreturnc              
   C   sŽ   t || jƒstS | j|jk}|sE| jrE|jrEz
tj | j|j¡W S  ty*   Y |S  tt	fyD } zt
 ¡ s9|‚W Y d}~|S d}~ww |S )zŒ
            Overriding C{attrs} to ensure the os level samefile
            check is done if the name attributes do not match.
            N)Ú
isinstanceÚ	__class__ÚNotImplementedr,   ÚosÚpathr-   ÚOSErrorÚ	TypeErrorÚ
ValueErrorr
   ZisLinux)Úselfr.   ÚresÚer   r   r    Ú__eq__y   s"   û
ÿ€ûzUNIXAddress.__eq__c                 C   s   t || jƒr| j|jkS tS ©N)r0   r1   r,   r2   )r8   r.   r   r   r    r;   �   s   c                 C   s(   | j }|d urtd|ƒnd }d|›d�S )NÚ zUNIXAddress(ú))r,   r	   )r8   r,   Úshowr   r   r    Ú__repr__”   s   zUNIXAddress.__repr__c                 C   sT   | j d u rt| jd fƒS zt | j ¡}t|j|jfƒW S  ty)   t| j ƒ Y S w r<   )r,   Úhashr1   r3   ÚstatÚst_inoÚst_devr5   )r8   Ús1r   r   r    Ú__hash__™   s   
ÿzUNIXAddress.__hash__)r   r   r   r   r   r   Ú
convertersÚoptionalr   r,   r   r'   r   Úgetattrr3   r4   ÚobjectÚboolr;   r   r@   rF   r   r   r   r    r*   i   s   
 
ÿr*   c                   @   s"   e Zd ZdZdedefdd„ZdS )Ú_ServerFactoryIPv4Addressz@Backwards compatibility hack. Just like IPv4Address in practice.r.   r/   c                 C   s^   t |tƒrtdtdd� | j| jf|kS t |tƒr-| j| j| jf}|j|j|jf}||kS tS )Nz?IPv4Address.__getitem__ is deprecated.  Use attributes instead.é   )ÚcategoryÚ
stacklevel)	r0   Útupler   ÚDeprecationWarningr   r   r   r   r2   )r8   r.   ÚaÚbr   r   r    r;   ª   s   
ý
z _ServerFactoryIPv4Address.__eq__N)r   r   r   r   rJ   rK   r;   r   r   r   r    rL   §   s    rL   )r   r3   Útypingr   r   Úwarningsr   Zzope.interfacer   r   Ztyping_extensionsr   Ztwisted.internet.interfacesr   Ztwisted.python.filepathr   r	   Ztwisted.python.runtimer
   Úsr   r!   r$   r%   r*   rL   r   r   r   r    Ú<module>   s2    <