<commit_before>#!/usr/bin/env python3
# VagrIRC Virc library

# Written in 2015 by <NAME> <<EMAIL>>
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
#
# You should have received a copy of the CC0 Public Domain Dedication along
# with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.

import os
import shutil

import yaml

from ..base import BaseServiceBot


class AcidServiceBot(BaseServiceBot):
    """Implements support for the Hybrid IRCd."""
    name = 'acid'
    vcs = 'git'
    url = 'https://gitlab.com/rizon/acid.git'

    def init_info(self):
        """Create our info."""
        self.info['users'] = {
            'moo': {
                'services': {
                    'password': '<PASSWORD>',
                    'level': 'service bot',
                },
                'email': '<EMAIL>',
            }
        }

    def write_config(self, folder, info):
        """Write config file to the given folder."""
        config_files = {
            'pyva-native': [
                os.path.join(self.source_folder, 'pyva', 'pyva-native', 'pyva-cpp', 'make.example.properties'),
                os.path.join(folder, 'pyva', 'pyva-native', 'pyva-cpp', 'make.properties'),
            ],
            'acid': [
                os.path.join(self.source_folder, 'acid', 'acidictive.example.yml'),
                os.path.join(folder, 'acid', 'acidictive.yml'),
            ],
        }

        # create folders
        output_config_dir = os.path.join(folder, 'pyva', 'pyva-native', 'pyva-cpp')
        if not os.path.exists(output_config_dir):
            os.makedirs(output_config_dir)
        output_config_dir = os.path.join(folder, 'acid')
        if not os.path.exists(output_config_dir):
            os.makedirs(output_config_dir)

        # pyva-native compilation makefile
        orig, new = config_files['pyva-native']
        shutil.copyfile(orig, new)

        # aciditive config file
        orig, new = config_files['acid']
        with open(orig, 'r') as config_file:
            config_data = config_file.read()

        conf = yaml.load(config_data)

        # setting info
        conf['uplink']['host'] = '127.0.0.1'
        conf['uplink']['pass'] = self.info['links'][0]['password']
        conf['uplink']['port'] = self.info['links'][0]['port']

        conf['database'][0]['host'] = 'jdbc:mysql://127.0.0.1:3306/acidcore?autoReconnect=true'
        conf['database'][0]['name'] = 'acidcore'
        conf['database'][0]['user'] = 'acid'
        conf['database'][0]['pass'] = '<PASSWORD>'

        conf['debug'] = True

        # and writing it out
        with open(new, 'w') as config_file:
            config_file.write(yaml.dump(conf))

    def write_build_files(self, folder, src_folder, bin_folder, build_folder, config_folder):
        """Write build files to the given folder."""
        build_file = """#!/usr/bin/env sh
mkdir -p {bin_folder}
cp -R {src_folder}/* {bin_folder}
cd {bin_folder}

cp {config_folder}/pyva/pyva-native/pyva-cpp/make.properties {bin_folder}/pyva/pyva-native/pyva-cpp/

mvn install

ln -s pyva/pyva-native/pyva-cpp/libpyva.so libpyva.so
sudo pip install -r pyva/requirements.txt

cp {config_folder}/acid/acidictive.yml {bin_folder}/acid/acidictive.yml
""".format(src_folder=src_folder, bin_folder=bin_folder, config_folder=config_folder)

        build_filename = os.path.join(folder, 'build')<commit_msg>acid: Fix server name, add config file<commit_after>#!/usr/bin/env python3
# VagrIRC Virc library

# Written in 2015 by <NAME> <<EMAIL>>
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
#
# You should have received a copy of the CC0 Public Domain Dedication along
# with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.

import os
import shutil

import yaml

from ..base import BaseServiceBot


class AcidServiceBot(BaseServiceBot):
    """Implements support for the Hybrid IRCd."""
    name = 'acid'
    vcs = 'git'
    url = 'https://gitlab.com/rizon/acid.git'

    def init_info(self):
        """Create our info."""
        self.info['users'] = {
            'moo': {
                'services': {
                    'password': '<PASSWORD>',
                    'level': 'service bot',
                },
                'email': '<EMAIL>',
            }
        }

    def write_config(self, folder, info):
        """Write config file to the given folder."""
        config_files = {
            'pyva-native': [
                os.path.join(self.source_folder, 'pyva', 'pyva-native', 'pyva-cpp', 'make.example.properties'),
                os.path.join(folder, 'pyva', 'pyva-native', 'pyva-cpp', 'make.properties'),
            ],
            'acid': [
                os.path.join(self.source_folder, 'acid', 'acidictive.example.yml'),
                os.path.join(folder, 'acidictive.yml'),
            ],
            'pyva': [
                os.path.join(self.source_folder, 'pyva', 'pyva.example.yml'),
                os.path.join(folder, 'pyva.yml'),
            ],
        }

        # create folders
        output_config_dir = os.path.join(folder, 'pyva', 'pyva-native', 'pyva-cpp')
        if not os.path.exists(output_config_dir):
            os.makedirs(output_config_dir)
        output_config_dir = os.path.join(folder, 'acid')
        if not os.path.exists(output_config_dir):
            os.makedirs(output_config_dir)

        # pyva-native compilation makefile
        orig, new = config_files['pyva-native']
        shutil.copyfile(orig, new)

        # aciditive config file
        orig, new = config_files['acid']
        with open(orig, 'r') as config_file:
            config_data = config_file.read()

        conf = yaml.load(config_data)

        # setting info
        conf['uplink']['host'] = '127.0.0.1'
        conf['uplink']['pass'] = self.info['links'][0]['password']
        conf['uplink']['port'] = self.info['links'][0]['port']

        conf['database'][0]['host'] = 'jdbc:mysql://127.0.0.1:3306/acidcore?autoReconnect=true'
        conf['database'][0]['name'] = 'acidcore'
        conf['database'][0]['user'] = 'acid'
        conf['database'][0]['pass'] = '<PASSWORD>'

        conf['debug'] = True
        conf['serverinfo']['name'] = 'acid.dnt'

        # and writing it out
        with open(new, 'w') as config_file:
            config_file.write(yaml.dump(conf))

    def write_build_files(self, folder, src_folder, bin_folder, build_folder, config_folder):
        """Write build files to the given folder."""
        build_file = """#!/usr/bin/env sh
mkdir -p {bin_folder}
cp -R {src_folder}/* {bin_folder}
cd {bin_folder}

cp {config_folder}/pyva/pyva-native/pyva-cpp/make.properties {bin_folder}/pyva/pyva-native/pyva-cpp/

mvn install

ln -s pyva/pyva-native/pyva-cpp/libpyva.so libpyva.so
sudo pip install -r pyva/requirements.txt

cp {config_folder}/acid/acidictive.yml {bin_folder}/acid/acidictive.yml
""".format(src_folder=src_folder, bin_folder=bin_folder, config_folder=config_folder)

        build_filename = os.path.join(folder, 'build')
{'fraction_non_alphanumeric': 0.14734561213434452, 'fraction_numerical': 0.008125677139761646, 'mean_word_length': 2.5573217726396917, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '6312837', 'n_tokens_mistral': 2427, 'n_tokens_neox': 2303, 'n_words': 512}