Skip to content

Commit 33dec03

Browse files
author
MarcoGorelli
committed
use fantastic f-strings
1 parent 96eed8a commit 33dec03

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
@@ -59,16 +59,13 @@ cdef bint format_is_iso(f: str):
5959
Generally of form YYYY-MM-DDTHH:MM:SS - date separator can be different
6060
but must be consistent. Leading 0s in dates and times are optional.
6161
"""
62-
iso_template = "%Y{date_sep}%m{date_sep}%d{time_sep}%H:%M:%S{micro_or_tz}".format
6362
excluded_formats = ["%Y%m"]
6463

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

0 commit comments

Comments
 (0)