ó
[³XMc           @   s    d  Z  d d l Z d d l Z d d l m Z d d l m Z d d l m Z d e	 e j
 f d „  ƒ  YZ d e	 e j
 f d	 „  ƒ  YZ d
 e f d „  ƒ  YZ d S(   s*   
Address objects for network connections.
iÿÿÿÿN(   t
   implements(   t   IAddress(   t   utilt   IPv4Addressc           B   s<   e  Z d  Z e e ƒ d Z d d „ Z d „  Z d „  Z	 RS(	   s
  
    Object representing an IPv4 socket endpoint.

    @ivar type: A string describing the type of transport, either 'TCP' or
        'UDP'.
    @ivar host: A string containing the dotted-quad IP address.
    @ivar port: An integer representing the port number.
    t   typet   hostt   portc         C   sV   | d k s t  ‚ | |  _ | |  _ | |  _ | d  k	 rR t j d t d d ƒn  d  S(   Nt   TCPt   UDPsM   twisted.internet.address.IPv4Address._bwHack is deprecated since Twisted 11.0t
   stackleveli   (   R   R   (   t   AssertionErrorR   R   R   t   Nonet   warningst   warnt   DeprecationWarning(   t   selfR   R   R   t   _bwHack(    (    s<   /usr/lib/python2.7/dist-packages/twisted/internet/address.pyt   __init__   s    				c         C   s   d |  j  |  j |  j f S(   Ns   IPv4Address(%s, %r, %d)(   R   R   R   (   R   (    (    s<   /usr/lib/python2.7/dist-packages/twisted/internet/address.pyt   __repr__'   s    c         C   s   t  |  j |  j |  j f ƒ S(   N(   t   hashR   R   R   (   R   (    (    s<   /usr/lib/python2.7/dist-packages/twisted/internet/address.pyt   __hash__+   s    (   s   types   hosts   portN(
   t   __name__t
   __module__t   __doc__R    R   t   compareAttributesR   R   R   R   (    (    (    s<   /usr/lib/python2.7/dist-packages/twisted/internet/address.pyR      s   
		t   UNIXAddressc           B   sc   e  Z d  Z e e ƒ d Z d d „ Z e e	 j
 d d ƒ d k	 rO d „  Z n  d „  Z d „  Z RS(	   s‡   
    Object representing a UNIX socket endpoint.

    @ivar name: The filename associated with this socket.
    @type name: C{str}
    t   namec         C   s2   | |  _  | d  k	 r. t j d t d d ƒn  d  S(   NsM   twisted.internet.address.UNIXAddress._bwHack is deprecated since Twisted 11.0R	   i   (   R   R   R   R   R   (   R   R   R   (    (    s<   /usr/lib/python2.7/dist-packages/twisted/internet/address.pyR   <   s    		t   samefilec         C   s\   t  t |  ƒ j | ƒ } | t k rX y t j j |  j | j ƒ SWqX t k
 rT qX Xn  | S(   s˜   
            overriding L{util.FancyEqMixin} to ensure the os level samefile check
            is done if the name attributes do not match.
            (	   t   superR   t   __eq__t   Falset   ost   pathR   R   t   OSError(   R   t   othert   res(    (    s<   /usr/lib/python2.7/dist-packages/twisted/internet/address.pyR   D   s    c         C   s   d |  j  f S(   Ns   UNIXAddress(%r)(   R   (   R   (    (    s<   /usr/lib/python2.7/dist-packages/twisted/internet/address.pyR   R   s    c         C   sN   y, t  j |  j ƒ } t | j | j f ƒ SWn t k
 rI t |  j ƒ SXd  S(   N(   R   t   statR   R   t   st_inot   st_devR!   (   R   t   s1(    (    s<   /usr/lib/python2.7/dist-packages/twisted/internet/address.pyR   V   s
    (   s   nameN(   R   R   R   R    R   R   R   R   t   getattrR   R    R   R   R   (    (    (    s<   /usr/lib/python2.7/dist-packages/twisted/internet/address.pyR   0   s   
	t   _ServerFactoryIPv4Addressc           B   s   e  Z d  Z d „  Z RS(   s@   Backwards compatability hack. Just like IPv4Address in practice.c         C   s‹   t  | t ƒ r> t j d d t d d ƒ|  j |  j f | k St  | t ƒ r‡ |  j |  j |  j f } | j | j | j f } | | k St	 S(   Ns?   IPv4Address.__getitem__ is deprecated.  Use attributes instead.t   categoryR	   i   (
   t
   isinstancet   tupleR   R   R   R   R   R   R   R   (   R   R"   t   at   b(    (    s<   /usr/lib/python2.7/dist-packages/twisted/internet/address.pyR   e   s    
(   R   R   R   R   (    (    (    s<   /usr/lib/python2.7/dist-packages/twisted/internet/address.pyR)   b   s   (   R   R   R   t   zope.interfaceR    t   twisted.internet.interfacesR   t   twisted.pythonR   t   objectt   FancyEqMixinR   R   R)   (    (    (    s<   /usr/lib/python2.7/dist-packages/twisted/internet/address.pyt   <module>   s    2