File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -78,10 +78,15 @@ def _has_python_brace_format(string: str) -> bool:
7878 # `fmt.parse` returns 3-or-4-tuples of the form
7979 # `(literal_text, field_name, format_spec, conversion)`;
8080 # if `field_name` is set, this smells like brace format
81- return any (t [1 ] is not None for t in fmt .parse (string ))
81+ 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.
8287 except ValueError :
8388 return False
84-
89+ return field_name_seen
8590
8691def _parse_datetime_header (value : str ) -> datetime .datetime :
8792 match = re .match (r'^(?P<datetime>.*?)(?P<tzoffset>[+-]\d{4})?$' , value )
You can’t perform that action at this time.
0 commit comments