aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/prompt-toolkit/py2/prompt_toolkit/reactive.py
diff options
context:
space:
mode:
authorIvan Blinkov <ivan@blinkov.ru>2022-02-10 16:47:10 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:10 +0300
commit1aeb9a455974457866f78722ad98114bafc84e8a (patch)
treee4340eaf1668684d83a0a58c36947c5def5350ad /contrib/python/prompt-toolkit/py2/prompt_toolkit/reactive.py
parentbd5ef432f5cfb1e18851381329d94665a4c22470 (diff)
downloadydb-1aeb9a455974457866f78722ad98114bafc84e8a.tar.gz
Restoring authorship annotation for Ivan Blinkov <ivan@blinkov.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/prompt-toolkit/py2/prompt_toolkit/reactive.py')
-rw-r--r--contrib/python/prompt-toolkit/py2/prompt_toolkit/reactive.py112
1 files changed, 56 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
index ec3aa06712..142b3e0b14 100644
--- a/contrib/python/prompt-toolkit/py2/prompt_toolkit/reactive.py
+++ b/contrib/python/prompt-toolkit/py2/prompt_toolkit/reactive.py
@@ -1,56 +1,56 @@
-"""
-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())
+"""
+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())