Skip to content

Commit

Permalink
black formatting datatracker.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sbenthall committed Oct 14, 2023
1 parent cec6535 commit 372e168
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions bigbang/analysis/datatracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,43 @@

dt = DataTrackerExt()


def draft_authors_from_working_group(acr):
"""
Get a dataframe of all authors of drafts published
by the working group.
"""

# identify group
g = dt.group_from_acronym(acr)
g = dt.group_from_acronym(acr)

records = []
# get drafts.
# filter by rfc status here?
for draft in dt.documents(group=g, doctype=dt.document_type_from_slug("draft")): # status argument
for draft in dt.documents(
group=g, doctype=dt.document_type_from_slug("draft")
): # status argument
# interested in all submissions, or just the most recent?
#
submissions = [dt.submission(sub_url) for sub_url in draft.submissions]
submissions = sorted(submissions, key = lambda s : s.submission_date, reverse=True)
submissions = [dt.submission(sub_url) for sub_url in draft.submissions]
submissions = sorted(submissions, key=lambda s: s.submission_date, reverse=True)

if len(submissions) > 0 :
if len(submissions) > 0:
latest = submissions[0]

authors_text = latest.authors

try:
at = authors_text.replace("'", "\"")
at = authors_text.replace("'", '"')
at = at.replace("None", "null")
authors = json.loads(at)
except Exception:
authors = [{'raw_text' : authors_text}]
authors = [{"raw_text": authors_text}]

for a in authors:
a['submission_date'] = latest.submission_date
a['draft_uri'] = latest.draft.uri
a['title'] = latest.title
a["submission_date"] = latest.submission_date
a["draft_uri"] = latest.draft.uri
a["title"] = latest.title

records.append(authors)

Expand All @@ -55,8 +58,10 @@ def draft_authors_from_working_group(acr):

return df


em_re = "/api/v1/person/email/([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7})/"


def email_from_uri(email_uri):
m = re.match(em_re, email_uri)

Expand Down

0 comments on commit 372e168

Please sign in to comment.