Module Expr Str Import alias Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias alias ImportFrom alias alias alias Assign NameStore Call NameLoad Assign NameStore Call NameLoad Assign NameStore Call NameLoad Assign NameStore Dict ClassDef bases NameLoad body Expr Str Pass decorator_list ClassDef bases NameLoad body Expr Str Pass decorator_list FunctionDef arguments args NameParam defaults body Expr Str FunctionDef arguments args NameParam defaults vararg kwarg body Assign AttributeStore NameLoad attr NameLoad Expr Call NameLoad NameLoad TryExcept body Assign AttributeStore NameLoad attr NameStore Call NameLoad NameLoad NameLoad NameLoad handlers ExceptHandler type NameLoad body Expr Call NameLoad NameLoad Raise If UnaryOpNot Call NameLoad NameLoad NameLoad body Expr Call NameLoad NameLoad Return NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call NameLoad NameLoad NameLoad decorator_list Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call NameLoad NameLoad Return With AttributeLoad NameLoad attr NameStore body Assign AttributeStore NameLoad attr NameLoad TryExcept body If CompareIs NameLoad NameLoad body Raise Call NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad name NameStore body If AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call NameLoad NameLoad Return Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr TryExcept body Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Assign TupleStore NameStore NameStore NameStore Call NameLoad Num keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If UnaryOpNot CompareIn Str NameLoad body Assign SubscriptStore NameLoad Index Str Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Expr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str FunctionDef arguments args NameParam defaults vararg kwarg body Assign AttributeStore NameLoad attr NameLoad Expr Call NameLoad NameLoad TryExcept body Assign AttributeStore NameLoad attr NameStore Call NameLoad NameLoad NameLoad NameLoad handlers ExceptHandler type NameLoad body Expr Call NameLoad NameLoad Raise If UnaryOpNot Call NameLoad NameLoad NameLoad body Expr Call NameLoad NameLoad Return NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call NameLoad NameLoad NameLoad decorator_list Call NameLoad NameLoad Return NameLoad decorator_list Assign AttributeStore NameLoad attr NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str If AttributeLoad NameLoad attr body If BoolOpOr UnaryOpNot NameLoad CompareIs NameLoad NameLoad body If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Expr Call NameLoad NameLoad Return If Call NameLoad NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr TryExcept body Assign NameStore Call NameLoad NameLoad NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call NameLoad NameLoad Return If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad Call NameLoad NameLoad NameLoad Return NameLoad If Call NameLoad NameLoad NameLoad body Assign TupleStore NameStore NameStore NameStore TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse If Call NameLoad NameLoad NameLoad body If CompareEq Call NameLoad NameLoad Num body Assign TupleStore NameStore NameStore NameStore NameLoad orelse Assign TupleStore NameStore NameStore NameLoad Assign NameStore Call NameLoad orelse Assign NameStore Num Assign NameStore Call NameLoad If AttributeLoad NameLoad attr body If Call NameLoad AttributeLoad NameLoad attr NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr orelse Assign NameStore Call NameLoad AttributeLoad NameLoad attr If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr orelse Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore NameLoad If BoolOpAnd AttributeLoad NameLoad attr UnaryOpNot CompareIn Str NameLoad body Assign SubscriptStore NameLoad Index Str AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Str Str If CompareIn Str NameLoad body Assign AttributeStore NameLoad attr Call AttributeLoad SubscriptLoad Call AttributeLoad NameLoad attr Str Num Index Num attr If UnaryOpNot CompareIn Str NameLoad body If BoolOpOr Call NameLoad NameLoad Str BoolOpAnd Call NameLoad NameLoad NameLoad CompareIn Call AttributeLoad SubscriptLoad NameLoad Slice Num attr TupleLoad Str Str body Assign SubscriptStore NameLoad Index Str BinOpMod Str AttributeLoad NameLoad attr orelse If Call NameLoad NameLoad TupleLoad NameLoad NameLoad NameLoad body Assign SubscriptStore NameLoad Index Str Str orelse Assign SubscriptStore NameLoad Index Str BinOpMod Str AttributeLoad NameLoad attr Assign NameStore NameLoad If CompareIsNot NameLoad NameLoad body TryExcept body Assign NameStore Call NameLoad NameLoad NameLoad handlers ExceptHandler type NameLoad name NameStore body Assign NameStore NameLoad With AttributeLoad NameLoad attr NameStore body TryExcept body Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad handlers ExceptHandler type NameLoad body Assign TupleStore NameStore NameStore NameStore Call NameLoad Num keyword NameLoad If UnaryOpNot CompareIn Str NameLoad body Assign SubscriptStore NameLoad Index Str Call NameLoad NameLoad If BoolOpAnd UnaryOpNot CompareIn Str NameLoad UnaryOpNot CompareIn Str NameLoad body Assign SubscriptStore NameLoad Index Str Str Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If CompareEq Call AttributeLoad AttributeLoad NameLoad attr attr Str body Expr Call AttributeLoad NameLoad attr Expr Call NameLoad NameLoad Return If CompareIsNot NameLoad NameLoad body If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad Call NameLoad NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr Expr Call NameLoad NameLoad Return Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str FunctionDef arguments args NameParam defaults vararg kwarg body Assign AttributeStore NameLoad attr NameLoad Expr Call NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad TryExcept body Assign AttributeStore NameLoad attr NameStore Call NameLoad NameLoad NameLoad NameLoad handlers ExceptHandler type NameLoad body Expr Call NameLoad NameLoad Raise If UnaryOpNot Call NameLoad NameLoad NameLoad body Expr Call NameLoad NameLoad Return NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call NameLoad NameLoad NameLoad decorator_list Call NameLoad NameLoad Return NameLoad decorator_list Assign AttributeStore NameLoad attr NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str If UnaryOpNot AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Dict Str Str If CompareIs NameLoad NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call NameLoad NameLoad Return If Call NameLoad NameLoad NameLoad body Assign TupleStore NameStore NameStore NameLoad orelse Assign NameStore Dict If BoolOpAnd UnaryOpNot NameLoad UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr Str Return NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Str orelse Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad Str attr GeneratorExp BinOpMod Str NameLoad comprehension NameStore Call AttributeLoad NameLoad attr For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body Assign NameStore BinOpMod Str TupleLoad NameLoad Call NameLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Return NameLoad decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Return BinOpMod Str SubscriptLoad NameLoad Index Num decorator_list decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call NameLoad TupleLoad NameLoad decorator_list Assign AttributeStore NameLoad attr NameLoad FunctionDef arguments args NameParam defaults vararg kwarg body Expr Str Assign SubscriptStore NameLoad Index Str NameStore Call NameLoad Expr Call NameLoad NameLoad NameLoad Return NameLoad decorator_list Assign AttributeStore NameLoad attr NameLoad ClassDef bases NameLoad body Expr Str Assign NameStore TupleLoad Str Str FunctionDef arguments args NameParam NameParam defaults NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameStore AttributeLoad AttributeLoad NameLoad attr attr Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults vararg kwarg body Assign NameStore AttributeLoad NameLoad attr If Call NameLoad NameLoad Str body If AttributeLoad NameLoad attr body Assign NameStore TupleLoad NameLoad NameLoad orelse If CompareEq Call NameLoad NameLoad Num body Assign NameStore SubscriptLoad NameLoad Index Num Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad Expr Call NameLoad NameLoad NameLoad decorator_list decorator_list Assign AttributeStore NameLoad attr NameLoad ClassDef bases NameLoad body Assign NameStore NameLoad decorator_list FunctionDef arguments args NameParam defaults NameLoad body Expr Str Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assign TupleStore NameStore AttributeStore NameLoad attr TupleLoad Call NameLoad AttributeLoad NameLoad attr ListLoad Assign AttributeStore NameLoad attr NameLoad Return NameLoad decorator_list Assign AttributeStore NameLoad attr NameLoad FunctionDef arguments args NameParam defaults body Expr Str If UnaryOpNot Call NameLoad NameLoad Str body Return If BoolOpOr UnaryOpNot AttributeLoad NameLoad attr UnaryOpNot Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad body Return Assign NameStore ListLoad For NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad NameLoad attr IfExp CompareIsNot NameLoad NameLoad NameLoad NameLoad Expr Call NameLoad NameLoad Call NameLoad NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If UnaryOpNot Call NameLoad NameLoad Str body Return Assign NameStore IfExp AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad If UnaryOpNot Call NameLoad NameLoad TupleLoad NameLoad NameLoad body Return If CompareIs NameLoad NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call NameLoad NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Return If Call NameLoad GeneratorExp CompareIs SubscriptLoad AttributeLoad NameLoad attr Index NameLoad NameLoad comprehension NameStore NameLoad body Return If Call NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Assign NameStore ListComp Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad comprehension NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call NameLoad NameLoad NameLoad decorator_list ClassDef bases NameLoad body Assign NameStore NameLoad Assign NameStore NameLoad decorator_list FunctionDef arguments args NameParam defaults vararg body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If UnaryOpNot NameLoad body Return If CompareEq Call NameLoad NameLoad Num body Assign NameStore SubscriptLoad NameLoad Index Num For NameStore NameLoad body Assign NameStore Call NameLoad If UnaryOpNot NameLoad body Continue If UnaryOpNot Call NameLoad NameLoad Str body Continue If BoolOpOr UnaryOpNot AttributeLoad NameLoad attr UnaryOpNot Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad body Continue Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If Call NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Expr Call NameLoad NameLoad NameLoad decorator_list Assign AttributeStore NameLoad attr NameLoad FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call NameLoad TupleLoad NameLoad NameLoad Return NameLoad decorator_list Assign AttributeStore NameLoad attr NameLoad FunctionDef arguments args NameParam defaults body If UnaryOpNot Call NameLoad NameLoad Str body Return If BoolOpOr UnaryOpNot AttributeLoad NameLoad attr UnaryOpNot Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad body Return Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If BoolOpAnd CompareIn SubscriptLoad NameLoad Index Num NameLoad CompareIn AttributeLoad NameLoad attr SubscriptLoad NameLoad Index SubscriptLoad NameLoad Index Num body Expr Call AttributeLoad SubscriptLoad NameLoad Index SubscriptLoad NameLoad Index Num attr AttributeLoad NameLoad attr Expr Call NameLoad NameLoad Call NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Dict Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr Call NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If Call NameLoad NameLoad Str body Assign NameStore Call AttributeLoad NameLoad attr If Call NameLoad NameLoad TupleLoad NameLoad NameLoad NameLoad body With AttributeLoad NameLoad attr NameStore body Return Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr orelse If Call NameLoad NameLoad NameLoad body Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse If UnaryOpNot Call NameLoad NameLoad NameLoad body With AttributeLoad NameLoad attr body Return Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Delete AttributeDel NameLoad attr Delete AttributeDel NameLoad attr Delete AttributeDel NameLoad attr Delete AttributeDel NameLoad attr Delete AttributeDel NameLoad attr TryExcept body Delete AttributeDel NameLoad attr handlers ExceptHandler type NameLoad body Delete AttributeDel NameLoad attr Delete AttributeDel NameLoad attr Return For NameStore AttributeLoad NameLoad attr body Assign NameStore Call NameLoad NameLoad Str NameLoad If BoolOpAnd NameLoad Call NameLoad NameLoad body TryExcept body Expr Call NameLoad handlers ExceptHandler type NameLoad body Pass Expr Call AttributeLoad AttributeLoad NameLoad attr attr Delete AttributeDel NameLoad attr Delete AttributeDel NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str If AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad NameLoad NameLoad NameLoad Return TryFinally body Assign AttributeStore NameLoad attr NameLoad While NameLoad body Assign NameStore NameLoad With AttributeLoad NameLoad attr NameStore body If UnaryOpNot AttributeLoad AttributeLoad NameLoad attr attr body TryFinally body TryExcept body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad handlers ExceptHandler type NameLoad body Pass ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr finalbody Expr Call NameLoad NameLoad Return TryExcept body If NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad orelse Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad handlers ExceptHandler type NameLoad body Assign NameStore NameLoad ExceptHandler type NameLoad name NameStore body If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call NameLoad NameLoad Return Assign NameStore NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad BinOpMod Str AttributeLoad NameLoad attr NameLoad If NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad orelse Assign NameStore Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword NameLoad ExceptHandler type NameLoad name NameStore body If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call NameLoad NameLoad Return Assign NameStore NameLoad Assign NameStore NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr ExceptHandler type NameLoad name NameStore body If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call NameLoad NameLoad Return Assign NameStore NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr TryExcept body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Assign NameStore Call NameLoad Num keyword NameLoad If NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call NameLoad NameLoad NameLoad Return If BoolOpAnd UnaryOpNot Call NameLoad NameLoad NameLoad Call NameLoad NameLoad TupleLoad NameLoad NameLoad Call NameLoad GeneratorExp Call NameLoad NameLoad NameLoad comprehension NameStore NameLoad body Assign NameStore Call NameLoad NameLoad If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr SubscriptLoad NameLoad Index Num NameLoad NameLoad NameLoad orelse If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad orelse If Call NameLoad NameLoad NameLoad body If AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad orelse If Call NameLoad NameLoad NameLoad body If SubscriptLoad NameLoad Index Num body Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr SubscriptLoad NameLoad Index Num NameLoad NameLoad Assign AttributeStore NameLoad attr NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num ListLoad attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad orelse If CompareIs Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad body Assign NameStore NameLoad Assign NameStore NameLoad Continue Break finalbody If Call NameLoad NameLoad Str body Assign AttributeStore NameLoad attr NameLoad decorator_list
N/A N/A 
This is the asynchronous request helper for the Application system, utilizing
generator coroutines for optimal performance and ease of development.
 N/A json N/A traceback N/A weakref functools wraps types GeneratorType pants.http.utils HTTPHeaders pants.web.application Application error Response RequestContext pants.web.utils HTTPException HTTPTransparentRedirect log N/A Again N/A object N/A Waiting N/A object N/A Finished N/A object N/A receivers N/A TimeoutError N/A Exception N/A N/A 
    Instances of TimeoutError are raised into an asynchronous request handler
    when an :func:`async.wait` or :func:`async.receive` timeout.
     N/A N/A RequestClosed N/A Exception N/A N/A 
    An instance of RequestClosed is raised into an asynchronous request handler
    when the connection for the request is closed.
     N/A N/A async N/A N/A func N/A N/A N/A 
    The ``@async`` decorator is used in conjunction with
    :class:`pants.web.Application` to create asynchronous request handlers using
    generators. This is useful for performing database lookups and doing other
    I/O bound tasks without blocking the server. The following example performs
    a simple database lookup with a `fork <https://github.com/stendec/asyncmongo>`_
    of `asyncmongo <https://github.com/bitly/asyncmongo>`_ that adds support for
    Pants. It then uses `jinja2 <http://jinja.pocoo.org/>`_ templates to render
    the response.

    .. code-block:: python

        from pants.web import Application, async

        import jinja2
        import asyncmongo

        database_options = {
            'host': '127.0.0.1',
            'port': 27017,
            'dbname': 'test',
        }

        db = asyncmongo.Client(pool_id='web', backend='pants', **database_options)

        app = Application()
        env = jinja2.Environment(loader=jinja2.FileSystemLoader("templates"))

        index_template = env.get_template("index.html")

        @app.route("/")
        @async
        def index(request):
            results = yield async.run(db.news.find, {'published': True})
            yield index_template.render(data=results)

        app.run()

    Additionally, the @async decorator also allows for the easy implementation
    of server-sent events, including support for the ``text/event-stream``
    Content-Type used by HTML5 ```EventSource
    <http://dev.w3.org/html5/eventsource/>`_``.

    .. seealso::

        :func:`async.stream`, :func:`async.event_stream`
     wrapper N/A N/A request N/A args kwargs N/A N/A N/A request _writer _async_finish N/A N/A _init request N/A N/A N/A N/A request _gen gen N/A func request args kwargs N/A N/A N/A Exception N/A N/A N/A _cleanup request N/A N/A N/A N/A isinstance gen GeneratorType N/A N/A N/A _cleanup request N/A gen N/A N/A request auto_finish False N/A N/A _do request None N/A N/A wraps func N/A wrapper N/A _async_finish N/A N/A request output N/A N/A N/A 
    Write the provided output to the request and finish the request.
     N/A N/A request _started N/A N/A N/A N/A N/A request connection close False N/A N/A _cleanup request N/A N/A N/A request _context app N/A N/A N/A request auto_finish True N/A N/A N/A N/A output Finished N/A N/A N/A RuntimeError Reached StopIteration in asynchronous request handler. N/A N/A N/A app parse_output output N/A N/A N/A Exception N/A err N/A N/A N/A request _started N/A N/A N/A N/A N/A request connection close False N/A N/A _cleanup request N/A N/A N/A request _tb N/A N/A traceback format_exc N/A N/A N/A N/A body status headers N/A N/A app handle_500 request err N/A N/A N/A Exception N/A N/A N/A N/A log exception N/A There was a problem handling an asynchronous request, and a problem running Application.handle_500 for %r. app N/A N/A body status headers N/A error 500 request request N/A N/A N/A request send_status status N/A N/A N/A Content-Length headers N/A N/A N/A headers N/A Content-Length N/A len body N/A N/A N/A request send_headers headers N/A N/A N/A request write body N/A N/A N/A request finish N/A N/A _cleanup request N/A stream N/A N/A func N/A N/A N/A 
    The ``@async.stream`` decorator is used to create asynchronous request
    handlers using generators. This can be used to begin writing a portion of
    the response to the client before the entire response can be generated.

    The very first yielded output is processed for a status code and headers
    using the same logic that :class:`~pants.web.Application` uses for its
    standard route functions.

    Subsequently yielded values are *not* processed, so returning a status code
    and/or headers in that situation will result in undesired output. You may
    return an instance of :class:`pants.web.Response` *or* the bare value to
    write out.

    The following is, though not particularly useful, an example::

        @app.route("/")
        @async.stream
        def index(request):
            yield None, 200, {'X-Pizza': 'Yum'}
            yield "This is an example.
"
            yield "It isn't particularly useful.
"

            yield ("This will be treated as a list and serialized with "
                   "JSON because you can't set the status code or provide "
                   "additional headers after the response has started."), 401

     wrapped N/A N/A request N/A args kwargs N/A N/A N/A request _writer _stream_output N/A N/A _init request N/A N/A N/A N/A request _gen gen N/A func request args kwargs N/A N/A N/A Exception N/A N/A N/A _cleanup request N/A N/A N/A N/A isinstance gen GeneratorType N/A N/A N/A _cleanup request N/A gen N/A N/A request auto_finish False N/A N/A _do request None N/A N/A wraps func N/A wrapped N/A N/A N/A async stream stream _stream_output N/A N/A request output N/A N/A N/A 
    Write the provided chunk of data to the stream. This will automatically
    encode the output as Transfer-Encoding: chunked if necessary.
     N/A N/A request _started N/A N/A N/A N/A output N/A output Finished N/A N/A N/A request _chunked N/A N/A N/A N/A request write 0


 N/A N/A N/A request finish N/A N/A _cleanup request N/A N/A N/A isinstance output Response N/A N/A output N/A output body N/A N/A N/A output N/A _cast request output N/A N/A N/A Exception N/A N/A N/A N/A log exception Error casting output for asynchronous stream. N/A N/A N/A N/A request connection close False N/A N/A _cleanup request N/A N/A N/A request _chunked N/A N/A N/A N/A request write N/A %x
%s
 N/A N/A len output output N/A Again N/A N/A isinstance output Response N/A N/A N/A output status headers N/A N/A output body N/A output status N/A output headers N/A N/A N/A isinstance output tuple N/A N/A N/A N/A len output 3 N/A N/A N/A output status headers output N/A N/A N/A output status output N/A headers N/A HTTPHeaders N/A N/A status 200 N/A headers N/A HTTPHeaders N/A N/A request _rule_headers N/A N/A N/A isinstance N/A request _rule_headers HTTPHeaders N/A N/A rule_headers N/A N/A N/A request _rule_headers copy N/A N/A rule_headers N/A HTTPHeaders N/A request _rule_headers N/A N/A isinstance headers HTTPHeaders N/A N/A N/A N/A N/A rule_headers _data update N/A headers _data N/A N/A N/A N/A rule_headers update headers N/A headers rule_headers N/A N/A N/A request _rule_content_type N/A N/A Content-Type headers N/A N/A N/A headers N/A Content-Type N/A request _rule_content_type N/A content_type N/A N/A headers get Content-Type N/A N/A charset= content_type N/A N/A N/A request _charset N/A N/A N/A N/A N/A content_type split charset= 1 N/A 1 strip N/A N/A N/A Content-Type headers N/A N/A N/A N/A hasattr output to_html N/A N/A isinstance output basestring N/A N/A N/A N/A output N/A 5 lower N/A <html <!doc N/A N/A N/A headers N/A Content-Type N/A text/html; charset=%s N/A request _charset N/A N/A N/A isinstance output N/A tuple list dict N/A N/A N/A headers N/A Content-Type application/json N/A N/A N/A headers N/A Content-Type N/A text/plain; charset=%s N/A request _charset N/A errored False N/A N/A output None N/A N/A N/A N/A output N/A _cast request output N/A N/A N/A Exception N/A err N/A N/A errored True N/A N/A request _context app N/A N/A N/A N/A N/A output status headers N/A N/A app handle_500 request err N/A N/A N/A Exception N/A N/A N/A output status headers N/A error 500 request request N/A N/A N/A Content-Length headers N/A N/A N/A headers N/A Content-Length N/A len output N/A N/A N/A N/A Content-Length headers N/A N/A Transfer-Encoding headers N/A N/A N/A headers N/A Transfer-Encoding chunked N/A N/A request _chunked True N/A N/A N/A request send_status status N/A N/A N/A request send_headers headers N/A N/A N/A N/A N/A request method upper HEAD N/A N/A N/A N/A request finish N/A N/A _cleanup request N/A N/A N/A output None N/A N/A N/A request _chunked N/A N/A N/A N/A request write N/A %x
%s
 N/A N/A len output output N/A N/A N/A N/A request write output N/A errored N/A N/A N/A N/A request finish N/A N/A _cleanup request N/A N/A Again N/A event_stream N/A N/A func N/A N/A N/A 
    The ``@async.event_stream`` decorator allows you to easily push server-sent
    events from Pants to your web clients using the new HTML5 `EventSource
    <http://dev.w3.org/html5/eventsource/>`_ API. Example::

        from pants.web import Application, async, TimeoutError

        @app.route("/events")
        @async.event_stream
        def events(request):
            try:
                message = yield async.receive("events", 10)
            except TimeoutError:
                yield None
            else:
                yield message

        # Elsewhere...

        async.send("events", "Something happened!")

    When you yield a value, there are a few ways it can be processed.

    1.  If the value is empty, None, etc. a single comment line will be sent to
        the client to keep the connection alive.

    2.  If the value is a tuple, it will be separated into ``(output, headers)``
        and the provided message headers will be prepended to the output before
        it's sent to the client.

    3.  Any other values for the output will result in normal output processing
        before the output is sent to the client as a message.

    .. note::

        ``@async.event_stream`` automatically formats output messages, handling
        line breaks for you.

     wrapped N/A N/A request N/A args kwargs N/A N/A N/A request _writer _event_stream_output N/A N/A _init request N/A N/A request _chunked True N/A N/A N/A N/A request _gen gen N/A func request args kwargs N/A N/A N/A Exception N/A N/A N/A _cleanup request N/A N/A N/A N/A isinstance gen GeneratorType N/A N/A N/A _cleanup request N/A gen N/A N/A request auto_finish False N/A N/A _do request None N/A N/A wraps func N/A wrapped N/A N/A N/A async event_stream event_stream _event_stream_output N/A N/A request output N/A N/A N/A 
    Write a text/event-stream message to the client. If no data has been sent
    yet, it writes a 200 OK response code and a Content-Type header.
     N/A N/A N/A request _started N/A N/A N/A N/A request send_status N/A N/A N/A request send_headers N/A Content-Type text/event-stream N/A N/A output Finished N/A N/A N/A N/A N/A request connection close N/A N/A _cleanup request N/A N/A N/A isinstance output tuple N/A N/A N/A output headers output N/A N/A headers N/A N/A N/A N/A output N/A headers N/A N/A N/A N/A request write :
 N/A Again N/A N/A output None N/A N/A output N/A N/A output N/A _cast request output N/A output N/A N/A join N/A N/A data: %s x N/A x N/A N/A output splitlines N/A N/A key value N/A N/A headers iteritems N/A N/A output N/A %s: %s
%s N/A key N/A _cast request value output N/A N/A N/A request write N/A %s

 output N/A Again N/A _Sleeper N/A tuple N/A __repr__ N/A N/A self N/A N/A N/A N/A _Sleeper(%r) N/A self N/A 0 N/A N/A sleep N/A N/A time N/A N/A N/A 
    Sleep for *time* seconds, doing nothing else during that period.
     N/A N/A _Sleeper N/A time N/A N/A N/A async sleep sleep run N/A N/A function N/A args kwargs N/A N/A 
    Run *function* with the provided *args* and *kwargs*.

    This works for any function that supports the ``callback`` keyword argument
    by inserting a callback object into the keyword arguments before calling
    the function.

    If you need to asynchronously call a function that *doesn't* use
    ``callback``, please use :func:`async.callback`.

    Here is a brief example using an `asyncmongo
    <https://github.com/bitly/asyncmongo>`_ Client named ``db``::

        @app.route("/count")
        @async
        def count(request):
            results = yield async.run(db.news.find, {'published': True})
            yield len(results)

    .. note::

        ``async.run`` does *not* process keyword arguments passed to the
        callback. If you require the keyword arguments, you must use
        :func:`async.callback` manually.

    Calling ``async.run`` returns the instance of
    :class:`pants.web.Callback` used. Yielding that instance will
    wait until the callback is triggered and return the value passed to
    the callback.
     N/A N/A kwargs N/A callback cb N/A Callback N/A N/A function args kwargs N/A cb N/A N/A N/A async run run Callback N/A object N/A N/A 
    Return an instance of :class:`pants.web.Callback` that can be used as a
    callback with other asynchronous code to capture output and return it to
    an asynchronous request handler.

    Yielding an instance of Callback will wait until the callback has been
    triggered, and then return values that were sent to the callback so that
    they may be used by the asynchronous request handler.

    It's easy::

        @app.route("/")
        @async
        def index(request):
            callback = async.callback()
            do_something_crazy(request, on_complete=callback)

            result = yield callback
            if not result:
                abort(403)

            yield result

     N/A __slots__ N/A request use_kwargs __init__ N/A N/A self use_kwargs N/A False N/A N/A N/A self use_kwargs use_kwargs N/A N/A self request request N/A N/A Application current_app request N/A N/A N/A request _callbacks N/A self Waiting N/A N/A N/A N/A request _unhandled append self N/A __call__ N/A N/A self N/A args kwargs N/A N/A request N/A self request N/A N/A hasattr request _callbacks N/A N/A N/A self use_kwargs N/A N/A args N/A args kwargs N/A N/A N/A N/A len args 1 N/A N/A args N/A args N/A 0 N/A N/A N/A request _callbacks N/A self args N/A N/A _check_waiting request self N/A N/A N/A N/A async callback Callback _WaitList N/A list N/A N/A timeout None N/A wait N/A N/A timeout N/A None N/A N/A 
    Wait for all asynchronous callbacks to return, and return a list of those
    values. If a *timeout* is provide, wait up to that many seconds for the
    callbacks to return before raising a TimeoutError containing a list of
    the results that *did* complete.
     N/A request N/A N/A Application current_app request N/A N/A top N/A request _unhandled N/A N/A _WaitList N/A request _unhandled N/A N/A N/A top timeout timeout N/A top N/A N/A N/A async wait wait _wait_timeout N/A N/A request N/A N/A N/A 
    Handle a timed-out async.wait().
     N/A N/A N/A hasattr request _in_do N/A N/A N/A N/A N/A N/A request _waiting N/A N/A isinstance N/A N/A request _waiting N/A -1 _WaitList N/A N/A N/A input N/A N/A key N/A N/A N/A request _waiting pop N/A N/A value N/A N/A N/A request _callbacks pop key N/A N/A N/A input append N/A N/A value Waiting value None N/A N/A _do request N/A TimeoutError input as_exception True N/A _check_waiting N/A N/A request trigger N/A None N/A N/A 
    Check the waiting list for the provided request to determine if we should
    be taking action. If we should, pop the top item from the waiting list and
    send the input we've gathered into _do.
     N/A N/A N/A hasattr request _in_do N/A N/A N/A top N/A N/A request _waiting N/A N/A request _waiting N/A -1 None N/A N/A N/A isinstance top N/A _WaitList Callback N/A N/A N/A N/A top trigger N/A N/A N/A N/A N/A request _waiting pop N/A N/A _do request N/A N/A N/A request _callbacks pop trigger N/A N/A N/A any N/A N/A N/A N/A request _callbacks N/A key Waiting N/A key top N/A N/A N/A N/A callable N/A top timeout N/A N/A N/A N/A top timeout N/A input N/A N/A N/A N/A request _callbacks pop key N/A key N/A N/A N/A request _waiting pop N/A N/A _do request input N/A _Receiver N/A tuple N/A N/A timeout None N/A ref None N/A send N/A N/A key N/A args N/A N/A 
    Send a message with the provided ``*args`` to all asynchronous requests
    listening for *key*.
     N/A recv N/A N/A receivers pop key None N/A N/A recv N/A N/A N/A N/A N/A len args 1 N/A N/A args N/A args N/A 0 N/A ref recv N/A N/A request N/A ref N/A N/A request N/A N/A N/A N/A N/A hasattr request _in_do N/A N/A N/A N/A N/A N/A request _waiting N/A N/A isinstance N/A N/A request _waiting N/A -1 _Receiver N/A N/A N/A top N/A N/A N/A request _waiting pop N/A N/A callable N/A top timeout N/A N/A N/A N/A top timeout N/A N/A _do request args N/A N/A N/A async send send receive N/A N/A key timeout N/A None N/A N/A 
    Listen for messages with the key *key*. If *timeout* is specified, wait
    up to that many seconds before raising a TimeoutError.
     N/A out N/A _Receiver N/A key timeout N/A out N/A N/A N/A async receive receive _receive_timeout N/A N/A request N/A N/A N/A N/A N/A hasattr request _in_do N/A N/A N/A N/A N/A N/A request _waiting N/A N/A isinstance N/A N/A request _waiting N/A -1 _Receiver N/A N/A N/A top N/A N/A N/A request _waiting pop N/A N/A N/A N/A top N/A 0 receivers N/A N/A top ref N/A receivers N/A N/A top N/A 0 N/A N/A N/A N/A N/A receivers N/A N/A top N/A 0 remove N/A top ref N/A N/A _do request N/A TimeoutError as_exception True N/A _init N/A N/A request N/A N/A N/A 
    Set a bit of state for the request.
     N/A N/A request _in_do False N/A N/A request _chunked False N/A N/A request _charset utf-8 N/A N/A request _tb None N/A N/A request _callbacks N/A N/A N/A request _waiting N/A N/A N/A request _unhandled N/A N/A N/A request _context N/A RequestContext N/A _cast N/A N/A request output N/A N/A N/A 
    Convert an output object into something we can send over a connection.
     N/A N/A hasattr output to_html N/A N/A output N/A N/A output to_html N/A N/A isinstance output N/A tuple list dict N/A N/A N/A request _context app N/A N/A N/A N/A json dumps output cls N/A app json_encoder N/A N/A N/A isinstance output unicode N/A N/A N/A N/A output encode N/A request _charset N/A N/A N/A N/A isinstance output str N/A N/A N/A request _context N/A N/A N/A str output N/A output N/A _cleanup N/A N/A request N/A N/A N/A 
    Delete the context manager and everything else.
     N/A N/A request _in_do N/A N/A request _chunked N/A N/A request _charset N/A N/A request _unhandled N/A N/A request _context N/A N/A N/A N/A request _gen N/A N/A N/A AttributeError N/A N/A N/A request _callbacks N/A N/A request _waiting N/A N/A item N/A request _waiting N/A N/A timer N/A getattr item timeout None N/A N/A timer N/A callable timer N/A N/A N/A N/A N/A timer N/A N/A N/A Exception N/A N/A N/A N/A N/A N/A request _callbacks clear N/A N/A request _callbacks N/A N/A request _waiting N/A _do N/A N/A request input as_exception N/A False N/A N/A 
    Send the provided input to the asynchronous request handler for *request*.
    If ``as_exception`` is truthy, throw it into the generator as an exception,
    otherwise it's just sent.
     N/A N/A request _in_do N/A N/A N/A N/A N/A N/A request connection engine callback _do request input as_exception N/A N/A N/A N/A N/A request _in_do True N/A True N/A N/A errored False N/A N/A request _context app N/A N/A N/A N/A N/A request connection connected N/A N/A N/A N/A N/A N/A N/A N/A N/A request _gen throw N/A RequestClosed N/A N/A N/A RequestClosed N/A N/A N/A N/A Exception N/A N/A N/A N/A log exception N/A Error while cleaning up closed asynchronous request: %s %s N/A N/A request method N/A request url N/A N/A N/A _cleanup request N/A N/A N/A N/A as_exception N/A N/A output N/A N/A N/A request _gen throw input N/A N/A output N/A N/A N/A request _gen send input N/A N/A N/A StopIteration N/A N/A output Finished N/A N/A HTTPException N/A err N/A N/A N/A request _started N/A N/A N/A N/A log exception N/A Error while handling asynchronous request: %s %s N/A N/A request method N/A request url N/A N/A N/A N/A request connection close False N/A N/A _cleanup request N/A N/A errored True N/A N/A request _tb N/A N/A traceback format_exc N/A err_handler N/A getattr app N/A handle_%d N/A err status None N/A err_handler N/A N/A output N/A err_handler request err N/A N/A output N/A error N/A err message N/A err status N/A err headers request request N/A N/A HTTPTransparentRedirect N/A err N/A N/A N/A request _started N/A N/A N/A N/A log exception N/A HTTPTransparentRedirect sent to already started request: %s %s N/A N/A request method N/A request url N/A N/A N/A N/A request connection close False N/A N/A _cleanup request N/A N/A errored True N/A output err N/A N/A request _tb N/A N/A traceback format_exc N/A N/A Exception N/A err N/A N/A N/A request _started N/A N/A N/A N/A log exception N/A Error while handling asynchronous request: %s %s N/A N/A request method N/A request url N/A N/A N/A N/A request connection close False N/A N/A _cleanup request N/A N/A errored True N/A N/A request _tb N/A N/A traceback format_exc N/A N/A N/A output N/A N/A app handle_500 request err N/A N/A N/A Exception N/A N/A N/A N/A log exception N/A There was a problem handling a request, and a problem running Application.handle_500 for %r. app N/A output N/A error 500 request request N/A errored N/A N/A N/A request _rule_content_type None N/A N/A request _rule_headers None N/A N/A _async_finish request output N/A N/A N/A N/A N/A isinstance output _WaitList N/A isinstance output N/A tuple list N/A all N/A N/A isinstance x Callback N/A x output N/A N/A output N/A _WaitList output N/A N/A isinstance output _Sleeper N/A N/A N/A N/A N/A N/A request connection engine defer N/A output N/A 0 _do request None N/A N/A N/A isinstance output Callback N/A N/A N/A N/A N/A request _unhandled remove output N/A N/A N/A N/A request _waiting append output N/A N/A N/A isinstance output _WaitList N/A N/A N/A output timeout N/A N/A N/A output timeout N/A N/A N/A N/A request connection engine defer N/A output timeout _wait_timeout request N/A N/A N/A N/A request _waiting append output N/A N/A N/A isinstance output _Receiver N/A N/A N/A output N/A 1 N/A N/A N/A output timeout N/A N/A N/A N/A request connection engine defer N/A output N/A 1 _receive_timeout request N/A N/A output ref ref N/A N/A weakref ref request N/A N/A N/A N/A N/A receivers setdefault N/A output N/A 0 N/A append ref N/A N/A N/A N/A request _waiting append output N/A N/A N/A N/A N/A request _writer request output Again N/A N/A input None N/A as_exception False N/A N/A N/A N/A N/A hasattr request _in_do N/A N/A N/A request _in_do False N/A