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

Side by Side Diff: sitescripts/management/bin/generateNotifications.py

Issue 29345242: Noissue - Adapt quotes for compliance with our coding style in sitescripts (Closed)
Patch Set: Fixed raw string Created May 30, 2016, 8:47 a.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-2016 Eyeo GmbH 2 # Copyright (C) 2006-2016 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 codecs 16 import codecs
17 import json 17 import json
18 import time 18 import time
19 19
20 from sitescripts.notifications.parser import load_notifications 20 from sitescripts.notifications.parser import load_notifications
21 from sitescripts.utils import get_config, setupStderr 21 from sitescripts.utils import get_config, setupStderr
22 22
23 23
24 def generate_notifications(path): 24 def generate_notifications(path):
25 notifications = load_notifications() 25 notifications = load_notifications()
26 # Ignoring notifications with variants here - we can only process those in a 26 # Ignoring notifications with variants here - we can only process those in a
27 # URL handler. 27 # URL handler.
28 notifications = [x for x in notifications if "variants" in x] 28 notifications = [x for x in notifications if 'variants' in x]
29 output = { 29 output = {
30 "notifications": notifications, 30 'notifications': notifications,
31 "version": time.strftime("%Y%m%d%H%M", time.gmtime()) 31 'version': time.strftime('%Y%m%d%H%M', time.gmtime())
32 } 32 }
33 with codecs.open(path, "wb", encoding="utf-8") as file: 33 with codecs.open(path, 'wb', encoding='utf-8') as file:
34 json.dump(output, file, ensure_ascii=False, indent=2, 34 json.dump(output, file, ensure_ascii=False, indent=2,
35 separators=(',', ': '), sort_keys=True) 35 separators=(',', ': '), sort_keys=True)
36 36
37 if __name__ == "__main__": 37 if __name__ == '__main__':
38 setupStderr() 38 setupStderr()
39 output = get_config().get("notifications", "output") 39 output = get_config().get('notifications', 'output')
40 generate_notifications(output) 40 generate_notifications(output)
OLDNEW

Powered by Google App Engine
This is Rietveld