[damned-lies] Allow parsing maintainer without email in doap files
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Allow parsing maintainer without email in doap files
- Date: Wed, 21 Sep 2016 18:20:59 +0000 (UTC)
commit 8136c7438f963fd3db86acf0e4b481dd10fe9aa9
Author: Claude Paroz <claude 2xlibre net>
Date: Wed Sep 21 20:20:28 2016 +0200
Allow parsing maintainer without email in doap files
stats/doap.py | 17 ++++++++++-------
stats/tests/gnome-hello.tar.gz | Bin 501760 -> 332743 bytes
2 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/stats/doap.py b/stats/doap.py
index 5d2e76d..4a7adfe 100644
--- a/stats/doap.py
+++ b/stats/doap.py
@@ -30,13 +30,16 @@ class DoapParser(object):
]
maintainers = []
for maint in maint_tags:
- name, mbox, uid = [res for res in [maint[0].find(attr) for attr in pers_attrs]
- if res is not None]
- maint = {'name': name.text, 'email': None, 'account': None}
- if mbox is not None:
- maint['email'] = unquote(mbox.items()[0][1].replace("mailto:", ""))
- if uid is not None:
- maint['account'] = uid.text
+ parsed = dict(
+ (key, res) for key, res in [
+ (attr.split('}')[-1], maint[0].find(attr)) for attr in pers_attrs
+ ] if res is not None
+ )
+ maint = {'name': parsed['name'].text, 'email': None, 'account': None}
+ if 'mbox' in parsed:
+ maint['email'] = unquote(parsed['mbox'].items()[0][1].replace("mailto:", ""))
+ if 'userid' in parsed:
+ maint['account'] = parsed['userid'].text
maintainers.append(maint)
return maintainers
diff --git a/stats/tests/gnome-hello.tar.gz b/stats/tests/gnome-hello.tar.gz
index a010c61..68c9472 100644
Binary files a/stats/tests/gnome-hello.tar.gz and b/stats/tests/gnome-hello.tar.gz differ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]