
_:Rc        #   @   s  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z e	 e j
 d   Z y d d l m Z Wn! e k
 r d d l m Z n Xd d l m Z d d l m Z d d l m Z d d	 l m Z d d
 l m Z m Z m Z m Z d d l m Z m Z m Z d d l m Z m  Z  d d l m! Z! m" Z" d d l m# Z# d d l m$ Z$ m% Z% m& Z& d dJ d     YZ' d   Z( d Z) d Z* d Z+ d   Z, d   Z- d   Z. d   Z/ e s<e e d d d d  d  d d   Z1 e e d d d d  d  d d   Z2 d d  Z3 n  d d   Z4 d d!  Z5 d"   Z6 d#   Z7 d$   Z8 d%   Z9 d&   Z: e7 d d d d d d'  Z; d( d) d* d+ d, d- d d. d/ d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d: d; d< d= d> d? d@ dA dB dC dD dE dF dG dH dI g# Z< d S(K   st   
Standardized versions of various cool and/or strange things that you can do
with Python's reflection capabilities.
iN(   t   dequet    (   t   StringIO(   t   _PY3(   t
   deprecated(   t   _fullyQualifiedName(   t   Version(   t   prefixedMethodst   accumulateMethodst   prefixedMethodNamest   addMethodNamesToDict(   t   namedModulet   namedObjectt
   namedClass(   t   InvalidNamet   ModuleNotFound(   t   ObjectNotFoundt   namedAny(   t   filenameToModuleName(   t   qualt   safe_strt	   safe_reprt   QueueMethodc           B   s    e  Z d  Z d   Z d   Z RS(   s6   
    I represent a method that doesn't exist yet.
    c         C   s   | |  _  | |  _ d  S(   N(   t   namet   calls(   t   selfR   R   (    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyt   __init__-   s    	c         G   s   |  j  j |  j | f  d  S(   N(   R   t   appendR   (   R   t   args(    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyt   __call__0   s    (   t   __name__t
   __module__t   __doc__R   R   (    (    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyR   )   s   	c   
      C   s   t  j d t d d |  j } |  j } | j } | j |  } |  j } g  } | j d | | f  | r | t	 |  } | j d |  | j d | |   | j d  xD t
 | |  D]/ } | | }	 | j d | |	 | | f  q Wn  | S(	   sA   
    this is more documentation for myself than useful code.
    sH   [v2.5] Use inspect.getargspec instead of twisted.python.reflect.funcinfot
   stackleveli   s$   The function %s accepts %s argumentss   It requires %s argumentss   The arguments required are: %ss   additional arguments are:s   %s which has a default of(   t   warningst   warnt   DeprecationWarningt	   func_codet	   func_namet   co_argcountt   co_varnamest   func_defaultsR   t   lent   range(
   t   functiont   codeR   t   argct   argvt   defaultst   outt   requiredt   it   j(    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyt   funcinfo4   s(    				
&i    i   i   c         C   sU   t  t j |  |  j   d |  j } t |  |  k	 rQ t d |  | f   n  | S(   Nt   .s   Couldn't find %s as %s.(   t   strt   picklet   whichmoduleR   R   t	   Exception(   t   funct   qualName(    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyt   fullFuncNameU   s    &c         C   sY   t  |   t j k s! t d   t |  j  } t | |  j d   } | d  k rU |  S| S(   Ns   must be a class...(	   t   typet   typest	   ClassTypet   AssertionErrorR   R   t   getattrR   t   None(   t   clazzt   modulet	   currclass(    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyt
   getcurrent]   s    !c         C   s$   t  |  d  r |  j St |   Sd S(   s~   
    Return the class or type of object 'obj'.
    Returns sensible result for oldstyle and newstyle instances and types.
    t	   __class__N(   t   hasattrRH   R>   (   t   obj(    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyt   getClassf   s    c         C   s   t  |   t j k s* t  |  t j k r7 t |  |  S|  j } t |  } t |  } t | |  r | | k rw t S| |  _ t	 Sn t
 Sd  S(   N(   R>   R?   t   InstanceTypeR@   t
   isinstanceRH   RG   t
   issubclasst   WASt   ISt   ISNT(   t   instRD   t   clt   cl2(    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyt   isinsts   s    *		t   Twistedi   s   inspect.getmroc         C   s   g  } t  |  | |  | S(   s   
        allYourBase(classObj, baseClass=None) -> list of all base
        classes that are subclasses of baseClass, unless it is None,
        in which case all bases will be added.
        (   t   _accumulateBases(   t   classObjt	   baseClasst   l(    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyt   allYourBase   s    c         C   s   t  |  | |  d  S(   N(   RW   (   RX   RZ   RY   (    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyt   accumulateBases   s    c         C   sS   xL |  j  D]A } | d  k s+ t | |  r; | j |  n  t | | |  q
 Wd  S(   N(   t	   __bases__RC   RN   R   RW   (   RX   RZ   RY   t   base(    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyRW      s    c         C   sb   x! |  j  D] } t | | |  q
 W| d k s? | |  j  k r^ | j |  j j | i    n  d S(   s  
    Accumulate all attributes of a given name in a class hierarchy into a single dictionary.

    Assuming all class attributes of this name are dictionaries.
    If any of the dictionaries being accumulated have the same key, the
    one highest in the class heirarchy wins.
    (XXX: If "higest" means "closest to the starting class".)

    Ex::

      class Soy:
        properties = {"taste": "bland"}
    
      class Plant:
        properties = {"colour": "green"}
    
      class Seaweed(Plant):
        pass
    
      class Lunch(Soy, Seaweed):
        properties = {"vegan": 1 }
    
      dct = {}
    
      accumulateClassDict(Lunch, "properties", dct)
    
      print dct

    {"taste": "bland", "colour": "green", "vegan": 1}
    N(   R]   t   accumulateClassDictRC   t   updatet   __dict__t   get(   RX   t   attrt   adictRY   R^   (    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyR_      s    c         C   sb   x! |  j  D] } t | | |  q
 W| d k s? | |  j  k r^ | j |  j j | g    n  d S(   s   
    Accumulate all attributes of a given name in a class heirarchy into a single list.

    Assuming all class attributes of this name are lists.
    N(   R]   t   accumulateClassListRC   t   extendRa   Rb   (   RX   Rc   t   listObjRY   R^   (    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyRe      s    c         C   s
   |  | k S(   N(    (   t   at   b(    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyt   isSame   s    c         C   s
   |  | k S(   N(    (   Rh   Ri   (    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyt   isLike   s    c         C   s   t  t j |  t d  S(   Ns   sys.modules(   t   objgrept   syst   modulesRk   (   t   goal(    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyt   modgrep   s    c         C   s1   t  |   | k p0 t |  t j  o0 |  j | k S(   N(   R>   RM   R?   RL   RH   (   t   startRo   (    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyt   isOfType   s    c         C   s   t  |  | t  S(   N(   Rl   Rr   (   Rq   t   t(    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyt   findInstances   s    c      
   C   s}  | d k r g  } n  | d k r* i  } n  | |  |  rI | j |  n  t |   | k rx | t |   |  k rx d Sn  | d k	 r | d k r d S| d 8} n  |  | t |   <t |  t j  rEx|  j   D]n \ } }	 t | | | | d t |	  d | | | |  t |	 | | | d t |  d | | | |  q Wn4t |  t	 t
 t f  rxt t |    D]; }
 t |  |
 | | | d t |
  d | | | |  qpWnt |  t j  r9t |  j | | | d | | | |  t |  j | | | d	 | | | |  t |  j | | | d
 | | | |  n@t |  d  rxD |  j j   D]3 \ } }	 t |	 | | | d | | | | |  qXWt |  t j  ryt |  j | | | d | | | |  qyn t |  t j  rt |    | | | d | | | |  nq t |  t j t j t j t j t t j t j t j  f  syt! |   j" d k r]n | ryd Gt! |   G|  GHn  | S(   s>   
    An insanely CPU-intensive process for finding stuff.
    Ni    i   t   {t   }t   [t   ]s   .im_selfs   .im_funcs	   .im_classRa   R6   s
   .__class__s   ()t   wrapper_descriptort   method_descriptort   member_descriptort   getset_descriptors   unknown type(   Ry   Rz   R{   R|   (#   RC   R   t   idRM   R?   t   DictionaryTypet   itemsRl   t   reprt   listt   tupleR    t   xrangeR*   R7   t
   MethodTypet   im_selft   im_funct   im_classRI   Ra   RL   RH   t   weakreft   ReferenceTypet   StringTypest   IntTypet   FunctionTypet   BuiltinMethodTypet	   RegexTypet	   FloatTypet   NoneTypet   FileTypeR>   R   (   Rq   Ro   t   eqt   patht   pathst   seent   showUnknownst   maxDeptht   kt   vt   idx(    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyRl      sT    		18<&&)+,)	R   R   R   RQ   RO   RP   R5   R=   R   RG   RK   RU   R   R   R   R   R   R   R[   R\   R	   R
   R   R   R_   Re   Rj   Rk   Rp   Rr   Rt   Rl   R   t   fullyQualifiedName(    (=   R    Rm   R?   R8   R   t   reR"   t   collectionsR    R>   t   compileR   t	   cStringIOR   t   ImportErrort   twisted.python.compatR   t   twisted.python.deprecateR   R   R   t   twisted.python.versionsR   t   twisted.python._reflectpy3R   R   R	   R
   R   R   R   R   R   R   R   R   R   R   R   R   R5   RQ   RO   RP   R=   RG   RK   RU   RC   R[   R\   RW   R_   Re   Rj   Rk   Rp   Rr   Rt   Rl   t   __all__(    (    (    sH   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/reflect.pyt   <module>   sp   "						%					2			