[apple] Refactor script (#213)

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 13:44:59 +01:00
committed by GitHub
parent 54191857d9
commit b122ed40fe
3 changed files with 57 additions and 51 deletions

View File

@@ -42,6 +42,7 @@ 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)