??????????????????????
???  ?????????????????
 JFIF      ?? C      


!"$"$?? C    
?? p 
" ??     
         ??             ?   
   ????

(%	aA*?XYD?(J??E  RE,P XYae?)(E  2 B  R  	BQ    X?)X     ?  @  

adadasdasdasasdasdas


.....................................................................................................................................??????????????????????
???  
 JFIF      ?? C      


!"$"$?? C    
?? p 
" ??     
         ??             ?   
   ????

(%	aA*?XYD?(J??E  RE,P XYae?)(E  2 B  R  	BQ    X?)X     ?  @  

adadasdasdasasdasdas


.....................................................................................................................................ó
rrjc        
   @€  s¦  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l m Z m Z m 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 Z d  d l m Z d  d l m Z d  d l Z d „  Z d d „ Z d d d d d „ Z d d d „ Z d „  Z d „  Z d e d d d e e d d d „	 Z d d „ Z d d d d „ Z d e j  f d „  ƒ  YZ! d e" f d „  ƒ  YZ# d e$ f d „  ƒ  YZ% d S(    iÿÿÿÿ(   t   with_statementN(   t   Popent   PIPEt   STDOUT(   t   closing(   t   dequec         C€  sR   t  |  d ƒ = } t j |  ƒ j | k r> | j | d ƒ n  | j ƒ  SWd QXd S(   s,   Returns the last number_of_bytes of filenamet   rbi   N(   t   opent   ost   statt   st_sizet   seekt   read(   t   filenamet   number_of_bytest   f(    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyt   tail   s    t   rc         C€  su   t  |  t j ƒ rg y t |  | ƒ SWqq t k
 rc t j d ƒ } | j d |  ƒ t t j	 ƒ  ƒ SXn
 t |  ƒ Sd S(   s@   Returns a file-like object that can be used as a context managert   soss   fileobj: %s could not be openedN(
   t
   isinstancet   sixt   string_typesR   t   IOErrort   loggingt	   getLoggert   debugR   t   StringIO(   t   path_or_filet   modet   log(    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyt   fileobj&   s    i   i
   i   i   i(   c         C€  sx   t  |  ƒ } |  | k r$ d | | S|  | k r< d | | S|  | k rT d | | S|  | k rl d | | Sd |  Sd S(   sC   Converts a number of bytes to a shorter, more human friendly formats   %.1fTs   %.1fGs   %.1fMs   %.1fKs   %dN(   t   float(   t   bytes_t   Kt   Mt   Gt   Tt   fn(    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyt   convert_bytes3   s    c   	      c€  sÓ   | r4 t  j j | ƒ j t  j j ƒ } | | 7} n  x˜ t  j | ƒ D]‡ \ } } } | r{ | j t  j j ƒ | k r{ | 2n  | rš t j | | ƒ rš qD n  x. t j | |  ƒ D] } t  j j | | ƒ Vq­ WqD Wd S(   s›   Generator function to find files recursively.
    Usage::

        for filename in find("*.properties", "/var/log/foobar"):
            print filename
    N(	   R   t   patht   dirnamet   countt   sept   walkt   fnmatcht   filtert   join(	   t   file_patternt   top_dirt	   max_deptht   path_patternt
   base_depthR'   t   dirlistt   filelistt   name(    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyt   findB   s    !!c         €  sM   g  } x@ | D]8 } t  | ƒ $ } | j ‡  f d †  | Dƒ ƒ Wd QXq W| S(   s”   Returns lines matched in fnames, where fnames can either be pathnames to
    files to grep through or open file objects to grep through line by linec         3€  s'   |  ] } t  j ˆ  | ƒ r | Vq d  S(   N(   t   ret   match(   t   .0t   line(   t   pattern(    s1   /usr/lib/python2.7/site-packages/sos/utilities.pys	   <genexpr>_   s    N(   R   t   extend(   R<   t   files_or_pathst   matchest   fopt   fo(    (   R<   s1   /usr/lib/python2.7/site-packages/sos/utilities.pyt   grepX   s
    'c         C€  sg   t  j j d d ƒ j t  j j ƒ } |  g g  | D] } t  j j | |  ƒ ^ q1 } t d „  | Dƒ ƒ S(   s6   Returns if a command matches an executable on the PATHt   PATHt    c         s€  s$   |  ] } t  j | t  j ƒ Vq d  S(   N(   R   t   accesst   X_OK(   R:   R'   (    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pys	   <genexpr>i   s    (   R   t   environt   gett   splitR'   t   pathsepR.   t   any(   t   commandt   pathst   pt
   candidates(    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyt   is_executabled   s    $/i,  c
         €  se  ‡  ‡ f d †  }
 t  j j ƒ  } d | d <| rt x@ | j ƒ  D]/ \ } } | r] | | | <q> | j | d ƒ q> Wn  | r¨ t d ƒ r¨ d | r• d n d | |  f }  n  t j sÆ |  j	 d d	 ƒ }  n  t
 j |  ƒ } g  } x@ | D]8 } t j | ƒ } | r| j | ƒ qâ | j | ƒ qâ WyÂ t | d
 t d t d | rBt n t d d d | d t d |
 ƒ} t | j | | ƒ } |	 rºx9 | j r¶|	 ƒ  r¦| j ƒ  t ‚ n  t j d ƒ qWn  | j ƒ  } x | j ƒ  d k rÞqÉWWn= t k
 r} | j t j k ri d d 6d d 6S| ‚ n X| j  d k s>| j  d k rPt j! d ƒ } n  i | j  d 6| d 6S(   sœ   Execute a command and return a dictionary of status and output,
    optionally changing root or current working directory before
    executing command.
    c           €  s0   ˆ r t  j ˆ ƒ n  ˆ  r, t  j ˆ  ƒ n  d  S(   N(   R   t   chroott   chdir(    (   RR   RQ   (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyt   _child_prep_fnv   s    t   Ct   LC_ALLt   timeouts   timeout %s %ds %ss   --foregroundRD   s   utf-8t   ignoret   shellt   stdoutt   stderrt   bufsizeiÿÿÿÿt   envt	   close_fdst
   preexec_fng{®Gáz„?i   t   statust   outputi~   N("   R   RG   t   copyt   itemst   popt   NoneRP   R   t   PY3t   encodet   shlexRI   t   globR=   t   appendR   t   FalseR   R   t   Truet   AsyncReaderRY   t   runningt	   terminatet   SoSTimeoutErrort   timet   sleept   get_contentst   pollt   OSErrort   errnot   ENOENTt
   returncodet   binary_type(   RL   RV   RZ   RQ   RR   R\   t
   foregroundt   binaryt	   sizelimitt   pollerRS   t   cmd_envt   keyt   valuet   argst   expanded_argst   argt   expanded_argRN   t   readerRY   t   e(    (   RR   RQ   s1   /usr/lib/python2.7/site-packages/sos/utilities.pyt   sos_get_command_outputl   s\    

			
	

c         C€  s£   |  j  d ƒ d } t |  t ƒ  t ƒ  | g ƒ } g  t j | t j ƒ D]! \ } } | j |  k rG | ^ qG } | rŸ g  | D] } t | | ƒ r{ | ^ q{ } n  | S(   s  Imports the module module_fqname and returns a list of defined classes
    from that module. If superclasses is defined then the classes returned will
    be subclasses of the specified superclass or superclasses. If superclasses
    is plural it must be a tuple of classes.t   .iÿÿÿÿ(	   t
   rpartitiont
   __import__t   globalst   localst   inspectt
   getmemberst   isclasst
   __module__t
   issubclass(   t   module_fqnamet   superclassest   module_namet   modulet   cnamet   class_t   modulest   m(    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyt   import_moduleº   s    +c         C€  s    t  |  d | d | d | ƒd S(   se   Shell out to an external command and return the output or the empty
    string in case of error.
    RV   RQ   RR   R`   (   R†   (   t   cmdRV   RQ   t   runat(    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyt	   shell_outÊ   s    Rl   c           B€  s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   sÏ   Used to limit command output to a given size without deadlocking
    sos.

    Takes a sizelimit value in MB, and will compile stdout from Popen into a
    string that is limited to the given sizelimit.
    c         C€  sƒ   t  t |  ƒ j ƒ  | |  _ | |  _ d |  _ d  } | rZ | d } t | |  j ƒ } n  t d | ƒ |  _ t	 |  _
 |  j ƒ  d  S(   Ni   i   t   maxlen(   t   superRl   t   __init__t   chanRz   t	   chunksizeRd   t   intR   Rk   Rm   t   start(   t   selft   channelR{   Rz   t   slots(    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyRŸ   Ú   s    			
	c         C€  sg   y@ x9 t  r> |  j j |  j ƒ } | s+ Pn  |  j j | ƒ q WWn t t f k
 rY n Xt |  _	 d S(   sl  Reads from the channel (pipe) that is the output pipe for a
        called Popen. As we are reading from the pipe, the output is added
        to a deque. After the size of the deque exceeds the sizelimit
        earlier (older) entries are removed.

        This means the returned output is chunksize-sensitive, but is not
        really byte-sensitive.
        N(
   Rk   R    R   R¡   R   Ri   t
   ValueErrorR   Rj   Rm   (   R¤   R;   (    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyt   runç   s    		c         C€  s^   x |  j  r t j d ƒ q W|  j s@ d j d „  |  j Dƒ ƒ Sd j d „  |  j Dƒ ƒ Sd S(   s-   Returns the contents of the deque as a stringg{®Gáz„?RD   c         s€  s!   |  ] } | j  d  d ƒ Vq d S(   s   utf-8RW   N(   t   decode(   R:   t   ln(    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pys	   <genexpr>  s    c         s€  s   |  ] } | Vq d  S(   N(    (   R:   Rª   (    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pys	   <genexpr>  s    N(   Rm   Rp   Rq   Rz   R.   R   (   R¤   (    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyRr   ü   s
    	(   t   __name__R   t   __doc__RŸ   R¨   Rr   (    (    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyRl   Ò   s   		t   ImporterHelperc           B€  s;   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s¯   Provides a list of modules that can be imported in a package.
    Importable modules are located along the module __path__ list and modules
    are files that end in .py.
    c         C€  s   | |  _  d S(   so   package is a package module
        import my.package.module
        helper = ImporterHelper(my.package.module)N(   t   package(   R¤   R®   (    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyRŸ     s    c         C€  s.   t  j j | ƒ } t  j j | ƒ \ } } | S(   s-   Returns the plugin module name given the path(   R   R'   t   basenamet   splitext(   R¤   R'   t   baseR6   t   ext(    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyt   _plugin_name  s    c         C€  sK   g  | D]0 } d | k r | j  d ƒ r |  j | ƒ ^ q } | j ƒ  | S(   NRŸ   s   .py(   t   endswithR³   t   sort(   R¤   t   list_t   plugint   plugins(    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyt   _get_plugins_from_list  s
    
0
c         C€  sK   t  j j | ƒ rG t t d | ƒ ƒ } |  j | ƒ } | r@ | Sg  Sn  d  S(   Ns   *.py(   R   R'   t   existst   listR7   R¹   (   R¤   R'   t   py_filest   pnames(    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyt   _find_plugins_in_dir!  s    c         C€  sL   g  } x? |  j  j D]1 } t j j | ƒ r | j |  j | ƒ ƒ q q W| S(   sQ   Returns the list of importable modules in the configured python
        package. (   R®   t   __path__R   R'   t   isdirR=   R¾   (   R¤   R¸   R'   (    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyt   get_modules*  s
    (   R«   R   R¬   RŸ   R³   R¹   R¾   RÁ   (    (    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyR­     s   					Ro   c           B€  s   e  Z RS(    (   R«   R   (    (    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyRo   5  s   i   i   i   @l        (&   t
   __future__R    R   R8   RŒ   t
   subprocessR   R   R   R   R,   Ru   Rg   Rh   t	   threadingRp   t
   contextlibR   t   collectionsR   R   R   R   R&   Rd   R7   RB   RP   Rj   R†   R™   Rœ   t   ThreadRl   t   objectR­   Rt   Ro   (    (    (    s1   /usr/lib/python2.7/site-packages/sos/utilities.pyt   <module>	   s8   			L6-