We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fe8a756 commit 2529cffCopy full SHA for 2529cff
babel/messages/catalog.py
@@ -78,9 +78,15 @@ def _has_python_brace_format(string: str) -> bool:
78
# `fmt.parse` returns 3-or-4-tuples of the form
79
# `(literal_text, field_name, format_spec, conversion)`;
80
# if `field_name` is set, this smells like brace format
81
- return any(t[1] is not None for t in fmt.parse(string))
+ field_name_seen = False
82
+ for t in fmt.parse(string):
83
+ if t[1] is not None:
84
+ field_name_seen = True
85
+ # We cannot break here, as we need to consume the whole string
86
+ # to ensure that it is a valid format string.
87
except ValueError:
88
return False
89
+ return field_name_seen
90
91
92
def _parse_datetime_header(value: str) -> datetime.datetime:
0 commit comments