Skip to content

Commit 762dea8

Browse files
author
MarcoGorelli
committed
use fantastic f-strings
1 parent 38871c7 commit 762dea8

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

pandas/_libs/tslibs/strptime.pyx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,13 @@ cdef bint format_is_iso(f: str):
6060
Generally of form YYYY-MM-DDTHH:MM:SS - date separator can be different
6161
but must be consistent. Leading 0s in dates and times are optional.
6262
"""
63-
iso_template = "%Y{date_sep}%m{date_sep}%d{time_sep}%H:%M:%S{micro_or_tz}".format
6463
excluded_formats = ["%Y%m"]
6564

6665
for date_sep in [" ", "/", "\\", "-", ".", ""]:
6766
for time_sep in [" ", "T"]:
6867
for micro_or_tz in ["", "%z", ".%f", ".%f%z"]:
69-
if (iso_template(date_sep=date_sep,
70-
time_sep=time_sep,
71-
micro_or_tz=micro_or_tz,
72-
).startswith(f) and f not in excluded_formats):
68+
iso_fmt = f"%Y{date_sep}%m{date_sep}%d{time_sep}%H:%M:%S{micro_or_tz}"
69+
if iso_fmt.startswith(f) and f not in excluded_formats:
7370
return True
7471
return False
7572

0 commit comments

Comments
 (0)