???<!-- GIF89;a -->
123123123123
.....................................................................................................................................???<!-- GIF89;a -->
123123123123
.....................................................................................................................................ó
­sWc           @   s°  d  Z  d d l Z d d l Z d d l m Z d d l m Z d d d d d	 d
 d g Z e d g 7Z d e f d „  ƒ  YZ	 d e	 f d „  ƒ  YZ
 d „  Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d	 e f d „  ƒ  YZ d
 e f d „  ƒ  YZ d e f d „  ƒ  YZ e j d d k Z e r7d „  Z d „  Z n d „  Z d „  Z y d d l m Z Wn e k
 rve Z n
 Xd „  Z d e f d „  ƒ  YZ d e f d  „  ƒ  YZ d S(!   sA   contextlib2 - backports and enhancements to the contextlib moduleiÿÿÿÿN(   t   deque(   t   wrapst   contextmanagert   closingt   ContextDecoratort	   ExitStackt   redirect_stdoutt   redirect_stderrt   suppresst   ContextStackc           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   sJ   A base class or mixin that enables context managers to work as decorators.c         C   s   t  j d t ƒ |  j ƒ  S(   sÁ  Returns the context manager used to actually wrap the call to the
        decorated function.

        The default implementation just returns *self*.

        Overriding this method allows otherwise one-shot context managers
        like _GeneratorContextManager to support use as decorators via
        implicit recreation.

        DEPRECATED: refresh_cm was never added to the standard library's
                    ContextDecorator API
        s2   refresh_cm was never added to the standard library(   t   warningst   warnt   DeprecationWarningt   _recreate_cm(   t   self(    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt
   refresh_cm   s    	c         C   s   |  S(   s6  Return a recreated instance of self.

        Allows an otherwise one-shot context manager like
        _GeneratorContextManager to support use as
        a decorator via implicit recreation.

        This is a private interface just for _GeneratorContextManager.
        See issue #11647 for details.
        (    (   R   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR   "   s    
c            s"   t  ˆ  ƒ ‡  ‡ f d †  ƒ } | S(   Nc             s$   ˆ j  ƒ   ˆ  |  | Ž  SWd  QXd  S(   N(   R   (   t   argst   kwds(   t   funcR   (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt   inner/   s    (   R   (   R   R   R   (    (   R   R   s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt   __call__.   s    (   t   __name__t
   __module__t   __doc__R   R   R   (    (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR      s   		t   _GeneratorContextManagerc           B   s2   e  Z d  Z d „  Z d „  Z d „  Z d „  Z RS(   s%   Helper for @contextmanager decorator.c         C   sl   | | | Ž  |  _  | | | |  _ |  _ |  _ t | d d  ƒ } | d  k r_ t |  ƒ j } n  | |  _ d  S(   NR   (   t   genR   R   R   t   getattrt   Nonet   typeR   (   R   R   R   R   t   doc(    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt   __init__9   s    c         C   s   |  j  |  j |  j |  j ƒ S(   N(   t	   __class__R   R   R   (   R   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR   G   s    c         C   s5   y t  |  j ƒ SWn t k
 r0 t d ƒ ‚ n Xd  S(   Ns   generator didn't yield(   t   nextR   t   StopIterationt   RuntimeError(   R   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt	   __enter__M   s    c         C   s   | d  k rA y t |  j ƒ Wn t k
 r1 d  SXt d ƒ ‚ n» | d  k rY | ƒ  } n  y& |  j j | | | ƒ t d ƒ ‚ Wnz t k
 r› } | | k	 St k
 rÙ } | | k rº t St rÓ | j | k rÓ t S‚  n# t	 j
 ƒ  d | k	 rü ‚  qü n Xd  S(   Ns   generator didn't stops#   generator didn't stop after throw()i   (   R   R    R   R!   R"   t   throwt   Falset   _HAVE_EXCEPTION_CHAININGt	   __cause__t   syst   exc_info(   R   R   t   valuet	   tracebackt   exc(    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt   __exit__S   s,    
(   R   R   R   R   R   R#   R-   (    (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR   6   s
   			c            s   t  ˆ  ƒ ‡  f d †  ƒ } | S(   sÜ  @contextmanager decorator.

    Typical usage:

        @contextmanager
        def some_generator(<arguments>):
            <setup>
            try:
                yield <value>
            finally:
                <cleanup>

    This makes this:

        with some_generator(<arguments>) as <variable>:
            <body>

    equivalent to this:

        <setup>
        try:
            <variable> = <value>
            <body>
        finally:
            <cleanup>

    c             s   t  ˆ  |  | ƒ S(   N(   R   (   R   R   (   R   (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt   helperš   s    (   R   (   R   R.   (    (   R   s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR   ~   s    c           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   s2  Context to automatically close something at the end of a block.

    Code like this:

        with closing(<module>.open(<arguments>)) as f:
            <block>

    is equivalent to this:

        f = <module>.open(<arguments>)
        try:
            <block>
        finally:
            f.close()

    c         C   s   | |  _  d  S(   N(   t   thing(   R   R/   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR   ±   s    c         C   s   |  j  S(   N(   R/   (   R   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR#   ³   s    c         G   s   |  j  j ƒ  d  S(   N(   R/   t   close(   R   R)   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR-   µ   s    (   R   R   R   R   R#   R-   (    (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR       s   		t   _RedirectStreamc           B   s)   e  Z d Z d  „  Z d „  Z d „  Z RS(   c         C   s   | |  _  g  |  _ d  S(   N(   t   _new_targett   _old_targets(   R   t
   new_target(    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR   ½   s    	c         C   s9   |  j  j t t |  j ƒ ƒ t t |  j |  j ƒ |  j S(   N(   R3   t   appendR   R(   t   _streamt   setattrR2   (   R   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR#   Â   s    c         C   s    t  t |  j |  j j ƒ  ƒ d  S(   N(   R7   R(   R6   R3   t   pop(   R   t   exctypet   excinstt   exctb(    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR-   Ç   s    N(   R   R   R   R6   R   R#   R-   (    (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR1   ¹   s   		c           B   s   e  Z d  Z d Z RS(   sA  Context manager for temporarily redirecting stdout to another file.

        # How to send help() to stderr
        with redirect_stdout(sys.stderr):
            help(dir)

        # How to write help() to a file
        with open('help.txt', 'w') as f:
            with redirect_stdout(f):
                help(pow)
    t   stdout(   R   R   R   R6   (    (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR   Ë   s   c           B   s   e  Z d  Z d Z RS(   sC   Context manager for temporarily redirecting stderr to another file.t   stderr(   R   R   R   R6   (    (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR   Û   s   c           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   s?  Context manager to suppress specified exceptions

    After the exception is suppressed, execution proceeds with the next
    statement following the with statement.

         with suppress(FileNotFoundError):
             os.remove(somefile)
         # Execution still resumes here if the file was already removed
    c         G   s   | |  _  d  S(   N(   t   _exceptions(   R   t
   exceptions(    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR   ì   s    c         C   s   d  S(   N(    (   R   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR#   ï   s    c         C   s   | d  k	 o t | |  j ƒ S(   N(   R   t
   issubclassR>   (   R   R9   R:   R;   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR-   ò   s    
(   R   R   R   R   R#   R-   (    (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR   á   s   			i    i   c            s   ‡  f d †  } | S(   Nc            sO   x? |  j  } | | k r d  S| d  k s4 | ˆ  k r8 Pn  | }  q W| |  _  d  S(   N(   t   __context__R   (   t   new_exct   old_exct   exc_context(   t	   frame_exc(    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt   _fix_exception_context  s    	
(    (   RE   RF   (    (   RE   s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt   _make_context_fixer  s    c         C   sC   y |  d j  } |  d ‚ Wn! t k
 r> | |  d _  ‚  n Xd  S(   Ni   (   RA   t   BaseException(   t   exc_detailst	   fixed_ctx(    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt   _reraise_with_existing_context  s    c         C   s   d „  S(   Nc         S   s   d  S(   N(   R   (   RB   RC   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt   <lambda>  t    (    (   RE   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRG     s    c         B   s   |  \ } } } d d  Ud  S(   Ns!   raise exc_type, exc_value, exc_tb(    (   RI   t   exc_typet	   exc_valuet   exc_tb(    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRK   "  s    (   t   InstanceTypec         C   s#   t  |  ƒ } | t k r |  j S| S(   N(   R   RQ   R   (   t   objt   obj_type(    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt	   _get_type.  s    c           B   s_   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z RS(
   s‹  Context manager for dynamic management of a stack of exit callbacks

    For example:

        with ExitStack() as stack:
            files = [stack.enter_context(open(fname)) for fname in filenames]
            # All opened files will automatically be closed at the end of
            # the with statement, even if attempts to open files later
            # in the list raise an exception

    c         C   s   t  ƒ  |  _ d  S(   N(   R    t   _exit_callbacks(   R   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR   A  s    c         C   s+   t  |  ƒ ƒ  } |  j | _ t ƒ  |  _ | S(   s?   Preserve the context stack by transferring it to a new instance(   R   RU   R    (   R   t	   new_stack(    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt   pop_allD  s    c            s,   ‡  ‡ f d †  } ˆ  | _  |  j | ƒ d S(   s:   Helper to correctly register callbacks to __exit__ methodsc             s   ˆ ˆ  |  Œ S(   N(    (   RI   (   t   cmt   cm_exit(    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt   _exit_wrapperM  s    N(   t   __self__t   push(   R   RX   RY   RZ   (    (   RX   RY   s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt   _push_cm_exitK  s    	c         C   sQ   t  | ƒ } y | j } Wn! t k
 r< |  j j | ƒ n X|  j | | ƒ | S(   s  Registers a callback with the standard __exit__ method signature

        Can suppress exceptions the same way __exit__ methods can.

        Also accepts any object with an __exit__ method (registering a call
        to the method instead of the object itself)
        (   RT   R-   t   AttributeErrorRU   R5   R]   (   R   t   exitt   _cb_typet   exit_method(    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR\   R  s    
c            s/   ‡  ‡ ‡ f d †  } ˆ | _  |  j | ƒ ˆ S(   s\   Registers an arbitrary callback and arguments.

        Cannot suppress exceptions.
        c            s   ˆ ˆ  ˆ Ž  d  S(   N(    (   RN   R,   t   tb(   R   t   callbackR   (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRZ   k  s    (   t   __wrapped__R\   (   R   Rc   R   R   RZ   (    (   R   Rc   R   s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyRc   f  s    	c         C   s8   t  | ƒ } | j } | j | ƒ } |  j | | ƒ | S(   sª   Enters the supplied context manager

        If successful, also pushes its __exit__ method as a callback and
        returns the result of the __enter__ method.
        (   RT   R-   R#   R]   (   R   RX   t   _cm_typet   _exitt   result(    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt   enter_contexts  s
    	c         C   s   |  j  d d d ƒ d S(   s$   Immediately unwind the context stackN(   R-   R   (   R   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR0   €  s    c         C   s   |  S(   N(    (   R   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR#   „  s    c   	      G   sÐ   | d d  k	 } t j ƒ  d } t | ƒ } t } t } xx |  j r² |  j j ƒ  } y% | | Œ  rw t } t } d } n  Wq; t j ƒ  } | | d | d ƒ t } | } q; Xq; W| rÆ t | ƒ n  | oÏ | S(   Ni    i   (   NNN(	   R   R(   R)   RG   R%   RU   R8   t   TrueRK   (	   R   RI   t   received_excRE   RF   t   suppressed_exct   pending_raiset   cbt   new_exc_details(    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR-   ‡  s(    (   R   R   R   R   RW   R]   R\   Rc   Rh   R0   R#   R-   (    (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR   5  s   								c           B   s2   e  Z d  Z d „  Z d „  Z d „  Z d „  Z RS(   s+   Backwards compatibility alias for ExitStackc         C   s'   t  j d t ƒ t t |  ƒ j ƒ  d  S(   Ns*   ContextStack has been renamed to ExitStack(   R
   R   R   t   superR	   R   (   R   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR   ¨  s    	c         C   s   |  j  | ƒ S(   N(   R\   (   R   Rc   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt   register_exit­  s    c         O   s   |  j  | | | Ž S(   N(   Rc   (   R   Rc   R   R   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt   register°  s    c         C   s
   |  j  ƒ  S(   N(   RW   (   R   (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt   preserve³  s    (   R   R   R   R   Rp   Rq   Rr   (    (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyR	   ¥  s
   			(   R   R(   R
   t   collectionsR    t	   functoolsR   t   __all__t   objectR   R   R   R   R1   R   R   R   t   version_infoR&   RG   RK   t   typesRQ   t   ImportErrorR   RT   R   R	   (    (    (    s<   /opt/alt/python27/lib/python2.7/site-packages/contextlib2.pyt   <module>   s8   (H	"			
	p