OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 stats about your activity. | 6 """Get stats about your activity. |
7 | 7 |
8 Example: | 8 Example: |
9 - my_activity.py for stats for the current week (last week on mondays). | 9 - my_activity.py for stats for the current week (last week on mondays). |
10 - my_activity.py -Q for stats for last quarter. | 10 - my_activity.py -Q for stats for last quarter. |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
595 review['review_url'], | 595 review['review_url'], |
596 review['author']) | 596 review['author']) |
597 | 597 |
598 @staticmethod | 598 @staticmethod |
599 def print_generic(default_fmt, specific_fmt, | 599 def print_generic(default_fmt, specific_fmt, |
600 title, url, author, | 600 title, url, author, |
601 optional_values=None): | 601 optional_values=None): |
602 output_format = specific_fmt if specific_fmt is not None else default_fmt | 602 output_format = specific_fmt if specific_fmt is not None else default_fmt |
603 output_format = unicode(output_format) | 603 output_format = unicode(output_format) |
604 required_values = { | 604 required_values = { |
605 'title': title, | 605 'title': title.encode('ascii', 'replace'), |
606 'url': url, | 606 'url': url, |
607 'author': author, | 607 'author': author, |
608 } | 608 } |
609 # Merge required and optional values. | 609 # Merge required and optional values. |
610 if optional_values is not None: | 610 if optional_values is not None: |
611 values = dict(required_values.items() + optional_values.items()) | 611 values = dict(required_values.items() + optional_values.items()) |
612 else: | 612 else: |
613 values = required_values | 613 values = required_values |
614 print output_format.format(**values) | 614 print output_format.format(**values) |
615 | 615 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
853 my_activity.get_issues() | 853 my_activity.get_issues() |
854 | 854 |
855 print '\n\n\n' | 855 print '\n\n\n' |
856 | 856 |
857 my_activity.print_changes() | 857 my_activity.print_changes() |
858 my_activity.print_reviews() | 858 my_activity.print_reviews() |
859 my_activity.print_issues() | 859 my_activity.print_issues() |
860 return 0 | 860 return 0 |
861 | 861 |
862 | 862 |
863 if __name__ == '__main__': | 863 if __name__ == '__main__': |
M-A Ruel
2015/05/26 14:02:45
Please have it use fix_encoding instead, it does m
| |
864 try: | 864 try: |
865 sys.exit(main()) | 865 sys.exit(main()) |
866 except KeyboardInterrupt: | 866 except KeyboardInterrupt: |
867 sys.stderr.write('interrupted\n') | 867 sys.stderr.write('interrupted\n') |
868 sys.exit(1) | 868 sys.exit(1) |
OLD | NEW |