Recent Posts
Java | 4 sec ago
None | 24 sec ago
None | 1 min ago
PHP | 2 min ago
None | 2 min ago
PHP | 2 min ago
None | 3 min ago
None | 3 min ago
None | 3 min ago
None | 3 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By joel on the 20th of Feb 2008 12:29:17 PM Download | Raw | Embed | Report
  1. #!/usr/bin/env python
  2. import cPickle
  3. import sys
  4. def print_questions(qlist):
  5.     for q,stats in qlist:
  6.         times=len(stats[0])
  7.         print "%s\t:%d/%d errors, avg time %.2f" % (q[0],(times-sum(stats[0])),times,sum(stats[1])/times)
  8. if len(sys.argv) < 2 : raise "Usage: show_stats.py login"
  9. a=cPickle.load(open('compute_stats_%s.pck'%sys.argv[1]))
  10. b=a.items()
  11. print "showing by score"
  12. b.sort(key=lambda i:sum(i[1][0])/len(i[1][0]),reverse=True) #sort by accuracy score
  13. print_questions(b)
  14. #for i in b: print i
  15. print "showing by average time"
  16. b.sort(key=lambda e:sum(e[1][1])/len(e[1][1]))
  17. print_questions(b[-10:])
  18. print "Overall average answer time: %.2fs" % (sum([sum(stats[1]) for q,stats in b])/sum([len(stats[1]) for q,stats in b]))
Submit a correction or amendment below. [ previous version ] | [ difference ] | Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: