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

Side by Side Diff: sitescripts/subscriptions/bin/updateSubscriptionDownloads.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
(...skipping 27 matching lines...) Expand all
38 38
39 def read_file(self, filename): 39 def read_file(self, filename):
40 return self._archive.read(self._prefix + filename).decode('utf-8') 40 return self._archive.read(self._prefix + filename).decode('utf-8')
41 41
42 def list_top_level_files(self): 42 def list_top_level_files(self):
43 for filename in self._archive.namelist(): 43 for filename in self._archive.namelist():
44 filename = filename[len(self._prefix):] 44 filename = filename[len(self._prefix):]
45 if '/' not in filename: 45 if '/' not in filename:
46 yield filename 46 yield filename
47 47
48
48 if __name__ == '__main__': 49 if __name__ == '__main__':
49 setupStderr() 50 setupStderr()
50 51
51 source_repos = {} 52 source_repos = {}
52 for option, value in get_config().items('subscriptionDownloads'): 53 for option, value in get_config().items('subscriptionDownloads'):
53 if option.endswith('_repository'): 54 if option.endswith('_repository'):
54 source_repos[re.sub(r'_repository$', '', option)] = MercurialSource( value) 55 source_repos[re.sub(r'_repository$', '', option)] = MercurialSource( value)
55 56
56 basedir = get_config().get('subscriptionDownloads', 'outdir') 57 basedir = get_config().get('subscriptionDownloads', 'outdir')
57 destination = os.path.join(basedir, 'data') 58 destination = os.path.join(basedir, 'data')
58 try: 59 try:
59 combine_subscriptions(source_repos, destination, tempdir=basedir) 60 combine_subscriptions(source_repos, destination, tempdir=basedir)
60 finally: 61 finally:
61 for source in source_repos.itervalues(): 62 for source in source_repos.itervalues():
62 source.close() 63 source.close()
OLDNEW
« no previous file with comments | « sitescripts/subscriptions/bin/updateStatusPage.py ('k') | sitescripts/subscriptions/combineSubscriptions.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld