Skip to content

Commit 68bb4fe

Browse files
committed
docstring fixes
1 parent 8fca87e commit 68bb4fe

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/textual/validation.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,13 @@ def __init__(self, failure_description: str | None = None) -> None:
147147
def validate(self, value: str) -> ValidationResult:
148148
"""Validate the value and return a ValidationResult describing the outcome of the validation.
149149
150+
Implement this method when defining custom validators.
151+
150152
Args:
151153
value: The value to validate.
152154
153155
Returns:
154-
The result of the validation.
156+
The result of the validation ([`self.success()`][textual.validation.Validator.success) or [`self.failure(...)`][textual.validation.Validator.failure]).
155157
"""
156158

157159
def describe_failure(self, failure: Failure) -> str | None:
@@ -177,8 +179,7 @@ def describe_failure(self, failure: Failure) -> str | None:
177179
def success(self) -> ValidationResult:
178180
"""Shorthand for `ValidationResult(True)`.
179181
180-
You can return success() from a `Validator.validate` method implementation to signal
181-
that validation has succeeded.
182+
Return `self.success()` from [`validate()`][textual.validation.Validator.validate] to indicated that validation *succeeded*.
182183
183184
Returns:
184185
A ValidationResult indicating validation succeeded.
@@ -193,7 +194,7 @@ def failure(
193194
) -> ValidationResult:
194195
"""Shorthand for signaling validation failure.
195196
196-
You can return failure(...) from a `Validator.validate` implementation to signal validation succeeded.
197+
Return `self.failure(...)` from [`validate()`][textual.validation.Validator.validate]` to indicated that validation *failed*.
197198
198199
Args:
199200
description: The failure description that will be used. When used in conjunction with the Input widget,

0 commit comments

Comments
 (0)