<commit_before>import fcntl
import logging
import os
import threading
import time
from subprocess import Popen, PIPE

import config

def nonBlockRead(output):
    fd = output.fileno()
    fl = fcntl.fcntl(fd, fcntl.F_GETFL)
    fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
    try:
        return output.readline()
    except Exception:
        return b''

class CppBot:
    source_files = ['Analyzer.cpp', 'ChatBot.cpp', 'main.cpp', 'ChatBot.h', 'build.sh']
    exe_name = 'chat.exe'
    path = 'chat/'
    data_path = 'data/'
    data_files = ['bot.txt', 'blacklist.txt', 'fixedstem.txt', 'names.txt']
    max_smiles = config.get('vkbot.max_smiles', 'i')

    def __init__(self, name):
        try:
            exe_time = os.path.getmtime(self.path + self.exe_name)
            src_time = max(os.path.getmtime(self.path + i) for i in self.source_files)
            if src_time > exe_time:
                self.buildExe()
        except FileNotFoundError:
            self.buildExe()
        self.name = name
        self.start_time = time.time()
        self.runExe()<commit_msg>Added some mode files to CppBot update detector<commit_after>import fcntl
import logging
import os
import threading
import time
from subprocess import Popen, PIPE

import config

def nonBlockRead(output):
    fd = output.fileno()
    fl = fcntl.fcntl(fd, fcntl.F_GETFL)
    fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
    try:
        return output.readline()
    except Exception:
        return b''

class CppBot:
    source_files = ['Analyzer.cpp', 'ChatBot.cpp', 'main.cpp', 'ChatBot.h', 'build.sh']
    exe_name = 'chat.exe'
    path = 'chat/'
    data_path = 'data/'
    data_files = ['bot.txt', 'blacklist.txt', 'fixedstem.txt', 'names.txt', 'noans.txt', 'smiles.txt']
    max_smiles = config.get('vkbot.max_smiles', 'i')

    def __init__(self, name):
        try:
            exe_time = os.path.getmtime(self.path + self.exe_name)
            src_time = max(os.path.getmtime(self.path + i) for i in self.source_files)
            if src_time > exe_time:
                self.buildExe()
        except FileNotFoundError:
            self.buildExe()
        self.name = name
        self.start_time = time.time()
        self.runExe()
{'fraction_non_alphanumeric': 0.1261744966442953, 'fraction_numerical': 0.0, 'mean_word_length': 2.594855305466238, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7403412', 'n_tokens_mistral': 800, 'n_tokens_neox': 783, 'n_words': 174}