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

Delta Between Two Patch Sets: generate_lists.py

Issue 29328894: Issue 3168 - Add a script for generating new content blocker lists (Closed)
Left Patch Set: Close files explicitly, open files in binary mode, add whitespace Created Oct. 22, 2015, 2:42 a.m.
Right Patch Set: Use the with statement Created Oct. 22, 2015, 3:15 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # coding: utf-8 2 # coding: utf-8
3 3
4 # This file is part of Adblock Plus <https://adblockplus.org/>, 4 # This file is part of Adblock Plus <https://adblockplus.org/>,
5 # Copyright (C) 2006-2015 Eyeo GmbH 5 # Copyright (C) 2006-2015 Eyeo GmbH
6 # 6 #
7 # Adblock Plus is free software: you can redistribute it and/or modify 7 # Adblock Plus is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License version 3 as 8 # it under the terms of the GNU General Public License version 3 as
9 # published by the Free Software Foundation. 9 # published by the Free Software Foundation.
10 # 10 #
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 _update_abp2blocklist() 74 _update_abp2blocklist()
75 75
76 print "Downloading filter lists ..." 76 print "Downloading filter lists ..."
77 easylist_file, exceptionrules_file = _download_filter_lists() 77 easylist_file, exceptionrules_file = _download_filter_lists()
78 78
79 try: 79 try:
80 print "Generating %s ..." % os.path.basename(EASYLIST_CONTENT_BLOCKER_PATH) 80 print "Generating %s ..." % os.path.basename(EASYLIST_CONTENT_BLOCKER_PATH)
81 _convert_filter_list(easylist_file, EASYLIST_CONTENT_BLOCKER_PATH) 81 _convert_filter_list(easylist_file, EASYLIST_CONTENT_BLOCKER_PATH)
82 82
83 print "Generating %s ..." % os.path.basename(COMBINED_CONTENT_BLOCKER_PATH) 83 print "Generating %s ..." % os.path.basename(COMBINED_CONTENT_BLOCKER_PATH)
84 combined_file = _concatenate_files(easylist_file, exceptionrules_file) 84 with _concatenate_files(easylist_file, exceptionrules_file) as combined_file :
Sebastian Noack 2015/10/22 02:55:06 With statement?
Felix Dahlke 2015/10/22 03:16:46 Good catch, couldn't use it above (not without int
85 try:
86 _convert_filter_list(combined_file, COMBINED_CONTENT_BLOCKER_PATH) 85 _convert_filter_list(combined_file, COMBINED_CONTENT_BLOCKER_PATH)
87 finally:
88 combined_file.close()
89 finally: 86 finally:
90 easylist_file.close() 87 easylist_file.close()
91 exceptionrules_file.close() 88 exceptionrules_file.close()
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld