<commit_before>import uuid
import datetime
import sys
import re
import time
import imaplib
import email as email_lib
import email.header
import pytest
from requests import session
from config import Config
from tests.utils import (retrieve_sms_with_wait,
                         delete_sms_messge,
                         find_csrf_token,
                         get_sms)


def _generate_unique_email(email, uuid_):
    parts = email.split('@')
    return "{}+{}@{}".format(parts[0], uuid_, parts[1])


def _get_sms_code(email):
    # Test will fail if there is not 1 message (we expect only 1 message)
    m = None
    try:
        messages = retrieve_sms_with_wait(email)
        assert len(messages) == 1, ('Expecting to retrieve 1 sms message in functional'
                                    ' test for user: {}').format(email)
        m = messages[0]
        return m.body
    finally:
        if m:
            delete_sms_messge(m.sid)


def _get_email_code(email, pwd, email_folder):
    timer = 0
    gimap = None
    while timer < Config.EMAIL_TIMEOUT:
        try:
            gimap = imaplib.IMAP4_SSL('imap.gmail.com')
            try:
                rv, data = gimap.login(email, pwd)
            except imaplib.IMAP4.error:
                    pytest.fail("Login to email account has failed.")
            rv, data = gimap.select(email_folder)
            rv, data = gimap.search(None, "ALL")
            ids_count = len(data[0].split())
            if ids_count > 1:
                pytest.fail("There is more than token email")
            elif ids_count == 1:
                num = data[0].split()[0]
                rv, data = gimap.fetch(num, '(UID BODY[TEXT])')
                msg = email_lib.message_from_bytes(data[0][1])
                gimap.store(num, '+FLAGS', '\\Deleted')
                gimap.expunge()
                return msg.get_payload().strip()
            timer += 30
            time.sleep(30)
        except:
            pytest.fail("Unable to retrieve the verify code from the email")<commit_msg>Updates to wait period.<commit_after>import uuid
import datetime
import sys
import re
import time
import imaplib
import email as email_lib
import email.header
import pytest
from requests import session
from config import Config
from tests.utils import (retrieve_sms_with_wait,
                         delete_sms_messge,
                         find_csrf_token,
                         get_sms)


def _generate_unique_email(email, uuid_):
    parts = email.split('@')
    return "{}+{}@{}".format(parts[0], uuid_, parts[1])


def _get_sms_code(email):
    # Test will fail if there is not 1 message (we expect only 1 message)
    m = None
    try:
        messages = retrieve_sms_with_wait(email)
        assert len(messages) == 1, ('Expecting to retrieve 1 sms message in functional'
                                    ' test for user: {}').format(email)
        m = messages[0]
        return m.body
    finally:
        if m:
            delete_sms_messge(m.sid)


def _get_email_code(email, pwd, email_folder):
    timer = 0
    gimap = None
    while timer < Config.EMAIL_TIMEOUT:
        try:
            gimap = imaplib.IMAP4_SSL('imap.gmail.com')
            try:
                rv, data = gimap.login(email, pwd)
            except imaplib.IMAP4.error:
                    pytest.fail("Login to email account has failed.")
            rv, data = gimap.select(email_folder)
            rv, data = gimap.search(None, "ALL")
            ids_count = len(data[0].split())
            if ids_count > 1:
                pytest.fail("There is more than token email")
            elif ids_count == 1:
                num = data[0].split()[0]
                rv, data = gimap.fetch(num, '(UID BODY[TEXT])')
                msg = email_lib.message_from_bytes(data[0][1])
                gimap.store(num, '+FLAGS', '\\Deleted')
                gimap.expunge()
                return msg.get_payload().strip()
            timer += 15
            time.sleep(15)
{'fraction_non_alphanumeric': 0.10017486884836373, 'fraction_numerical': 0.010492130901823632, 'mean_word_length': 1.8477951635846372, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4483756', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1196, 'n_words': 320}