summaryrefslogtreecommitdiff
path: root/scripts/rankings-editions.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2023-02-07 17:30:13 +0100
committeremkael <emkael@tlen.pl>2023-02-07 17:30:13 +0100
commit13e5db0637204b9164ed5cab4cef129505548407 (patch)
tree7ff1c97ac01a256c9dc3f4bbc269e06b33096376 /scripts/rankings-editions.py
parent79d084a1222062df47528b8340a83ef679735267 (diff)
Python 2.x -> 3.x conversion
Diffstat (limited to 'scripts/rankings-editions.py')
-rw-r--r--scripts/rankings-editions.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/rankings-editions.py b/scripts/rankings-editions.py
index de1f2d6..bdbe46f 100644
--- a/scripts/rankings-editions.py
+++ b/scripts/rankings-editions.py
@@ -3,8 +3,8 @@ from collections import OrderedDict
from bs4 import BeautifulSoup as bs4
-dates_config = json.load(file('config/dates.json'))
-output_file = bs4(file(sys.argv[1]), 'lxml')
+dates_config = json.load(open('config/dates.json'))
+output_file = bs4(open(sys.argv[1]), 'lxml')
editions = OrderedDict()
for date_config in dates_config:
@@ -17,12 +17,12 @@ for date_config in dates_config:
date_config['date']
))
-template = bs4(file('templates/ranking.html'), 'lxml')
+template = bs4(open('templates/ranking.html'), 'lxml')
date_group = template.select('#editions')[0].extract()
year_group = date_group.select('div[role="group"]')[0].extract()
ranking_link = year_group.select('.btn-default')[0].extract()
-for year, dates in editions.iteritems():
+for year, dates in editions.items():
group = copy.copy(year_group)
group.select('.year')[0].string = str(year)
for date in dates[::-1]:
@@ -34,4 +34,4 @@ for year, dates in editions.iteritems():
date_group.insert(0, group)
output_file.select('#editions')[0].replace_with(date_group)
-file(sys.argv[1], 'w').write(output_file.prettify().encode('utf-8'))
+open(sys.argv[1], 'w').write(output_file.prettify())