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/reactive.py | |
parent | 03f024c4412e3aa613bb543cf1660176320ba8f4 (diff) | |
download | ydb-06e5c21a835c0e923506c4ff27929f34e00761c2.tar.gz |
fix ya.make
Diffstat (limited to 'contrib/python/prompt-toolkit/py2/prompt_toolkit/reactive.py')
-rw-r--r-- | contrib/python/prompt-toolkit/py2/prompt_toolkit/reactive.py | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/contrib/python/prompt-toolkit/py2/prompt_toolkit/reactive.py b/contrib/python/prompt-toolkit/py2/prompt_toolkit/reactive.py deleted file mode 100644 index ec3aa06712e..00000000000 --- a/contrib/python/prompt-toolkit/py2/prompt_toolkit/reactive.py +++ /dev/null @@ -1,56 +0,0 @@ -""" -Prompt_toolkit is designed a way that the amount of changing state is reduced -to a minimum. Where possible, code is written in a pure functional way. In -general, this results in code where the flow is very easy to follow: the value -of a variable can be deducted from its first assignment. - -However, often, practicality and performance beat purity and some classes still -have a changing state. In order to not having to care too much about -transferring states between several components we use some reactive -programming. Actually some kind of data binding. - -We introduce two types: - -- Filter: for binding a boolean state. They can be chained using & and | - operators. Have a look in the ``filters`` module. Resolving the actual value - of a filter happens by calling it. - -- Integer: for binding integer values. Reactive operations (like addition and - substraction) are not suppported. Resolving the actual value happens by - casting it to int, like ``int(integer)``. This way, it is possible to use - normal integers as well for static values. -""" -from __future__ import unicode_literals -from abc import ABCMeta, abstractmethod -from six import with_metaclass - - -class Integer(with_metaclass(ABCMeta, object)): - """ - Reactive integer -- anything that can be resolved to an ``int``. - """ - @abstractmethod - def __int__(self): - return 0 - - @classmethod - def from_callable(cls, func): - """ - Create an Integer-like object that calls the given function when it is - resolved to an int. - """ - return _IntegerFromCallable(func) - - -Integer.register(int) - - -class _IntegerFromCallable(Integer): - def __init__(self, func=0): - self.func = func - - def __repr__(self): - return 'Integer.from_callable(%r)' % self.func - - def __int__(self): - return int(self.func()) |