[artifactory] Refactor script (#214)

Make the script more readable, mostly by:

- using the endoflife.Product class,
- removing the unnecessary use of functions,
- a little bit of renaming.
This commit is contained in:
Marc Wrobel
2023-12-10 14:14:03 +01:00
committed by GitHub
parent b122ed40fe
commit 758b204ada
4 changed files with 22 additions and 35 deletions

View File

@@ -1,5 +1,5 @@
from datetime import datetime, timezone
import calendar
from datetime import datetime, timezone
def parse_date(text, formats=frozenset([
@@ -42,7 +42,6 @@ def parse_datetime(text, formats=frozenset([
"""
# so that we don't have to deal with some special characters in formats
text = text.strip().replace(", ", " ").replace(". ", " ").replace("(", "").replace(")", "")
text = text.replace("Sept ", "Sep ") # common typo, for ex. on Apple and Artifactory products
for fmt in formats:
try:
date = datetime.strptime(text, fmt)