aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/mouse_handlers.py
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:39 +0300
commite9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch)
tree64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/mouse_handlers.py
parent2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff)
downloadydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/mouse_handlers.py')
-rw-r--r--contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/mouse_handlers.py108
1 files changed, 54 insertions, 54 deletions
diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/mouse_handlers.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/mouse_handlers.py
index d1dbeca6a9..256231793a 100644
--- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/mouse_handlers.py
+++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/mouse_handlers.py
@@ -1,54 +1,54 @@
-from collections import defaultdict
-from typing import TYPE_CHECKING, Callable, DefaultDict
-
-from prompt_toolkit.mouse_events import MouseEvent
-
-if TYPE_CHECKING:
- from prompt_toolkit.key_binding.key_bindings import NotImplementedOrNone
-
-__all__ = [
- "MouseHandler",
- "MouseHandlers",
-]
-
-
-MouseHandler = Callable[[MouseEvent], "NotImplementedOrNone"]
-
-
-class MouseHandlers:
- """
- Two dimensional raster of callbacks for mouse events.
- """
-
- def __init__(self) -> None:
- def dummy_callback(mouse_event: MouseEvent) -> "NotImplementedOrNone":
- """
- :param mouse_event: `MouseEvent` instance.
- """
- return NotImplemented
-
- # NOTE: Previously, the data structure was a dictionary mapping (x,y)
- # to the handlers. This however would be more inefficient when copying
- # over the mouse handlers of the visible region in the scrollable pane.
-
- # Map y (row) to x (column) to handlers.
- self.mouse_handlers: DefaultDict[
- int, DefaultDict[int, MouseHandler]
- ] = defaultdict(lambda: defaultdict(lambda: dummy_callback))
-
- def set_mouse_handler_for_range(
- self,
- x_min: int,
- x_max: int,
- y_min: int,
- y_max: int,
- handler: Callable[[MouseEvent], "NotImplementedOrNone"],
- ) -> None:
- """
- Set mouse handler for a region.
- """
- for y in range(y_min, y_max):
- row = self.mouse_handlers[y]
-
- for x in range(x_min, x_max):
- row[x] = handler
+from collections import defaultdict
+from typing import TYPE_CHECKING, Callable, DefaultDict
+
+from prompt_toolkit.mouse_events import MouseEvent
+
+if TYPE_CHECKING:
+ from prompt_toolkit.key_binding.key_bindings import NotImplementedOrNone
+
+__all__ = [
+ "MouseHandler",
+ "MouseHandlers",
+]
+
+
+MouseHandler = Callable[[MouseEvent], "NotImplementedOrNone"]
+
+
+class MouseHandlers:
+ """
+ Two dimensional raster of callbacks for mouse events.
+ """
+
+ def __init__(self) -> None:
+ def dummy_callback(mouse_event: MouseEvent) -> "NotImplementedOrNone":
+ """
+ :param mouse_event: `MouseEvent` instance.
+ """
+ return NotImplemented
+
+ # NOTE: Previously, the data structure was a dictionary mapping (x,y)
+ # to the handlers. This however would be more inefficient when copying
+ # over the mouse handlers of the visible region in the scrollable pane.
+
+ # Map y (row) to x (column) to handlers.
+ self.mouse_handlers: DefaultDict[
+ int, DefaultDict[int, MouseHandler]
+ ] = defaultdict(lambda: defaultdict(lambda: dummy_callback))
+
+ def set_mouse_handler_for_range(
+ self,
+ x_min: int,
+ x_max: int,
+ y_min: int,
+ y_max: int,
+ handler: Callable[[MouseEvent], "NotImplementedOrNone"],
+ ) -> None:
+ """
+ Set mouse handler for a region.
+ """
+ for y in range(y_min, y_max):
+ row = self.mouse_handlers[y]
+
+ for x in range(x_min, x_max):
+ row[x] = handler