def post_process()

in crashclouseau/hgauthors.py [0:0]


def post_process(r, author):
    """Post process the triple (email, real, nick) to remove typos or stuff like that"""
    email, real, nick = r
    email = email.strip(" .,")
    real = real.strip()
    nick = nick.strip()
    if email.startswith("mailto:"):
        email = email[7:]
    elif email.startswith("h<"):
        email = email[2:]
    email = (
        email.replace(",", ".").replace("@.", "@").replace(".@", "@").replace(" ", "")
    )
    email = BUG_PAT.sub("", email)

    if email and not validate_email(email):
        logger.error("Email not valid for: {}".format(author))

    return (email, real, nick)