From 458d2af00aac33dd6345f7ab1386ce9002c9e002 Mon Sep 17 00:00:00 2001 From: Lukas Brabec Date: Jul 11 2013 11:19:42 +0000 Subject: non red hatters detection --- diff --git a/stats-bodhi.py b/stats-bodhi.py index 0c9600d..8f0665d 100755 --- a/stats-bodhi.py +++ b/stats-bodhi.py @@ -112,19 +112,22 @@ def parse_args(): def create_name(username): if not FAS: - return username + return username, None fas_person = FAS.person_by_username(username) if fas_person == {}: - return username + return username, ("@redhat.com" in username) elif not fas_person.human_name: - return username + email = fas_person.email + return username, ("@redhat.com" in email or "@redhat.com" in username) elif username == fas_person.human_name: - return username + email = fas_person.email + return username, ("@redhat.com" in email or "@redhat.com" in username) else: - return fas_person.human_name + u" ("+username+u")" - + email = fas_person.email + return fas_person.human_name + u" ("+username+u")", \ + ("@redhat.com" in email or "@redhat.com" in username) class BodhiStats(): """ @@ -156,6 +159,8 @@ class BodhiStats(): self.others = [] # nickname -> realname (if provided, otherwise nickname) self.real_names = {} + # list of non-redhatters + self.nonrh = [] def get_updates(self, page): global threads @@ -204,9 +209,11 @@ class BodhiStats(): sys.stderr.write("Asking FAS for real names...\n") for author in self.authors: - name = create_name(author[0]) + name, red_hatter = create_name(author[0]) name = name.replace('@', ' at ') self.real_names[author[0]] = name + if not red_hatter: + self.nonrh.append(name) def get_HTML(self): @@ -264,6 +271,9 @@ class BodhiStats(): if THRESHOLD <= 1: output = re.sub(u'.*?', u'', output, flags=re.DOTALL) + sys.stderr.write("List of contributors that *might* not be Red Hatters (don't " + "have a @redhat.com email address): %s\n" % ", ".join(self.nonrh)) + return output # Retrieve stats by small parts simultaneously is much faster