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

Side by Side Diff: sitescripts/subscriptions/combineSubscriptions.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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # This file is part of the Adblock Plus web scripts, 3 # This file is part of the Adblock Plus web scripts,
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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 306
307 307
308 def usage(): 308 def usage():
309 print '''Usage: %s source_name=source_dir ... [output_dir] 309 print '''Usage: %s source_name=source_dir ... [output_dir]
310 310
311 Options: 311 Options:
312 -h --help Print this message and exit 312 -h --help Print this message and exit
313 -t seconds --timeout=seconds Timeout when fetching remote subscriptions 313 -t seconds --timeout=seconds Timeout when fetching remote subscriptions
314 ''' % os.path.basename(sys.argv[0]) 314 ''' % os.path.basename(sys.argv[0])
315 315
316
316 if __name__ == '__main__': 317 if __name__ == '__main__':
317 try: 318 try:
318 opts, args = getopt(sys.argv[1:], 'ht:', ['help', 'timeout=']) 319 opts, args = getopt(sys.argv[1:], 'ht:', ['help', 'timeout='])
319 except GetoptError as e: 320 except GetoptError as e:
320 print str(e) 321 print str(e)
321 usage() 322 usage()
322 sys.exit(2) 323 sys.exit(2)
323 324
324 target_dir = 'subscriptions' 325 target_dir = 'subscriptions'
325 sources = {} 326 sources = {}
326 for arg in args: 327 for arg in args:
327 if '=' in arg: 328 if '=' in arg:
328 source_name, source_dir = arg.split('=', 1) 329 source_name, source_dir = arg.split('=', 1)
329 sources[source_name] = FileSource(source_dir) 330 sources[source_name] = FileSource(source_dir)
330 else: 331 else:
331 target_dir = arg 332 target_dir = arg
332 if not sources: 333 if not sources:
333 sources[''] = FileSource('.') 334 sources[''] = FileSource('.')
334 335
335 timeout = 30 336 timeout = 30
336 for option, value in opts: 337 for option, value in opts:
337 if option in ('-h', '--help'): 338 if option in ('-h', '--help'):
338 usage() 339 usage()
339 sys.exit() 340 sys.exit()
340 elif option in ('-t', '--timeout'): 341 elif option in ('-t', '--timeout'):
341 timeout = int(value) 342 timeout = int(value)
342 343
343 combine_subscriptions(sources, target_dir, timeout) 344 combine_subscriptions(sources, target_dir, timeout)
OLDNEW
« no previous file with comments | « sitescripts/subscriptions/bin/updateSubscriptionDownloads.py ('k') | sitescripts/templateFilters.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld