[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit 1b734bf73015ae97399b375c1116dcbfabd4afbd
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue Oct 3 10:08:34 2017 -0700

    Script to provide email activity
---
 scripts/email_activity.py | 48 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/scripts/email_activity.py b/scripts/email_activity.py
new file mode 100644
index 0000000..e40fac7
--- /dev/null
+++ b/scripts/email_activity.py
@@ -0,0 +1,48 @@
+import collections
+import re
+import urllib
+
+from datetime import date
+from dateutil import relativedelta  # https://pypi.python.org/pypi/python-dateutil/
+
+EMAIL_LISTS = (
+  'tor-talk',
+  'tor-dev',
+  'tor-relays',
+  'tor-project',
+
+  'ooni-talk',
+  'ooni-dev',
+
+  'global-south',
+  'metrics-team',
+  'tbb-dev',
+  'tor-community-team',
+  'UX',
+)
+
+AUTHOR = re.compile('</A><A NAME="\S+">&nbsp;</A>\n<I>(.+)\n')
+
+all_emails = []
+emails_for_list = {}  # {author => {list => count}}
+
+for email_list in EMAIL_LISTS:
+  for month_offset in range(6):
+    d = date.today() - relativedelta.relativedelta(months = month_offset)
+    url = "https://lists.torproject.org/pipermail/%s/%s/author.html"; % (email_list, d.strftime("%Y-%B"))
+
+    request = urllib.urlopen(url)
+    list_authors = AUTHOR.findall(request.read())
+
+    all_emails += list_authors
+
+    for author, count in collections.Counter(list_authors).items():
+      emails_for_list.setdefault(author, {})[email_list] = count
+
+for author, count in sorted(collections.Counter(all_emails).items(), key = lambda entry: entry[1], reverse = True):
+  list_counts = ['%s %s' % (c, a) for (a, c) in sorted(emails_for_list.get(author, {}).items(), key = lambda e: e[1], reverse = True)]
+
+  print('%s %s' % (count, author))
+  print('  %s' % ', '.join(list_counts))
+  print('')
+

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits