Skip to content

Commit 1ca8292

Browse files
committed
Changed to dateutil to support Python 3.10, where datetime.fromisoformat does not support timestamps produced by the GitHub API
1 parent 153377e commit 1ca8292

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

enrich_code_scanning_alerts.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from mistletoe import markdown
2121
import humanize
2222
from defusedcsv import csv
23+
from dateutil.parser import isoparse
2324

2425

2526
LOG = logging.getLogger(__name__)
@@ -295,7 +296,7 @@ def format_value(
295296
escape(str(value), quote=True)
296297
)
297298
elif key == "created_at":
298-
natural_date = humanize.naturaltime(datetime.fromisoformat(str(value)))
299+
natural_date = humanize.naturaltime(isoparse(str(value)))
299300
return '<span style="display:none">{}</span><span title="{}">{}</span>'.format(
300301
escape(str(value)), escape(str(value)), escape(natural_date)
301302
)

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
tqdm==4.66.5
22
defusedcsv==2.0.0
33
mistletoe==1.4.0
4-
humanize==4.11.0
4+
humanize==4.11.0
5+
python-dateutil==2.9.0

0 commit comments

Comments
 (0)