OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Get rietveld stats about the review you done, or forgot to do. | 6 """Get rietveld stats about the review you done, or forgot to do. |
7 | 7 |
8 Example: | 8 Example: |
9 - my_reviews.py -r me@chromium.org -Q for stats for last quarter. | 9 - my_reviews.py -r me@chromium.org -Q for stats for last quarter. |
10 """ | 10 """ |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 help='Filter issues created before the date') | 295 help='Filter issues created before the date') |
296 parser.add_option( | 296 parser.add_option( |
297 '-Q', '--last_quarter', action='store_true', | 297 '-Q', '--last_quarter', action='store_true', |
298 help='Use last quarter\'s dates, e.g. %s to %s' % ( | 298 help='Use last quarter\'s dates, e.g. %s to %s' % ( |
299 begin, end)) | 299 begin, end)) |
300 parser.add_option( | 300 parser.add_option( |
301 '-i', '--instance_url', metavar='<host>', | 301 '-i', '--instance_url', metavar='<host>', |
302 default='http://codereview.chromium.org', | 302 default='http://codereview.chromium.org', |
303 help='Host to use, default is %default') | 303 help='Host to use, default is %default') |
304 # Remove description formatting | 304 # Remove description formatting |
305 parser.format_description = lambda x: parser.description | 305 parser.format_description = ( |
| 306 lambda _: parser.description) # pylint: disable=E1101 |
306 options, args = parser.parse_args() | 307 options, args = parser.parse_args() |
307 if args: | 308 if args: |
308 parser.error('Args unsupported') | 309 parser.error('Args unsupported') |
309 if not options.reviewer: | 310 if not options.reviewer: |
310 parser.error('$EMAIL_ADDRESS is not set, please use -r') | 311 parser.error('$EMAIL_ADDRESS is not set, please use -r') |
311 print >> sys.stderr, 'Searching for reviews by %s' % options.reviewer | 312 print >> sys.stderr, 'Searching for reviews by %s' % options.reviewer |
312 if options.last_quarter: | 313 if options.last_quarter: |
313 options.begin = begin | 314 options.begin = begin |
314 options.end = end | 315 options.end = end |
315 print >> sys.stderr, 'Using range %s to %s' % ( | 316 print >> sys.stderr, 'Using range %s to %s' % ( |
316 options.begin, options.end) | 317 options.begin, options.end) |
317 if options.count: | 318 if options.count: |
318 print_count( | 319 print_count( |
319 options.reviewer, | 320 options.reviewer, |
320 options.begin, | 321 options.begin, |
321 options.end, | 322 options.end, |
322 options.instance_url) | 323 options.instance_url) |
323 else: | 324 else: |
324 print_reviews( | 325 print_reviews( |
325 options.reviewer, | 326 options.reviewer, |
326 options.begin, | 327 options.begin, |
327 options.end, | 328 options.end, |
328 options.instance_url) | 329 options.instance_url) |
329 return 0 | 330 return 0 |
330 | 331 |
331 | 332 |
332 if __name__ == '__main__': | 333 if __name__ == '__main__': |
333 sys.exit(main()) | 334 sys.exit(main()) |
OLD | NEW |