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

Side by Side Diff: abp/filters/render_script.py

Issue 29756669: Noissue - Adapt best practices for trailing commas (python-abp) (Closed)
Patch Set: Re-run script on Python 2, added flake8-commas extension Created April 19, 2018, 2:44 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 | setup.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 Adblock Plus <https://adblockplus.org/>, 1 # This file is part of Adblock Plus <https://adblockplus.org/>,
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 27 matching lines...) Expand all
38 parser.add_argument( 38 parser.add_argument(
39 '-v', '--verbose', action='store_true', default=False, 39 '-v', '--verbose', action='store_true', default=False,
40 help='log included files and URLs') 40 help='log included files and URLs')
41 return parser.parse_args() 41 return parser.parse_args()
42 42
43 43
44 def main(): 44 def main():
45 """Entry point for the rendering script (flrender).""" 45 """Entry point for the rendering script (flrender)."""
46 sources = { 46 sources = {
47 'http': WebSource('http'), 47 'http': WebSource('http'),
48 'https': WebSource('https') 48 'https': WebSource('https'),
49 } 49 }
50 args = parse_args() 50 args = parse_args()
51 51
52 if args.verbose: 52 if args.verbose:
53 logging.basicConfig(level=logging.INFO, stream=sys.stderr, 53 logging.basicConfig(level=logging.INFO, stream=sys.stderr,
54 format='%(message)s') 54 format='%(message)s')
55 55
56 for include_path in args.include: 56 for include_path in args.include:
57 name, path = include_path.split('=', 1) 57 name, path = include_path.split('=', 1)
58 sources[name] = FSSource(path) 58 sources[name] = FSSource(path)
59 59
60 try: 60 try:
61 lines = render_filterlist(args.infile, sources, TopSource()) 61 lines = render_filterlist(args.infile, sources, TopSource())
62 with io.open(args.outfile, 'w', encoding='utf-8') as out_fp: 62 with io.open(args.outfile, 'w', encoding='utf-8') as out_fp:
63 for line in lines: 63 for line in lines:
64 out_fp.write(line.to_string() + '\n') 64 out_fp.write(line.to_string() + '\n')
65 except (MissingHeader, NotFound, IncludeError) as exc: 65 except (MissingHeader, NotFound, IncludeError) as exc:
66 sys.exit(exc) 66 sys.exit(exc)
OLDNEW
« no previous file with comments | « no previous file | setup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld