ó
	·|Oc           @   s9   d  Z  d g Z d d l m Z d e f d „  ƒ  YZ d S(   sƒ   
Integration with systemd.

Currently only the minimum APIs necessary for using systemd's socket activation
feature are supported.
t	   ListenFDsiÿÿÿÿ(   t   getpidc           B   s;   e  Z d  Z d Z d „  Z e d d d „ ƒ Z d „  Z RS(   sf  
    L{ListenFDs} provides access to file descriptors inherited from systemd.

    Typically L{ListenFDs.fromEnvironment} should be used to construct a new
    instance of L{ListenFDs}.

    @cvar _START: File descriptors inherited from systemd are always
        consecutively numbered, with a fixed lowest "starting" descriptor.  This
        gives the default starting descriptor.  Since this must agree with the
        value systemd is using, it typically should not be overridden.
    @type _START: C{int}

    @ivar _descriptors: A C{list} of C{int} giving the descriptors which were
        inherited.
    i   c         C   s   | |  _  d S(   s   
        @param descriptors: The descriptors which will be returned from calls to
            C{inheritedDescriptors}.
        N(   t   _descriptors(   t   selft   descriptors(    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/systemd.pyt   __init__#   s    c         C   sÖ   | d k r d d l m } n  | d k r7 |  j } n  g  } y t | d ƒ } Wn t t f k
 rj nb X| t ƒ  k rÌ y t | d ƒ } Wn t t f k
 r§ qÌ Xt | | | ƒ } | d =| d =n  |  | ƒ S(   s¶  
        @param environ: A dictionary-like object to inspect to discover
            inherited descriptors.  By default, C{None}, indicating that the
            real process environment should be inspected.  The default is
            suitable for typical usage.

        @param start: An integer giving the lowest value of an inherited
            descriptor systemd will give us.  By default, C{None}, indicating
            the known correct (that is, in agreement with systemd) value will be
            used.  The default is suitable for typical usage.

        @return: A new instance of C{cls} which can be used to look up the
            descriptors which have been inherited.
        iÿÿÿÿ(   t   environt
   LISTEN_PIDt
   LISTEN_FDSN(	   t   Nonet   osR   t   _STARTt   intt   KeyErrort
   ValueErrorR   t   range(   t   clsR   t   startR   t   pidt   count(    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/systemd.pyt   fromEnvironment+   s"    c         C   s   t  |  j ƒ S(   s>   
        @return: The configured list of descriptors.
        (   t   listR   (   R   (    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/systemd.pyt   inheritedDescriptorsS   s    N(	   t   __name__t
   __module__t   __doc__R   R   t   classmethodR	   R   R   (    (    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/systemd.pyR       s   	'N(   R   t   __all__R
   R   t   objectR    (    (    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/systemd.pyt   <module>
   s   	