[tor-commits] [policies/master] Script to provide trac activity

atagar at torproject.org atagar at torproject.org
Mon Oct 2 00:46:18 UTC 2017


commit 1ad18c92f95129096cf6d81021060e04e3edebdc
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Oct 1 17:37:28 2017 -0700

    Script to provide trac activity
    
    Even simpler than commits. Just using trac's timeline view to get user
    activity.
---
 scripts/trac_activity.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/scripts/trac_activity.py b/scripts/trac_activity.py
new file mode 100644
index 0000000..ef09dfa
--- /dev/null
+++ b/scripts/trac_activity.py
@@ -0,0 +1,27 @@
+import collections
+import re
+import urllib
+
+TICKETS_CREATED = 'https://trac.torproject.org/projects/tor/timeline?daysback=180&ticket=on&update=Update'
+TICKETS_UPDATED = 'https://trac.torproject.org/projects/tor/timeline?daysback=180&ticket_details=on&update=Update'
+WIKI_UPDATES = 'https://trac.torproject.org/projects/tor/timeline?daysback=180&wiki=on&update=Update'
+
+USER_ACTION = re.compile('by <span class="trac-author(?:-user)?">(\S+)</span>')
+
+for title, url in (('Tickets Created', TICKETS_CREATED), ('Tickets Updated', TICKETS_UPDATED), ('Wiki Edits', WIKI_UPDATES)):
+  request = urllib.urlopen(url)
+  user_edits = filter(lambda user: user != 'trac' and user != 'cypherpunks', USER_ACTION.findall(request.read()))
+
+  print('=' * 60)
+  print(title)
+  print('=' * 60)
+  print('')
+
+  threshold = 0.01 * len(user_edits)  # only show results if it's at least 1% to avoid long tail
+
+  for user, count in sorted(collections.Counter(user_edits).items(), key = lambda entry: entry[1], reverse = True):
+    if count >= threshold:
+      print(' * %s %s' % (count, user))
+
+  print('')
+



More information about the tor-commits mailing list