<commit_before>import json
import requests
from globalvars import GlobalVars
import threading
import websocket
from collections import Iterable
import time
import os
from datahandling import add_blacklisted_user


class Metasmoke:
    @classmethod
    def init_websocket(self):
        GlobalVars.metasmoke_ws = websocket.create_connection(GlobalVars.metasmoke_ws_host, origin=GlobalVars.metasmoke_host)
        GlobalVars.metasmoke_ws.send(json.dumps({"command": "subscribe", "identifier": "{\"channel\":\"SmokeDetectorChannel\",\"key\":\"" + GlobalVars.metasmoke_key + "\"}"}))

        while True:
            a = GlobalVars.metasmoke_ws.recv()
            print(a)
            data = json.loads(a)

            if "message" in data:
                message = data['message']

                if isinstance(message, Iterable):
                    if "message" in message:
                        GlobalVars.charcoal_hq.send_message(message['message'])
                    elif "blacklist" in message:
                        add_blacklisted_user((message['blacklist']['uid'], message['blacklist']['site']), "metasmoke", message['blacklist']['post'])
                    elif "commit_status" in message:
                        c = message["commit_status"]
                        if c["status"] == "success":
                            if "autopull" in c["message"]:
                                GlobalVars.send_message("[CI]({ci_link}) on {commit_sha} succeeded. Message contains 'autopull', pulling...".format(ci_link=c["ci_url"], commit_sha=c["commit_sha"]))
                                time.sleep(2)
                                os._exit(3)
                            else:
                                GlobalVars.send_message("[CI]({ci_link}) on {commit_sha} succeeded.".format(ci_link=c["ci_url"], commit_sha=c["commit_sha"]))<commit_msg>'message' => 'commit_message'<commit_after>import json
import requests
from globalvars import GlobalVars
import threading
import websocket
from collections import Iterable
import time
import os
from datahandling import add_blacklisted_user


class Metasmoke:
    @classmethod
    def init_websocket(self):
        GlobalVars.metasmoke_ws = websocket.create_connection(GlobalVars.metasmoke_ws_host, origin=GlobalVars.metasmoke_host)
        GlobalVars.metasmoke_ws.send(json.dumps({"command": "subscribe", "identifier": "{\"channel\":\"SmokeDetectorChannel\",\"key\":\"" + GlobalVars.metasmoke_key + "\"}"}))

        while True:
            a = GlobalVars.metasmoke_ws.recv()
            print(a)
            data = json.loads(a)

            if "message" in data:
                message = data['message']

                if isinstance(message, Iterable):
                    if "message" in message:
                        GlobalVars.charcoal_hq.send_message(message['message'])
                    elif "blacklist" in message:
                        add_blacklisted_user((message['blacklist']['uid'], message['blacklist']['site']), "metasmoke", message['blacklist']['post'])
                    elif "commit_status" in message:
                        c = message["commit_status"]
                        if c["status"] == "success":
                            if "autopull" in c["commit_message"]:
                                GlobalVars.send_message("[CI]({ci_link}) on {commit_sha} succeeded. Message contains 'autopull', pulling...".format(ci_link=c["ci_url"], commit_sha=c["commit_sha"]))
                                time.sleep(2)
                                os._exit(3)
                            else:
                                GlobalVars.send_message("[CI]({ci_link}) on {commit_sha} succeeded.".format(ci_link=c["ci_url"], commit_sha=c["commit_sha"]))
{'fraction_non_alphanumeric': 0.12276487856952228, 'fraction_numerical': 0.0010675206832132373, 'mean_word_length': 2.152228763666947, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 4, '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': '5469498', 'n_tokens_mistral': 1020, 'n_tokens_neox': 1005, 'n_words': 192}