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

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, 6 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 19 matching lines...) Expand all
30 from functools import partial 30 from functools import partial
31 import json 31 import json
32 import optparse 32 import optparse
33 import os 33 import os
34 import subprocess 34 import subprocess
35 import sys 35 import sys
36 import urllib 36 import urllib
37 import urllib2 37 import urllib2
38 38
39 import auth 39 import auth
40 import fix_encoding
40 import gerrit_util 41 import gerrit_util
41 import rietveld 42 import rietveld
42 from third_party import upload 43 from third_party import upload
43 44
44 try: 45 try:
45 from dateutil.relativedelta import relativedelta # pylint: disable=F0401 46 from dateutil.relativedelta import relativedelta # pylint: disable=F0401
46 except ImportError: 47 except ImportError:
47 print 'python-dateutil package required' 48 print 'python-dateutil package required'
48 exit(1) 49 exit(1)
49 50
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 required_values = { 605 required_values = {
605 'title': title, 606 'title': title,
606 'url': url, 607 'url': url,
607 'author': author, 608 'author': author,
608 } 609 }
609 # Merge required and optional values. 610 # Merge required and optional values.
610 if optional_values is not None: 611 if optional_values is not None:
611 values = dict(required_values.items() + optional_values.items()) 612 values = dict(required_values.items() + optional_values.items())
612 else: 613 else:
613 values = required_values 614 values = required_values
614 print output_format.format(**values) 615 print output_format.format(**values).encode(sys.getdefaultencoding())
615 616
616 617
617 def filter_issue(self, issue, should_filter_by_user=True): 618 def filter_issue(self, issue, should_filter_by_user=True):
618 def maybe_filter_username(email): 619 def maybe_filter_username(email):
619 return not should_filter_by_user or username(email) == self.user 620 return not should_filter_by_user or username(email) == self.user
620 if (maybe_filter_username(issue['author']) and 621 if (maybe_filter_username(issue['author']) and
621 self.filter_modified(issue['created'])): 622 self.filter_modified(issue['created'])):
622 return True 623 return True
623 if (maybe_filter_username(issue['owner']) and 624 if (maybe_filter_username(issue['owner']) and
624 (self.filter_modified(issue['created']) or 625 (self.filter_modified(issue['created']) or
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 855
855 print '\n\n\n' 856 print '\n\n\n'
856 857
857 my_activity.print_changes() 858 my_activity.print_changes()
858 my_activity.print_reviews() 859 my_activity.print_reviews()
859 my_activity.print_issues() 860 my_activity.print_issues()
860 return 0 861 return 0
861 862
862 863
863 if __name__ == '__main__': 864 if __name__ == '__main__':
865 # Fix encoding to support non-ascii issue titles.
866 fix_encoding.fix_encoding()
867
864 try: 868 try:
865 sys.exit(main()) 869 sys.exit(main())
866 except KeyboardInterrupt: 870 except KeyboardInterrupt:
867 sys.stderr.write('interrupted\n') 871 sys.stderr.write('interrupted\n')
868 sys.exit(1) 872 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