Skip to content

Commit 59dc20b

Browse files
Merge pull request #413 from BoboTiG/patch-1
fix: pin a minimal dateparser version to prevent warnings
2 parents 9905b1f + 4a02bf2 commit 59dc20b

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ classifiers = [
3737
]
3838
requires-python = ">=3.10"
3939
dependencies = [
40-
"dateparser",
40+
"dateparser>=1.3.0",
4141
"lupa",
4242
"lxml",
4343
"mediawiki_langcodes",

src/wikitextprocessor/parserfns.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,9 +1108,11 @@ def month_num_days(ctx: "Wtp", t: datetime) -> int:
11081108
] = {
11091109
"Y": "%Y",
11101110
"y": "%y",
1111-
"L": lambda ctx, t: 1
1112-
if (t.year % 4 == 0 and (t.year % 100 != 0 or t.year % 400 == 0))
1113-
else 0,
1111+
"L": lambda ctx, t: (
1112+
1
1113+
if (t.year % 4 == 0 and (t.year % 100 != 0 or t.year % 400 == 0))
1114+
else 0
1115+
),
11141116
"o": "%G",
11151117
"n": lambda ctx, t: t.month,
11161118
"m": "%m",
@@ -1120,8 +1122,8 @@ def month_num_days(ctx: "Wtp", t: datetime) -> int:
11201122
"j": lambda ctx, t: t.day,
11211123
"d": "%d",
11221124
"z": lambda ctx, t: (
1123-
t - datetime(year=t.year, month=1, day=1, tzinfo=t.tzinfo)
1124-
).days,
1125+
(t - datetime(year=t.year, month=1, day=1, tzinfo=t.tzinfo)).days
1126+
),
11251127
"W": "%V",
11261128
"N": "%u",
11271129
"w": "%w",

0 commit comments

Comments
 (0)