def has_signature(body, sender):
    '''Checks if the body has signature. Returns True or False.'''
    non_empty = [line for line in body.splitlines() if line.strip()]
    candidate = non_empty[-SIGNATURE_MAX_LINES:]
    upvotes = 0
    for line in candidate:
        # we check lines for sender's name, phone, email and url,
        # those signature lines don't take more then 27 lines
        if len(line.strip()) > 27:
            continue
        elif contains_sender_names(sender)(line):
            return True
        elif (binary_regex_search(RE_RELAX_PHONE)(line) +
              binary_regex_search(RE_EMAIL)(line) +
              binary_regex_search(RE_URL)(line) == 1):
            upvotes += 1
    if upvotes > 1:
        return True
def has_signature ( body , sender ) : non_empty = [ line for line in body . splitlines ( ) if line . strip ( ) ] candidate = non_empty [ - SIGNATURE_MAX_LINES : ] upvotes = 0 for line in candidate : if len ( line . strip ( ) ) > 27 : continue elif contains_sender_names ( sender ) ( line ) : return True elif ( binary_regex_search ( RE_RELAX_PHONE ) ( line ) + binary_regex_search ( RE_EMAIL ) ( line ) + binary_regex_search ( RE_URL ) ( line ) == 1 ) : upvotes += 1 if upvotes > 1 : return True
Checks if the body has signature. Returns True or False.