Module Expr Str Import alias ImportFrom alias ImportFrom alias Assign NameStore ListLoad Str Str Str ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body TryExcept body Return Call AttributeLoad AttributeLoad NameLoad attr attr handlers ExceptHandler type NameLoad body Raise Call NameLoad Str decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body If CompareIs NameLoad NameLoad body TryExcept body Expr Call AttributeLoad AttributeLoad NameLoad attr attr handlers ExceptHandler type NameLoad body Return orelse Raise Call NameLoad Str orelse If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad TryExcept body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad Raise Call NameLoad Str handlers ExceptHandler type NameLoad name NameStore body Return CompareIsNot NameLoad NameLoad ExceptHandler body If CompareIsNot SubscriptLoad Call AttributeLoad NameLoad attr Index Num NameLoad body Raise decorator_list decorator_list FunctionDef arguments args NameParam defaults body Expr Str FunctionDef arguments args defaults vararg kwarg body Return Call NameLoad Call NameLoad NameLoad NameLoad decorator_list Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args defaults vararg body Expr Str Expr Call NameLoad Str NameLoad Num Assign NameStore ListLoad Assign NameStore ListLoad Assign NameStore TupleLoad NameLoad NameLoad NameLoad TryFinally body TryExcept body For NameStore NameLoad body Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Yield NameLoad handlers ExceptHandler body Assign NameStore Call AttributeLoad NameLoad attr finalbody While NameLoad body Assign NameStore Call AttributeLoad NameLoad attr TryExcept body If Call NameLoad NameLoad body Assign NameStore TupleLoad NameLoad NameLoad NameLoad handlers ExceptHandler body Assign NameStore Call AttributeLoad NameLoad attr If CompareNotEq NameLoad TupleLoad NameLoad NameLoad NameLoad body Raise SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num decorator_list NameLoad ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults vararg body Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list decorator_list
N/A N/A Utilities for with-statement contexts.  See PEP 343. N/A sys functools wraps warnings warn N/A __all__ N/A contextmanager nested closing GeneratorContextManager N/A object N/A N/A Helper for @contextmanager decorator. __init__ N/A N/A self gen N/A N/A N/A N/A self gen gen N/A __enter__ N/A N/A self N/A N/A N/A N/A N/A N/A N/A N/A self gen next N/A N/A N/A StopIteration N/A N/A N/A RuntimeError generator didn't yield N/A __exit__ N/A N/A self type value traceback N/A N/A N/A N/A type None N/A N/A N/A N/A N/A N/A N/A self gen next N/A N/A N/A StopIteration N/A N/A N/A N/A N/A RuntimeError generator didn't stop N/A N/A N/A value None N/A N/A value N/A type N/A N/A N/A N/A N/A N/A self gen throw type value traceback N/A N/A RuntimeError generator didn't stop after throw() N/A N/A N/A StopIteration N/A exc N/A N/A N/A exc value N/A N/A N/A N/A N/A N/A N/A sys exc_info N/A 1 value N/A N/A N/A N/A contextmanager N/A N/A func N/A N/A N/A @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>

     helper N/A N/A N/A args kwds N/A N/A N/A GeneratorContextManager N/A func args kwds N/A N/A wraps func N/A helper N/A nested N/A N/A N/A managers N/A N/A Combine multiple context managers into a single nested context manager.

   This function has been deprecated in favour of the multiple manager form
   of the with statement.

   The one advantage of this function over the multiple manager form of the
   with statement is that argument unpacking allows it to be
   used with a variable number of context managers as follows:

      with nested(*managers):
          do_something()

     N/A N/A warn With-statements now directly support multiple context managers DeprecationWarning 3 N/A exits N/A N/A vars N/A N/A exc N/A None None None N/A N/A N/A N/A N/A mgr managers N/A N/A exit N/A mgr __exit__ N/A enter N/A mgr __enter__ N/A N/A N/A vars append N/A enter N/A N/A N/A exits append exit N/A N/A vars N/A N/A N/A N/A exc N/A N/A sys exc_info N/A N/A exits N/A N/A exit N/A N/A exits pop N/A N/A N/A N/A exit exc N/A N/A exc N/A None None None N/A N/A N/A N/A exc N/A N/A sys exc_info N/A N/A exc N/A None None None N/A N/A N/A exc N/A 0 N/A exc N/A 1 N/A exc N/A 2 N/A contextmanager closing N/A object N/A N/A 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()

     __init__ N/A N/A self thing N/A N/A N/A N/A self thing thing N/A __enter__ N/A N/A self N/A N/A N/A N/A self thing N/A __exit__ N/A N/A self N/A exc_info N/A N/A N/A N/A N/A self thing close N/A N/A