AlkantarClanX12

Your IP : 18.191.27.78


Current Path : /proc/thread-self/root/opt/alt/python33/lib64/python3.3/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python33/lib64/python3.3/__pycache__/contextlib.cpython-33.pyc

�
��f�#c@s�dZddlZddlmZddlmZddddgZGd	d�de�ZGd
d�de�Z	dd�Z
Gd
d�de�ZGdd�de�ZdS(u4Utilities for with-statement contexts.  See PEP 343.iN(udeque(uwrapsucontextmanageruclosinguContextDecoratoru	ExitStackcBs2|EeZdZdZdd�Zdd�ZdS(uContextDecoratoruJA base class or mixin that enables context managers to work as decorators.cCs|S(u6Return 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.
        ((uself((u//opt/alt/python33/lib64/python3.3/contextlib.pyu_recreate_cm
s
uContextDecorator._recreate_cmcs%t����fdd��}|S(Nc
s$�j���||�SWdQXdS(N(u_recreate_cm(uargsukwds(ufuncuself(u//opt/alt/python33/lib64/python3.3/contextlib.pyuinners
u(ContextDecorator.__call__.<locals>.inner(uwraps(uselfufuncuinner((ufuncuselfu//opt/alt/python33/lib64/python3.3/contextlib.pyu__call__s!uContextDecorator.__call__N(u__name__u
__module__u__qualname__u__doc__u_recreate_cmu__call__(u
__locals__((u//opt/alt/python33/lib64/python3.3/contextlib.pyuContextDecorator
scBsJ|EeZdZdZdd�Zdd�Zdd�Zdd	�Zd
S(u_GeneratorContextManageru%Helper for @contextmanager decorator.cOs3|||�|_||||_|_|_dS(N(ugenufuncuargsukwds(uselfufuncuargsukwds((u//opt/alt/python33/lib64/python3.3/contextlib.pyu__init__$su!_GeneratorContextManager.__init__cCs|j|j|j|j�S(N(u	__class__ufuncuargsukwds(uself((u//opt/alt/python33/lib64/python3.3/contextlib.pyu_recreate_cm(su%_GeneratorContextManager._recreate_cmcCs6yt|j�SWntk
r1td��YnXdS(Nugenerator didn't yield(unextugenu
StopIterationuRuntimeError(uself((u//opt/alt/python33/lib64/python3.3/contextlib.pyu	__enter__.s
u"_GeneratorContextManager.__enter__cCs�|dkrEyt|j�Wntk
r5dSYq�Xtd��n�|dkr]|�}ny&|jj|||�td��WnRtk
r�}z||k	SWYdd}~Xn$tj�d|k	r��nYnXdS(Nugenerator didn't stopu#generator didn't stop after throw()i(uNoneunextugenu
StopIterationuRuntimeErroruthrowusysuexc_info(uselfutypeuvalueu	tracebackuexc((u//opt/alt/python33/lib64/python3.3/contextlib.pyu__exit__4s 
	u!_GeneratorContextManager.__exit__N(u__name__u
__module__u__qualname__u__doc__u__init__u_recreate_cmu	__enter__u__exit__(u
__locals__((u//opt/alt/python33/lib64/python3.3/contextlib.pyu_GeneratorContextManager!s
u_GeneratorContextManagercs"t���fdd��}|S(u�@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>

    cst�||�S(N(u_GeneratorContextManager(uargsukwds(ufunc(u//opt/alt/python33/lib64/python3.3/contextlib.pyuhelperqsucontextmanager.<locals>.helper(uwraps(ufuncuhelper((ufuncu//opt/alt/python33/lib64/python3.3/contextlib.pyucontextmanagerUscBs>|EeZdZdZdd�Zdd�Zdd�ZdS(	uclosingu2Context 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()

    cCs
||_dS(N(uthing(uselfuthing((u//opt/alt/python33/lib64/python3.3/contextlib.pyu__init__�suclosing.__init__cCs|jS(N(uthing(uself((u//opt/alt/python33/lib64/python3.3/contextlib.pyu	__enter__�suclosing.__enter__cGs|jj�dS(N(uthinguclose(uselfuexc_info((u//opt/alt/python33/lib64/python3.3/contextlib.pyu__exit__�suclosing.__exit__N(u__name__u
__module__u__qualname__u__doc__u__init__u	__enter__u__exit__(u
__locals__((u//opt/alt/python33/lib64/python3.3/contextlib.pyuclosingwscBs�|EeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS(u	ExitStacku�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

    cCst�|_dS(N(udequeu_exit_callbacks(uself((u//opt/alt/python33/lib64/python3.3/contextlib.pyu__init__�suExitStack.__init__cCs+t|��}|j|_t�|_|S(u?Preserve the context stack by transferring it to a new instance(utypeu_exit_callbacksudeque(uselfu	new_stack((u//opt/alt/python33/lib64/python3.3/contextlib.pyupop_all�suExitStack.pop_allcs/��fdd�}�|_|j|�dS(u:Helper to correctly register callbacks to __exit__ methodscs
��|�S(N((uexc_details(ucmucm_exit(u//opt/alt/python33/lib64/python3.3/contextlib.pyu
_exit_wrapper�su.ExitStack._push_cm_exit.<locals>._exit_wrapperN(u__self__upush(uselfucmucm_exitu
_exit_wrapper((ucmucm_exitu//opt/alt/python33/lib64/python3.3/contextlib.pyu
_push_cm_exit�s	uExitStack._push_cm_exitcCsRt|�}y
|j}Wn"tk
r=|jj|�YnX|j||�|S(uRegisters 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)
        (utypeu__exit__uAttributeErroru_exit_callbacksuappendu
_push_cm_exit(uselfuexitu_cb_typeuexit_method((u//opt/alt/python33/lib64/python3.3/contextlib.pyupush�s


uExitStack.pushcs2���fdd�}�|_|j|��S(u\Registers an arbitrary callback and arguments.

        Cannot suppress exceptions.
        cs����dS(N((uexc_typeuexcutb(uargsucallbackukwds(u//opt/alt/python33/lib64/python3.3/contextlib.pyu
_exit_wrapper�su)ExitStack.callback.<locals>._exit_wrapper(u__wrapped__upush(uselfucallbackuargsukwdsu
_exit_wrapper((uargsucallbackukwdsu//opt/alt/python33/lib64/python3.3/contextlib.pyucallback�s	
uExitStack.callbackcCs8t|�}|j}|j|�}|j||�|S(u�Enters the supplied context manager

        If successful, also pushes its __exit__ method as a callback and
        returns the result of the __enter__ method.
        (utypeu__exit__u	__enter__u
_push_cm_exit(uselfucmu_cm_typeu_exituresult((u//opt/alt/python33/lib64/python3.3/contextlib.pyu
enter_context�s
	uExitStack.enter_contextcCs|jddd�dS(u$Immediately unwind the context stackN(u__exit__uNone(uself((u//opt/alt/python33/lib64/python3.3/contextlib.pyuclose�suExitStack.closecCs|S(N((uself((u//opt/alt/python33/lib64/python3.3/contextlib.pyu	__enter__�suExitStack.__enter__c	s
|ddk	}tj�d��fdd�}d}d}xy|jr�|jj�}y%||�r}d}d}d}nWqAtj�}||d|d�d}|}YqAXqAW|ry|dj}|d�Wqtk
r�||d_�YqXn|o|S(NiicsNx>|j}||krdS|dks4|�kr8Pn|}q||_dS(N(u__context__uNone(unew_excuold_excuexc_context(u	frame_exc(u//opt/alt/python33/lib64/python3.3/contextlib.pyu_fix_exception_context�s		u2ExitStack.__exit__.<locals>._fix_exception_contextFT(NNN(	uNoneusysuexc_infouFalseu_exit_callbacksupopuTrueu__context__u
BaseException(	uselfuexc_detailsureceived_excu_fix_exception_contextusuppressed_excu
pending_raiseucbunew_exc_detailsu	fixed_ctx((u	frame_excu//opt/alt/python33/lib64/python3.3/contextlib.pyu__exit__�s2



uExitStack.__exit__N(
u__name__u
__module__u__qualname__u__doc__u__init__upop_allu
_push_cm_exitupushucallbacku
enter_contextucloseu	__enter__u__exit__(u
__locals__((u//opt/alt/python33/lib64/python3.3/contextlib.pyu	ExitStack�s

(
u__doc__usysucollectionsudequeu	functoolsuwrapsu__all__uobjectuContextDecoratoru_GeneratorContextManagerucontextmanageruclosingu	ExitStack(((u//opt/alt/python33/lib64/python3.3/contextlib.pyu<module>s4"