def _get_author(self, repository: Repository, value: str) -> Author: match = re.match(r"^(.+) <([^>]+)>$", value) if not match: if "@" in value: name, email = value, value else: name, email = value, "{0}@localhost".format(value) else: name, email = match.group(1), match.group(2) author, _ = get_or_create( Author, where={ "email": email, "repository_id": repository.id }, defaults={"name": name}, ) return author
def _get_author(self, repository: Repository, value: str) -> Author: match = re.match(r'^(.+) <([^>]+)>$', value) if not match: if '@' in value: name, email = value, value else: name, email = value, '{0}@localhost'.format(value) else: name, email = match.group(1), match.group(2) author, _ = get_or_create(Author, where={ 'email': email, 'repository_id': repository.id, }, defaults={ 'name': name, }) return author