<commit_before># -*- coding: utf-8 -*-

# Copyright (C) 2011 <NAME>, <NAME>
#
# This file is part of ass2m.
#
# ass2m is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ass2m is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with ass2m. If not, see <http://www.gnu.org/licenses/>.


import re
import os
import sys
from textwrap import wrap
from datetime import datetime

from ass2m.plugin import Plugin
from ass2m.routes import View
from ass2m.server import ViewAction
from ass2m.cmd import Command
from ass2m.template import build_url, build_root_url

from .contacts import ContactsSelection
from .cleanup import ICleaner


__all__ = ['EventsPlugin']


class Event(object):
    (USER_CONFIRMED,
     USER_WAITING,
     USER_DECLINED) = range(3)

    STATES = {'x': USER_CONFIRMED,
              ' ': USER_WAITING,
              '-': USER_DECLINED
             }

    def __init__(self, f):
        self.f = f
        self.title = None
        self.summary = None
        self.date = None
        self.place = None
        self.users = {}
        self.users_to_notify = set()

    def save(self):
        with open(self.f.get_realpath(), 'w') as fp:
            self._print(fp)

        self.f.clear_user_perms()
        for username in self.users.iterkeys():
            self.f.set_user_perms(username, self.f.PERM_WRITE |
                                            self.f.PERM_READ |
                                            self.f.PERM_LIST)
        self.f.mimetype = 'text/event'
        self.f.save()

        self.send()

    def send(self):
        """
        Send mails to new users.
        """
        mails = set()
        while len(self.users_to_notify) > 0:<commit_msg>set +i for event users<commit_after># -*- coding: utf-8 -*-

# Copyright (C) 2011 <NAME>, <NAME>
#
# This file is part of ass2m.
#
# ass2m is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ass2m is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with ass2m. If not, see <http://www.gnu.org/licenses/>.


import re
import os
import sys
from textwrap import wrap
from datetime import datetime

from ass2m.plugin import Plugin
from ass2m.routes import View
from ass2m.server import ViewAction
from ass2m.cmd import Command
from ass2m.template import build_url, build_root_url

from .contacts import ContactsSelection
from .cleanup import ICleaner


__all__ = ['EventsPlugin']


class Event(object):
    (USER_CONFIRMED,
     USER_WAITING,
     USER_DECLINED) = range(3)

    STATES = {'x': USER_CONFIRMED,
              ' ': USER_WAITING,
              '-': USER_DECLINED
             }

    def __init__(self, f):
        self.f = f
        self.title = None
        self.summary = None
        self.date = None
        self.place = None
        self.users = {}
        self.users_to_notify = set()

    def save(self):
        with open(self.f.get_realpath(), 'w') as fp:
            self._print(fp)

        self.f.clear_user_perms()
        for username in self.users.iterkeys():
            self.f.set_user_perms(username, self.f.PERM_WRITE |
                                            self.f.PERM_READ |
                                            self.f.PERM_LIST |
                                            self.f.PERM_IN)
        self.f.mimetype = 'text/event'
        self.f.save()

        self.send()

    def send(self):
        """
        Send mails to new users.
        """
        mails = set()
        while len(self.users_to_notify) > 0:
{'fraction_non_alphanumeric': 0.08703618873110398, 'fraction_numerical': 0.007787448465414567, 'mean_word_length': 2.2039618488628028, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4975104', 'n_tokens_mistral': 1302, 'n_tokens_neox': 1259, 'n_words': 440}