Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: my_activity.py

Issue 1151053003: my_activity.py: Fix to work with non-ascii characters (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698