[py] Fix styling

This commit is contained in:
Nemo
2022-10-16 13:59:39 +05:30
committed by Nemo
parent 9a35436353
commit fac9620241
9 changed files with 283 additions and 249 deletions

View File

@@ -3,19 +3,19 @@ import re
import urllib.request
# https://regex101.com/r/1JCnFC/1
REGEX = r'^(\d{4})\/(\d{2})\/(\d{2})\s+:\s+(\d+\.\d+\.\d.?)$'
REGEX = r"^(\d{4})\/(\d{2})\/(\d{2})\s+:\s+(\d+\.\d+\.\d.?)$"
list = {}
for i in range(17, 27):
url = "https://www.haproxy.org/download/%s/src/CHANGELOG" % (i/10)
with urllib.request.urlopen(url) as response:
for line in response:
m = re.match(REGEX, line.decode('utf-8'))
if m:
year,month,date,version = m.groups()
abs_date = "%s-%s-%s" % (year, month, date)
list[version] = abs_date
url = "https://www.haproxy.org/download/%s/src/CHANGELOG" % (i / 10)
with urllib.request.urlopen(url) as response:
for line in response:
m = re.match(REGEX, line.decode("utf-8"))
if m:
year, month, date, version = m.groups()
abs_date = "%s-%s-%s" % (year, month, date)
list[version] = abs_date
with open('releases/haproxy.json', 'w') as f:
f.write(json.dumps(list, indent=2))
with open("releases/haproxy.json", "w") as f:
f.write(json.dumps(list, indent=2))