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

Side by Side Diff: my_activity.py

Issue 204013009: my_activity.py: Parse rietveld dates without milliseconds. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years, 9 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
« 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 return True 184 return True
185 elif not response or response == 'n' or response == 'no': 185 elif not response or response == 'n' or response == 'no':
186 return False 186 return False
187 187
188 188
189 def datetime_from_gerrit(date_string): 189 def datetime_from_gerrit(date_string):
190 return datetime.strptime(date_string, '%Y-%m-%d %H:%M:%S.%f000') 190 return datetime.strptime(date_string, '%Y-%m-%d %H:%M:%S.%f000')
191 191
192 192
193 def datetime_from_rietveld(date_string): 193 def datetime_from_rietveld(date_string):
194 return datetime.strptime(date_string, '%Y-%m-%d %H:%M:%S.%f') 194 try:
195 return datetime.strptime(date_string, '%Y-%m-%d %H:%M:%S.%f')
196 except ValueError:
197 # Sometimes rietveld returns a value without the milliseconds part, so we
198 # attempt to parse those cases as well.
199 return datetime.strptime(date_string, '%Y-%m-%d %H:%M:%S')
195 200
196 201
197 def datetime_from_google_code(date_string): 202 def datetime_from_google_code(date_string):
198 return datetime.strptime(date_string, '%Y-%m-%dT%H:%M:%S.%fZ') 203 return datetime.strptime(date_string, '%Y-%m-%dT%H:%M:%S.%fZ')
199 204
200 205
201 class MyActivity(object): 206 class MyActivity(object):
202 def __init__(self, options): 207 def __init__(self, options):
203 self.options = options 208 self.options = options
204 self.modified_after = options.begin 209 self.modified_after = options.begin
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 print '\n\n\n' 836 print '\n\n\n'
832 837
833 my_activity.print_changes() 838 my_activity.print_changes()
834 my_activity.print_reviews() 839 my_activity.print_reviews()
835 my_activity.print_issues() 840 my_activity.print_issues()
836 return 0 841 return 0
837 842
838 843
839 if __name__ == '__main__': 844 if __name__ == '__main__':
840 sys.exit(main()) 845 sys.exit(main())
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