<commit_before>import hashlib
from datetime import datetime

from lxml import etree

from django.conf import settings
from django.core.files.base import ContentFile

from banzai.models import Package


class MailPackage(object):

    def __init__(self, email_from, name_from, subject, message, send_at=None,
                 headers=[], attach_images=u'0', description=u''):
        self.email_from = email_from
        self.name_from = name_from
        self.subject = subject
        self.message = message
        self.send_at = send_at
        self.headers = headers
        self.attach_images = attach_images
        self.description = description

        self._users_data = []
        self._xml = etree.Element('list')
        self._generation_complete = False
        self._package = None

    def add_user(self, email_to, name_to=u'', header={}, fields={}):
        if self._generation_complete:
            raise RuntimeError('Impossibly add user, because '
                               'generation already complete!')
        self._users_data.append({<commit_msg>add add_users method for MailPackage class<commit_after>import hashlib
from datetime import datetime

from lxml import etree

from django.conf import settings
from django.core.files.base import ContentFile

from banzai.models import Package


class MailPackage(object):

    def __init__(self, email_from, name_from, subject, message, send_at=None,
                 headers=[], attach_images=u'0', description=u''):
        self.email_from = email_from
        self.name_from = name_from
        self.subject = subject
        self.message = message
        self.send_at = send_at
        self.headers = headers
        self.attach_images = attach_images
        self.description = description

        self._users_data = []
        self._xml = etree.Element('list')
        self._generation_complete = False
        self._package = None

    def add_users(self, users_list):
        for user in users_list:
            if isinstance(user, {}):
                self.add_user(
                    user['email_to'],
                    user.get('name_to', u''),
                    user.get('header', {}),
                    user.get('fields', {})
                )
            elif isinstance(user, (str, unicode)):
                self.add_user(user)
            else:
                raise RuntimeError('users_list must be a dict or string!')

    def add_user(self, email_to, name_to=u'', header={}, fields={}):
        if self._generation_complete:
            raise RuntimeError('Impossibly add user, because '
                               'generation already complete!')
        self._users_data.append({
{'fraction_non_alphanumeric': 0.09188988095238096, 'fraction_numerical': 0.000744047619047619, 'mean_word_length': 2.243667068757539, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1820740', 'n_tokens_mistral': 728, 'n_tokens_neox': 702, 'n_words': 181}