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 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 return 0 | 79 return 0 |
80 return sum(self.latencies) / float(len(self.latencies)) | 80 return sum(self.latencies) / float(len(self.latencies)) |
81 | 81 |
82 @property | 82 @property |
83 def median_latency(self): | 83 def median_latency(self): |
84 if not self.latencies: | 84 if not self.latencies: |
85 return 0 | 85 return 0 |
86 length = len(self.latencies) | 86 length = len(self.latencies) |
87 latencies = sorted(self.latencies) | 87 latencies = sorted(self.latencies) |
88 if (length & 1) == 0: | 88 if (length & 1) == 0: |
89 return (latencies[length/2] + latencies[length/2+1]) / 2. | 89 return (latencies[length/2] + latencies[length/2-1]) / 2. |
90 else: | 90 else: |
91 return latencies[length/2] | 91 return latencies[length/2] |
92 | 92 |
93 @property | 93 @property |
94 def percent_done(self): | 94 def percent_done(self): |
95 if not self.total: | 95 if not self.total: |
96 return 0 | 96 return 0 |
97 return self.actually_reviewed * 100. / self.total | 97 return self.actually_reviewed * 100. / self.total |
98 | 98 |
99 @property | 99 @property |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 print_reviews( | 352 print_reviews( |
353 options.reviewer, | 353 options.reviewer, |
354 options.begin, | 354 options.begin, |
355 options.end, | 355 options.end, |
356 options.instance_url) | 356 options.instance_url) |
357 return 0 | 357 return 0 |
358 | 358 |
359 | 359 |
360 if __name__ == '__main__': | 360 if __name__ == '__main__': |
361 sys.exit(main()) | 361 sys.exit(main()) |
OLD | NEW |