Skip to content

Commit e676d17

Browse files
committed
docstrings
1 parent e9dac1c commit e676d17

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/textual/visual.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ def visualize(widget: Widget, obj: object, markup: bool = True) -> Visual:
6666
obj: An object.
6767
markup: Enable markup.
6868
69+
Raises:
70+
VisualError: If there is no Visual could be returned to render `obj`.
71+
6972
Returns:
7073
A Visual instance to render the object, or `None` if there is no associated visual.
7174
"""
@@ -101,7 +104,7 @@ def visualize(widget: Widget, obj: object, markup: bool = True) -> Visual:
101104

102105

103106
class Visual(ABC):
104-
"""A Textual 'visual' object.
107+
"""A Textual 'Visual' object.
105108
106109
Analogous to a Rich renderable, but with support for transparency.
107110
@@ -117,7 +120,7 @@ def render_strips(
117120
selection: Selection | None = None,
118121
selection_style: Style | None = None,
119122
) -> list[Strip]:
120-
"""Render the visual into an iterable of strips.
123+
"""Render the Visual into an iterable of strips.
121124
122125
Args:
123126
rules: A mapping of style rules, such as the Widgets `styles` object.
@@ -133,9 +136,9 @@ def render_strips(
133136

134137
@abstractmethod
135138
def get_optimal_width(self, rules: RulesMap, container_width: int) -> int:
136-
"""Get optimal width of the visual to display its content.
139+
"""Get optimal width of the Visual to display its content.
137140
138-
The exact definition of "optimal width" is dependant on the visual, but
141+
The exact definition of "optimal width" is dependant on the Visual, but
139142
will typically be wide enough to display output without cropping or wrapping,
140143
and without superfluous space.
141144
@@ -150,7 +153,7 @@ def get_optimal_width(self, rules: RulesMap, container_width: int) -> int:
150153

151154
@abstractmethod
152155
def get_height(self, rules: RulesMap, width: int) -> int:
153-
"""Get the height of the visual if rendered with the given width.
156+
"""Get the height of the Visual if rendered at the given width.
154157
155158
Args:
156159
rules: A mapping of style rules, such as the Widgets `styles` object.
@@ -317,7 +320,7 @@ def render_strips(
317320
class Padding(Visual):
318321
"""A Visual to pad another visual."""
319322

320-
def __init__(self, visual: Visual, spacing: Spacing):
323+
def __init__(self, visual: Visual, spacing: Spacing) -> None:
321324
"""
322325
323326
Args:

0 commit comments

Comments
 (0)