<commit_before>#!/usr/bin/python

"""

Utilities for processing the parsed email output of messages sent through the smtp server

"""

import re
from lxml import html as lxml_html

from config import pass_through_mailboxes, pass_through_target, action_mailboxes
from rfc_822_email_address_validator import is_valid_email_address

def valid_email_address (email_address):
    """Confirm that the email address provided is of a valid format"""
    result = False
    if email_address:
        if is_valid_email_address(email_address.strip('<>')):
            result = True
    return result

def get_email_address (s):
    """Parse out the first email address found in the string and return it"""
    for token in s.split():
        if token.find('@') > -1:
            # token will be in the form:
            # 'FROM:<<EMAIL>>' or 'TO:<<EMAIL>>'
            # and with or without the <>
            for email_part in token.split(':'): 
                if email_part.find('@') > -1:
                    return email_part.strip('<>')

def domain_recipients_valid (domain_recipients=[]):
    """Confirm that the first email recipient @smtp_server_domain could correspond to a valid project (i.e., it a new project or an int) and return it"""
    result = None
    try:
        if domain_recipients[0] in action_mailboxes.keys() or domain_recipients[0] in pass_through_mailboxes:
            result = domain_recipients[0]
    except IndexError:
        pass<commit_msg>Removed an obsoleted config reference<commit_after>#!/usr/bin/python

"""

Utilities for processing the parsed email output of messages sent through the smtp server

"""

import re
from lxml import html as lxml_html

from config import pass_through_mailboxes, action_mailboxes
from rfc_822_email_address_validator import is_valid_email_address

def valid_email_address (email_address):
    """Confirm that the email address provided is of a valid format"""
    result = False
    if email_address:
        if is_valid_email_address(email_address.strip('<>')):
            result = True
    return result

def get_email_address (s):
    """Parse out the first email address found in the string and return it"""
    for token in s.split():
        if token.find('@') > -1:
            # token will be in the form:
            # 'FROM:<<EMAIL>>' or 'TO:<<EMAIL>>'
            # and with or without the <>
            for email_part in token.split(':'): 
                if email_part.find('@') > -1:
                    return email_part.strip('<>')

def domain_recipients_valid (domain_recipients=[]):
    """Confirm that the first email recipient @smtp_server_domain could correspond to a valid project (i.e., it a new project or an int) and return it"""
    result = None
    try:
        if domain_recipients[0] in action_mailboxes.keys() or domain_recipients[0] in pass_through_mailboxes:
            result = domain_recipients[0]
    except IndexError:
        pass
{'fraction_non_alphanumeric': 0.09171496760995568, 'fraction_numerical': 0.005455165359699966, 'mean_word_length': 3.052486187845304, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6499175', 'n_tokens_mistral': 850, 'n_tokens_neox': 829, 'n_words': 294}