Skip to content

Commit

Permalink
docs: add method documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Oct 26, 2024
1 parent 5690f7b commit 3a1dda7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/click/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@ def convert(
self.fail(self.get_invalid_choice_message(value), param, ctx)

def get_invalid_choice_message(self, value: t.Any) -> str:
"""Get the error message when the given choice is invalid.
:param value: The invalid value.
:return: Error message for the invalid choice.
"""
choices_str = ", ".join(map(repr, self.choices))
return ngettext(
"{value!r} is not {choice}.",
Expand Down

0 comments on commit 3a1dda7

Please sign in to comment.