def save_host_contributors(self): raw_byline_string = self.api_raw["Author"] maintainer = self.api_raw["Maintainer"] byline = Byline(raw_byline_string) extracted_name_dicts = byline.author_email_pairs() for kwargs_dict in extracted_name_dicts: person = get_or_make_person(**kwargs_dict) self._save_contribution(person, "author")
def save_host_contributors(self): raw_byline_string = self.api_raw["info"]["author"] author_email = self.api_raw["info"]["author_email"] byline = Byline(raw_byline_string) extracted_name_dicts = byline.author_email_pairs() # use the author email field only if only one name if len(extracted_name_dicts)==1: extracted_name_dicts[0]["email"] = author_email for kwargs_dict in extracted_name_dicts: person = get_or_make_person(**kwargs_dict) self._save_contribution(person, "author")
def save_github_contribs_to_db(self): if isinstance(self.github_contributors, dict): # it's an error resp from the API, doh. return None if self.github_contributors is None: return None total_contributions_count = sum([c['contributions'] for c in self.github_contributors]) for github_contrib in self.github_contributors: person = get_or_make_person(github_login=github_contrib["login"]) percent_total_contribs = round( github_contrib["contributions"] / float(total_contributions_count) * 100, 3 ) self._save_contribution( person, "github_contributor", quantity=github_contrib["contributions"], percent=percent_total_contribs ) self.num_github_committers = len(self.github_contributors)
def save_github_owner_to_db(self): if not self.github_owner: return False person = get_or_make_person(github_login=self.github_owner) self._save_contribution(person, "github_owner")