Skip to content

Commit 72e00df

Browse files
authored
Do not use utc_now on module level
Looks like that this value is never used anywhere, and it should not be, because it is created once on a module import time. I found this while working on python/typeshed#13514
1 parent 82cd15f commit 72e00df

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

jose/jwt.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
import json
22
from calendar import timegm
3+
from datetime import datetime, timedelta
34

45
try:
56
from collections.abc import Mapping
67
except ImportError:
78
from collections import Mapping
89

910
try:
10-
from datetime import UTC, datetime, timedelta
11-
12-
utc_now = datetime.now(UTC) # Preferred in Python 3.13+
11+
from datetime import UTC # Preferred in Python 3.13+
1312
except ImportError:
1413
from datetime import datetime, timedelta, timezone
15-
16-
utc_now = datetime.now(timezone.utc) # Preferred in Python 3.12 and below
17-
UTC = timezone.utc
14+
UTC = timezone.utc # Preferred in Python 3.12 and below
1815

1916
from jose import jws
2017

0 commit comments

Comments
 (0)