def get_author(message):
- """Create a pygit2.Signature for the message author."""
+ """Create a pygit2.Signature for the message author.
+
+ >>> author = get_author(message={
+ ... 'From': '=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@dkuug.dk>',
+ ... 'Date': 'Fri, 21 Nov 1997 09:55:06 -0600',
+ ... })
+ >>> author.name
+ 'Keld Jørn Simonsen'
+ >>> author.email
+ 'keld@dkuug.dk'
+ >>> author.time
+ 880127706
+ >>> author.offset
+ 1080
+ """
author_name, author_email = _email_utils.parseaddr(
message['From'])
if not author_name:
author_name = author_email.split('@')[0]
+ author_name = _decode_header(string=author_name)
date = message['Date']
datetime = _email_utils.parsedate_to_datetime(date)
time = int(datetime.timestamp())
name=author_name,
email=author_email,
time=time,
- offset=offset)
+ offset=offset,
+ encoding=_COMMIT_MESSAGE_ENCODING)
def deliver(message=None, message_bytes=None, **kwargs):