Skip to content

Commit a37eac3

Browse files
authored
Merge pull request #1187 from davep/docstring-tidy
2 parents 9fd1e76 + 8c6c68a commit a37eac3

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

src/textual/binding.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ class NoBinding(Exception):
2121
@dataclass(frozen=True)
2222
class Binding:
2323
key: str
24-
"""Key to bind. This can also be a comma-separated list of keys to map multiple keys to a single action."""
24+
"""str: Key to bind. This can also be a comma-separated list of keys to map multiple keys to a single action."""
2525
action: str
26-
"""Action to bind to."""
26+
"""str: Action to bind to."""
2727
description: str
28-
"""Description of action."""
28+
"""str: Description of action."""
2929
show: bool = True
30-
"""Show the action in Footer, or False to hide."""
30+
"""bool: Show the action in Footer, or False to hide."""
3131
key_display: str | None = None
32-
"""How the key should be shown in footer."""
32+
"""str | None: How the key should be shown in footer."""
3333
universal: bool = False
34-
"""Allow forwarding from app to focused widget."""
34+
"""bool: Allow forwarding from app to focused widget."""
3535

3636

3737
@rich.repr.auto
@@ -107,6 +107,16 @@ def bind(
107107
key_display: str | None = None,
108108
universal: bool = False,
109109
) -> None:
110+
"""Bind keys to an action.
111+
112+
Args:
113+
keys (str): The keys to bind. Can be a comma-separated list of keys.
114+
action (str): The action to bind the keys to.
115+
description (str, optional): An optional description for the binding.
116+
show (bool, optional): A flag to say if the binding should appear in the footer.
117+
key_display (str | None, optional): Optional string to display in the footer for the key.
118+
universal (bool, optional): Allow forwarding from the app to the focused widget.
119+
"""
110120
all_keys = [key.strip() for key in keys.split(",")]
111121
for key in all_keys:
112122
self.keys[key] = Binding(

src/textual/box_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def get_box_model(
3333
viewport (Size): The viewport size.
3434
width_fraction (Fraction): A fraction used for 1 `fr` unit on the width dimension.
3535
height_fraction (Fraction):A fraction used for 1 `fr` unit on the height dimension.
36-
get_auto_width (Callable): A callable which accepts container size and parent size and returns a width.
37-
get_auto_height (Callable): A callable which accepts container size and parent size and returns a height.
36+
get_content_width (Callable[[Size, Size], int]): A callable which accepts container size and parent size and returns a width.
37+
get_content_height (Callable[[Size, Size, int], int]): A callable which accepts container size and parent size and returns a height.
3838
3939
Returns:
4040
BoxModel: A tuple with the size of the content area and margin.

0 commit comments

Comments
 (0)