Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a mention to the docs that format_skeleton(..., fuzzy=True) may raise #1106

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion babel/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,10 @@ def format_skeleton(
Traceback (most recent call last):
...
KeyError: yMMd
>>> format_skeleton('GH', t, fuzzy=True, locale='fi_FI') # GH is not in the Finnish locale and there is no close match, an error is thrown
Traceback (most recent call last):
...
KeyError: None

After the skeleton is resolved to a pattern `format_datetime` is called so
all timezone processing etc is the same as for that.
Expand All @@ -835,7 +839,8 @@ def format_skeleton(
time in UTC is used
:param tzinfo: the time-zone to apply to the time for display
:param fuzzy: If the skeleton is not found, allow choosing a skeleton that's
close enough to it.
close enough to it. If there is no close match, a `KeyError`
is thrown.
:param locale: a `Locale` object or a locale identifier
"""
locale = Locale.parse(locale)
Expand Down