From 6dc655898df34ad424dfc467a8b276fdf31bd791 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 5 Jun 2024 06:45:15 +0200 Subject: Merging upstream version 3.0.46. Signed-off-by: Daniel Baumann --- src/prompt_toolkit/layout/containers.py | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'src/prompt_toolkit/layout/containers.py') diff --git a/src/prompt_toolkit/layout/containers.py b/src/prompt_toolkit/layout/containers.py index 100d4aa..99b4534 100644 --- a/src/prompt_toolkit/layout/containers.py +++ b/src/prompt_toolkit/layout/containers.py @@ -2,6 +2,7 @@ Container for the layout. (Containers can contain other containers or user interface controls.) """ + from __future__ import annotations from abc import ABCMeta, abstractmethod @@ -156,8 +157,7 @@ if TYPE_CHECKING: Any object that implements ``__pt_container__`` represents a container. """ - def __pt_container__(self) -> AnyContainer: - ... + def __pt_container__(self) -> AnyContainer: ... AnyContainer = Union[Container, "MagicContainer"] @@ -296,9 +296,9 @@ class HSplit(_Split): self.align = align - self._children_cache: SimpleCache[ - tuple[Container, ...], list[Container] - ] = SimpleCache(maxsize=1) + self._children_cache: SimpleCache[tuple[Container, ...], list[Container]] = ( + SimpleCache(maxsize=1) + ) self._remaining_space_window = Window() # Dummy window. def preferred_width(self, max_available_width: int) -> Dimension: @@ -533,9 +533,9 @@ class VSplit(_Split): self.align = align - self._children_cache: SimpleCache[ - tuple[Container, ...], list[Container] - ] = SimpleCache(maxsize=1) + self._children_cache: SimpleCache[tuple[Container, ...], list[Container]] = ( + SimpleCache(maxsize=1) + ) self._remaining_space_window = Window() # Dummy window. def preferred_width(self, max_available_width: int) -> Dimension: @@ -1093,7 +1093,7 @@ class Float: return self.height def __repr__(self) -> str: - return "Float(content=%r)" % self.content + return f"Float(content={self.content!r})" class WindowRenderInfo: @@ -1352,12 +1352,7 @@ class ScrollOffsets: return to_int(self._right) def __repr__(self) -> str: - return "ScrollOffsets(top={!r}, bottom={!r}, left={!r}, right={!r})".format( - self._top, - self._bottom, - self._left, - self._right, - ) + return f"ScrollOffsets(top={self._top!r}, bottom={self._bottom!r}, left={self._left!r}, right={self._right!r})" class ColorColumn: @@ -1504,9 +1499,9 @@ class Window(Container): self.z_index = z_index # Cache for the screens generated by the margin. - self._ui_content_cache: SimpleCache[ - tuple[int, int, int], UIContent - ] = SimpleCache(maxsize=8) + self._ui_content_cache: SimpleCache[tuple[int, int, int], UIContent] = ( + SimpleCache(maxsize=8) + ) self._margin_width_cache: SimpleCache[tuple[Margin, int], int] = SimpleCache( maxsize=1 ) @@ -1514,7 +1509,7 @@ class Window(Container): self.reset() def __repr__(self) -> str: - return "Window(content=%r)" % self.content + return f"Window(content={self.content!r})" def reset(self) -> None: self.content.reset() -- cgit v1.2.3