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

Side by Side Diff: sitescripts/subscriptions/bin/processTemplate.py

Issue 29569566: Noissue - Replace flake8-putty with flake8-per-file-ignores, update to flake8 3 (sitescripts) (Closed)
Patch Set: Created Oct. 8, 2017, 6:02 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
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
11 # GNU General Public License for more details. 11 # GNU General Public License for more details.
12 # 12 #
13 # You should have received a copy of the GNU General Public License 13 # You should have received a copy of the GNU General Public License
14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
15 15
16 import sys 16 import sys
17 from sitescripts.utils import get_config, get_template, setupStderr 17 from sitescripts.utils import get_config, get_template, setupStderr
18 import sitescripts.subscriptions.subscriptionParser as subscriptionParser 18 import sitescripts.subscriptions.subscriptionParser as subscriptionParser
19 19
20 20
21 def writeSubscriptions(templateName, outputFile=None): 21 def writeSubscriptions(templateName, outputFile=None):
22 subscriptions = subscriptionParser.readSubscriptions().values() 22 subscriptions = subscriptionParser.readSubscriptions().values()
23 template = get_template(get_config().get('subscriptions', templateName + 'Te mplate')) 23 template = get_template(get_config().get('subscriptions', templateName + 'Te mplate'))
24 if outputFile == None: 24 if outputFile == None:
25 outputFile = get_config().get('subscriptions', templateName + 'File') 25 outputFile = get_config().get('subscriptions', templateName + 'File')
26 template.stream({'subscriptions': subscriptions}).dump(outputFile, encoding= 'utf-8') 26 template.stream({'subscriptions': subscriptions}).dump(outputFile, encoding= 'utf-8')
27 27
28
28 if __name__ == '__main__': 29 if __name__ == '__main__':
29 setupStderr() 30 setupStderr()
30 31
31 if len(sys.argv) < 2: 32 if len(sys.argv) < 2:
32 raise Exception('A template like recommendations, subscriptionsXML or su bscriptionsXML2 needs to be specified on command line') 33 raise Exception('A template like recommendations, subscriptionsXML or su bscriptionsXML2 needs to be specified on command line')
33 34
34 templateName = sys.argv[1] 35 templateName = sys.argv[1]
35 outputFile = None 36 outputFile = None
36 if len(sys.argv) >= 3: 37 if len(sys.argv) >= 3:
37 outputFile = sys.argv[2] 38 outputFile = sys.argv[2]
38 writeSubscriptions(templateName, outputFile) 39 writeSubscriptions(templateName, outputFile)
OLDNEW
« no previous file with comments | « sitescripts/subscriptions/bin/generateReport.py ('k') | sitescripts/subscriptions/bin/updateStatusPage.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld