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

Side by Side Diff: sitescripts/content_blocker_lists/bin/generate_lists.py

Issue 29756646: Noissue - Adapt best practices for trailing commas (abpssembly) (Closed)
Patch Set: Re-run script on Python 2, added flake8-commas extension Created April 19, 2018, 2:41 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 | « no previous file | sitescripts/extensions/bin/createNightlies.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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # This file is part of Adblock Plus <https://adblockplus.org/>, 3 # This file is part of Adblock Plus <https://adblockplus.org/>,
4 # Copyright (C) 2006-present eyeo GmbH 4 # Copyright (C) 2006-present eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 body = response.read() 48 body = response.read()
49 version = re.search(r'^(?:[^[!])|^!\s*Version:\s*(.+)$', 49 version = re.search(r'^(?:[^[!])|^!\s*Version:\s*(.+)$',
50 body, re.MULTILINE).group(1) 50 body, re.MULTILINE).group(1)
51 return body, url, version 51 return body, url, version
52 52
53 53
54 def generate_metadata(filter_lists, expires): 54 def generate_metadata(filter_lists, expires):
55 metadata = OrderedDict(( 55 metadata = OrderedDict((
56 ('version', time.strftime('%Y%m%d%H%M', time.gmtime())), 56 ('version', time.strftime('%Y%m%d%H%M', time.gmtime())),
57 ('expires', expires), 57 ('expires', expires),
58 ('sources', []) 58 ('sources', []),
59 )) 59 ))
60 for body, url, version in filter_lists: 60 for body, url, version in filter_lists:
61 metadata['sources'].append({'url': url, 'version': version}) 61 metadata['sources'].append({'url': url, 'version': version})
62 return metadata 62 return metadata
63 63
64 64
65 def pipe_in(process, filter_lists): 65 def pipe_in(process, filter_lists):
66 try: 66 try:
67 for body, _, _ in filter_lists: 67 for body, _, _ in filter_lists:
68 print >>process.stdin, body 68 print >>process.stdin, body
(...skipping 20 matching lines...) Expand all
89 89
90 easylist = download_filter_list(config['easylist_url']) 90 easylist = download_filter_list(config['easylist_url'])
91 exceptionrules = download_filter_list(config['exceptionrules_url']) 91 exceptionrules = download_filter_list(config['exceptionrules_url'])
92 92
93 write_block_list([easylist], 93 write_block_list([easylist],
94 config['easylist_content_blocker_path'], 94 config['easylist_content_blocker_path'],
95 config['easylist_content_blocker_expires']) 95 config['easylist_content_blocker_expires'])
96 write_block_list([easylist, exceptionrules], 96 write_block_list([easylist, exceptionrules],
97 config['combined_content_blocker_path'], 97 config['combined_content_blocker_path'],
98 config['combined_content_blocker_expires']) 98 config['combined_content_blocker_expires'])
OLDNEW
« no previous file with comments | « no previous file | sitescripts/extensions/bin/createNightlies.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld