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

Side by Side Diff: sitescripts/stats/bin/logprocessor.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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 callback = functools.partial(parse_source, factor, lock) 577 callback = functools.partial(parse_source, factor, lock)
578 try: 578 try:
579 for log_file, ignored in pool.imap_unordered(callback, sources, chunksiz e=1): 579 for log_file, ignored in pool.imap_unordered(callback, sources, chunksiz e=1):
580 if verbose and ignored: 580 if verbose and ignored:
581 print 'Ignored files for %s' % log_file 581 print 'Ignored files for %s' % log_file
582 print '========================================================= ===' 582 print '========================================================= ==='
583 print '\n'.join(sorted(ignored)) 583 print '\n'.join(sorted(ignored))
584 finally: 584 finally:
585 pool.close() 585 pool.close()
586 586
587
587 if __name__ == '__main__': 588 if __name__ == '__main__':
588 setupStderr() 589 setupStderr()
589 590
590 parser = argparse.ArgumentParser(description='Processes log files and merges them into the stats database') 591 parser = argparse.ArgumentParser(description='Processes log files and merges them into the stats database')
591 parser.add_argument('--verbose', dest='verbose', action='store_const', const =True, default=False, help='Verbose mode, ignored requests will be listed') 592 parser.add_argument('--verbose', dest='verbose', action='store_const', const =True, default=False, help='Verbose mode, ignored requests will be listed')
592 parser.add_argument('--revert', dest='factor', action='store_const', const=- 1, default=1, help='Remove log data from the database') 593 parser.add_argument('--revert', dest='factor', action='store_const', const=- 1, default=1, help='Remove log data from the database')
593 parser.add_argument('mirror_name', nargs='?', help='Name of the mirror serve r that the file belongs to') 594 parser.add_argument('mirror_name', nargs='?', help='Name of the mirror serve r that the file belongs to')
594 parser.add_argument('server_type', nargs='?', help='Server type like downloa d, update or subscription') 595 parser.add_argument('server_type', nargs='?', help='Server type like downloa d, update or subscription')
595 parser.add_argument('log_file', nargs='?', help='Log file path, can be a loc al file path, http:// or ssh:// URL') 596 parser.add_argument('log_file', nargs='?', help='Log file path, can be a loc al file path, http:// or ssh:// URL')
596 args = parser.parse_args() 597 args = parser.parse_args()
597 598
598 if args.mirror_name and args.server_type and args.log_file: 599 if args.mirror_name and args.server_type and args.log_file:
599 sources = [(args.mirror_name, args.server_type, args.log_file)] 600 sources = [(args.mirror_name, args.server_type, args.log_file)]
600 else: 601 else:
601 sources = get_stats_files() 602 sources = get_stats_files()
602 parse_sources(sources, args.factor, args.verbose) 603 parse_sources(sources, args.factor, args.verbose)
OLDNEW
« no previous file with comments | « sitescripts/reports/bin/updateSubscriptionList.py ('k') | sitescripts/stats/bin/pagegenerator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld