<commit_before># Copyright 2015 <NAME> <<EMAIL>>
# All Rights Reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

class Session():

    WORKROOM_TITLE = "%s: Work session"
    WORKROOM_DESCRIPTION = (
    "Work sessions are for %s contributors to discuss implementation details "
    "and making quick progress over specific issues, "
    "in a small work group environment.\n")
    WORKROOM_LINK = (
    "\nClick <a href='%s'>here</a> for details on this work room agenda.")

    MEETUP_TITLE = "%s: Contributors meetup"
    MEETUP_DESCRIPTION = (
    "The %s contributors meetup is a informal gathering of "
    "the project contributors, with an open agenda.\n")
    MEETUP_LINK = (
    "\nClick <a href='%s'>here</a> for details on the meetup agenda.")

    def __init__(self, sessionid):
        self.id = sessionid

    def modify_using_formdata(self, formdata):
        self.extratracks = formdata['extratracks']
        self.title = formdata.get('title')
        self.urllink = formdata.get('urllink')
        self.description = formdata['description']

    def set_title(self, fulltitle):
        self.fulltitle = fulltitle
        # Fishbowls keep their name, trackname is mandatory
        if self.style == 'FISHBOWL':
            if fulltitle.startswith(self.maintrack+": "):
                self.title = fulltitle[len(self.maintrack+": "):]
        self.title = fulltitle

    def set_desc(self, fulldesc):

        self.description = fulldesc.replace('<br />', '\n')

        start = fulldesc.find("<a href='")
        end = fulldesc.find("here</a>")
        if start != -1 and end != -1:
            self.urllink = fulldesc[start+9:end-2]
        else:
            self.urllink = ''

    def get_title(self):
        # Fishbowl can specify a name
        if self.style == 'FISHBOWL':
            if not self.title.startswith(self.maintrack+": "):
                return self.maintrack + ": " + self.title
        return self.title

    def get_desc(self):
        desc = self.description
        # Meetups have a mandatory description
        if self.style == 'MEETUP':
            desc = self.MEETUP_DESCRIPTION % self.maintrack
            if self.urllink:
                desc += self.MEETUP_LINK % self.urllink

        desc = desc.replace('\n', '<br />')

        return desc<commit_msg>Revert "Do not systematically rewrite titles"<commit_after># Copyright 2015 <NAME> <<EMAIL>>
# All Rights Reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

class Session():

    WORKROOM_TITLE = "%s: Work session"
    WORKROOM_DESCRIPTION = (
    "Work sessions are for %s contributors to discuss implementation details "
    "and making quick progress over specific issues, "
    "in a small work group environment.\n")
    WORKROOM_LINK = (
    "\nClick <a href='%s'>here</a> for details on this work room agenda.")

    MEETUP_TITLE = "%s: Contributors meetup"
    MEETUP_DESCRIPTION = (
    "The %s contributors meetup is a informal gathering of "
    "the project contributors, with an open agenda.\n")
    MEETUP_LINK = (
    "\nClick <a href='%s'>here</a> for details on the meetup agenda.")

    def __init__(self, sessionid):
        self.id = sessionid

    def modify_using_formdata(self, formdata):
        self.extratracks = formdata['extratracks']
        self.title = formdata.get('title')
        self.urllink = formdata.get('urllink')
        self.description = formdata['description']

    def set_title(self, fulltitle):
        self.fulltitle = fulltitle
        # Fishbowls keep their name, trackname is mandatory
        if self.style == 'FISHBOWL':
            if fulltitle.startswith(self.maintrack+": "):
                self.title = fulltitle[len(self.maintrack+": "):]
            else:
                self.title = fulltitle

        # Workrooms & meetups have a mandatory name
        if self.style == 'WORKROOM':
            self.title = self.WORKROOM_TITLE % self.maintrack

        if self.style == 'MEETUP':
            self.title = self.MEETUP_TITLE % self.maintrack

    def set_desc(self, fulldesc):

        self.description = fulldesc.replace('<br />', '\n')

        start = fulldesc.find("<a href='")
        end = fulldesc.find("here</a>")
        if start != -1 and end != -1:
            self.urllink = fulldesc[start+9:end-2]
        else:
            self.urllink = ''

    def get_title(self):
        # Fishbowl can specify a name
        if self.style == 'FISHBOWL':
            if not self.title.startswith(self.maintrack+": "):
                return self.maintrack + ": " + self.title
            else:
                return self.title

        # Workrooms have a mandatory name
        if self.style == 'WORKROOM':
            return self.WORKROOM_TITLE % self.maintrack

        # Meetups have a mandatory name
        if self.style == 'MEETUP':
            return self.MEETUP_TITLE % self.maintrack

    def get_desc(self):
        desc = self.description
        # Meetups have a mandatory description
        if self.style == 'MEETUP':
            desc = self.MEETUP_DESCRIPTION % self.maintrack
            if self.urllink:
                desc += self.MEETUP_LINK % self.urllink

        desc = desc.replace('\n', '<br />')

        return desc
{'fraction_non_alphanumeric': 0.10608474036317299, 'fraction_numerical': 0.003822873526600828, 'mean_word_length': 2.427401746724891, 'pattern_counts': {'":': 8, '<': 25, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, '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': '1632308', 'n_tokens_mistral': 1856, 'n_tokens_neox': 1809, 'n_words': 564}