This commit is contained in:
2025-05-22 20:25:38 +02:00
parent 09f6750c2b
commit ce03fbf12f
529 changed files with 3353 additions and 3312 deletions

View File

@@ -1,11 +1,9 @@
import os
import re
_LEADING_SYMBOL = "#" if os.name == "nt" else "-"
# https://docs.python.org/3/library/datetime.html#technical-detail (see NOTE #9)
_DATETIME_STRIP_ZERO_PADDING_FORMATS_RE = re.compile(
f"%{_LEADING_SYMBOL}["
"%-["
"d" # day of month
"m" # month
"H" # hour (24-hour)
@@ -28,7 +26,7 @@ def clean_datetime_format_for_strptime(formats):
return [
re.sub(
_DATETIME_STRIP_ZERO_PADDING_FORMATS_RE,
lambda m: m[0].replace(_LEADING_SYMBOL, ""),
lambda m: m[0].replace("-", ""),
format,
)
for format in formats