Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/tornado/__pycache__/gen.cpython-39.pyc
Ðазад
a _�hqy � @ s d Z ddlZddlZddlZddlmZ ddlZddlZddl Z ddl m Z ddlmZ ddl Z ddlZddlmZmZmZmZmZmZ ddlmZ ddlmZ dd lmZ ddlZdd lmZmZmZm Z m!Z!m"Z"m#Z#m$Z$ ej%r�ddlm&Z&m'Z'm(Z(m)Z)m*Z* e�+d�Z,ede#e e# e$ee#f ej-jf Z.G d d� de/�Z0G dd� de/�Z1G dd� de/�Z2G dd� de/�Z3G dd� de/�Z4ee5df ed�dd�Z6ed�dd�Z7ed ed d �d!d"�Z8ee9d �d#d$�Z:G d%d� de/�Z;G d&d'� d'e<�Z=dCee e. e$ee.f f d)d*d+�d,d-�Z>e>Z?dDee e. e$ee.f f d)d*d+�d.d/�Z@eed0�d1d2�ZAdEeeBejCf e.d)ed3�d4d5�ZDeBd6d7�d8d9�ZEG d:d;� d;e<�ZFe�GeeF� �ZHe�GeeF� �ZId<eI_ G d=d>� d>e<�ZJz ejKZLW n eM�y� eNed?�ZLY n0 e.ed@�dAdB�ZOe eO�ZOdS )Fa` ``tornado.gen`` implements generator-based coroutines. .. note:: The "decorator and generator" approach in this module is a precursor to native coroutines (using ``async def`` and ``await``) which were introduced in Python 3.5. Applications that do not require compatibility with older versions of Python should use native coroutines instead. Some parts of this module are still useful with native coroutines, notably `multi`, `sleep`, `WaitIterator`, and `with_timeout`. Some of these functions have counterparts in the `asyncio` module which may be used as well, although the two may not necessarily be 100% compatible. Coroutines provide an easier way to work in an asynchronous environment than chaining callbacks. Code using coroutines is technically asynchronous, but it is written as a single generator instead of a collection of separate functions. For example, here's a coroutine-based handler: .. testcode:: class GenAsyncHandler(RequestHandler): @gen.coroutine def get(self): http_client = AsyncHTTPClient() response = yield http_client.fetch("http://example.com") do_something_with_response(response) self.render("template.html") .. testoutput:: :hide: Asynchronous functions in Tornado return an ``Awaitable`` or `.Future`; yielding this object returns its result. You can also yield a list or dict of other yieldable objects, which will be started at the same time and run in parallel; a list or dict of results will be returned when they are all finished: .. testcode:: @gen.coroutine def get(self): http_client = AsyncHTTPClient() response1, response2 = yield [http_client.fetch(url1), http_client.fetch(url2)] response_dict = yield dict(response3=http_client.fetch(url3), response4=http_client.fetch(url4)) response3 = response_dict['response3'] response4 = response_dict['response4'] .. testoutput:: :hide: If ``tornado.platform.twisted`` is imported, it is also possible to yield Twisted's ``Deferred`` objects. See the `convert_yielded` function to extend this mechanism. .. versionchanged:: 3.2 Dict support added. .. versionchanged:: 4.1 Support added for yielding ``asyncio`` Futures and Twisted Deferreds via ``singledispatch``. � N)� Generator)�singledispatch)�isawaitable)�Future� is_future�chain_future�future_set_exc_info�future_add_done_callback�"future_set_result_unless_cancelled)�IOLoop)�app_log)�TimeoutError)�Union�Any�Callable�List�Type�Tuple� Awaitable�Dict)�Sequence�Deque�Optional�Set�Iterable�_Tc @ s e Zd ZdS )� KeyReuseErrorN��__name__� __module__�__qualname__� r! r! �{/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/tornado/gen.pyr j s r c @ s e Zd ZdS )�UnknownKeyErrorNr r! r! r! r"