Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/stats/bin/pagegenerator.py

Issue 29756624: Noissue - Adapt best practices for trailing commas (sitescripts) (Closed)
Patch Set: Re-run script on Python 2, added flake8-commas extension Created April 19, 2018, 2:35 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sitescripts/stats/bin/logprocessor.py ('k') | sitescripts/stats/test/common.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 def generate_file_stats(outputfile, month, url, overview_url, data, filter=None, filtered_urls={}): 82 def generate_file_stats(outputfile, month, url, overview_url, data, filter=None, filtered_urls={}):
83 ensure_dir(outputfile) 83 ensure_dir(outputfile)
84 get_file_stats_template().stream({ 84 get_file_stats_template().stream({
85 'now': time.time(), 85 'now': time.time(),
86 'month': month, 86 'month': month,
87 'url': url, 87 'url': url,
88 'overview_url': overview_url, 88 'overview_url': overview_url,
89 'data': data, 89 'data': data,
90 'fields': common.fields, 90 'fields': common.fields,
91 'filter': filter, 91 'filter': filter,
92 'filtered_urls': filtered_urls 92 'filtered_urls': filtered_urls,
93 }).dump(outputfile, encoding='utf-8') 93 }).dump(outputfile, encoding='utf-8')
94 94
95 95
96 def generate_file_overview(outputfile, url, data): 96 def generate_file_overview(outputfile, url, data):
97 ensure_dir(outputfile) 97 ensure_dir(outputfile)
98 get_file_overview_template().stream({ 98 get_file_overview_template().stream({
99 'now': time.time(), 99 'now': time.time(),
100 'url': url, 100 'url': url,
101 'data': data 101 'data': data,
102 }).dump(outputfile, encoding='utf-8') 102 }).dump(outputfile, encoding='utf-8')
103 103
104 104
105 def get_names(dir, needdirectories): 105 def get_names(dir, needdirectories):
106 for file in os.listdir(dir): 106 for file in os.listdir(dir):
107 path = os.path.join(dir, file) 107 path = os.path.join(dir, file)
108 if (needdirectories and os.path.isdir(path)) or (not needdirectories and os.path.isfile(path)): 108 if (needdirectories and os.path.isdir(path)) or (not needdirectories and os.path.isfile(path)):
109 yield common.filename_decode(file), path 109 yield common.filename_decode(file), path
110 110
111 111
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 outputfile = os.path.join(outputdir, common.filename_encode(server_type) , 'index.html') 180 outputfile = os.path.join(outputdir, common.filename_encode(server_type) , 'index.html')
181 generate_main_page(outputfile, current_month, baseURL, monthdata) 181 generate_main_page(outputfile, current_month, baseURL, monthdata)
182 182
183 183
184 if __name__ == '__main__': 184 if __name__ == '__main__':
185 setupStderr() 185 setupStderr()
186 186
187 datadir = get_config().get('stats', 'dataDirectory') 187 datadir = get_config().get('stats', 'dataDirectory')
188 outputdir = get_config().get('stats', 'outputDirectory') 188 outputdir = get_config().get('stats', 'outputDirectory')
189 generate_pages(datadir, outputdir) 189 generate_pages(datadir, outputdir)
OLDNEW
« no previous file with comments | « sitescripts/stats/bin/logprocessor.py ('k') | sitescripts/stats/test/common.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld