diff options
author | monster <monster@ydb.tech> | 2022-07-07 14:41:37 +0300 |
---|---|---|
committer | monster <monster@ydb.tech> | 2022-07-07 14:41:37 +0300 |
commit | 06e5c21a835c0e923506c4ff27929f34e00761c2 (patch) | |
tree | 75efcbc6854ef9bd476eb8bf00cc5c900da436a2 /contrib/python/prompt-toolkit/py2/prompt_toolkit/eventloop/asyncio_base.py | |
parent | 03f024c4412e3aa613bb543cf1660176320ba8f4 (diff) | |
download | ydb-06e5c21a835c0e923506c4ff27929f34e00761c2.tar.gz |
fix ya.make
Diffstat (limited to 'contrib/python/prompt-toolkit/py2/prompt_toolkit/eventloop/asyncio_base.py')
-rw-r--r-- | contrib/python/prompt-toolkit/py2/prompt_toolkit/eventloop/asyncio_base.py | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/contrib/python/prompt-toolkit/py2/prompt_toolkit/eventloop/asyncio_base.py b/contrib/python/prompt-toolkit/py2/prompt_toolkit/eventloop/asyncio_base.py deleted file mode 100644 index ace2b8db49..0000000000 --- a/contrib/python/prompt-toolkit/py2/prompt_toolkit/eventloop/asyncio_base.py +++ /dev/null @@ -1,46 +0,0 @@ -""" -Eventloop for integration with Python3 asyncio. - -Note that we can't use "yield from", because the package should be installable -under Python 2.6 as well, and it should contain syntactically valid Python 2.6 -code. -""" -from __future__ import unicode_literals - -__all__ = ( - 'AsyncioTimeout', -) - - -class AsyncioTimeout(object): - """ - Call the `timeout` function when the timeout expires. - Every call of the `reset` method, resets the timeout and starts a new - timer. - """ - def __init__(self, timeout, callback, loop): - self.timeout = timeout - self.callback = callback - self.loop = loop - - self.counter = 0 - self.running = True - - def reset(self): - """ - Reset the timeout. Starts a new timer. - """ - self.counter += 1 - local_counter = self.counter - - def timer_timeout(): - if self.counter == local_counter and self.running: - self.callback() - - self.loop.call_later(self.timeout, timer_timeout) - - def stop(self): - """ - Ignore timeout. Don't call the callback anymore. - """ - self.running = False |