<commit_before>from ChatExchange.chatexchange import client, rooms
import sys


class Room(rooms.Room):
    def send_message(self, text, length_check=True):
        if "charcoal-hq-only" not in sys.argv or int(self.id) == 11540:
            return rooms.Room.send_message(self, text, length_check)
        else:
            print("Blocked message to {0} due to charcoal-hq-only setting".format(self.name))


class Client(client.Client):
    def get_room(self, room_id, **attrs_to_set):
        return self._get_and_set_deduplicated(
            Room, room_id, self._rooms, attrs_to_set)<commit_msg>Block sockets to external rooms with charcoal-hq-only<commit_after>from ChatExchange.chatexchange import client, rooms
import sys


class Room(rooms.Room):
    def send_message(self, text, length_check=True):
        if "charcoal-hq-only" not in sys.argv or int(self.id) == 11540:
            return rooms.Room.send_message(self, text, length_check)
        else:
            print("Blocked message to {0} due to charcoal-hq-only setting".format(self.name))

    def watch_socket(self, event_callback):
        if "charcoal-hq-only" not in sys.argv or int(self.id) == 11540:
            return rooms.Room.watch_socket(self, event_callback)
        else:
            print("Blocked socket connection to {0} due to charcoal-hq-only setting".format(self.name))


class Client(client.Client):
    def get_room(self, room_id, **attrs_to_set):
        return self._get_and_set_deduplicated(
            Room, room_id, self._rooms, attrs_to_set)
{'fraction_non_alphanumeric': 0.10481770833333333, 'fraction_numerical': 0.01171875, 'mean_word_length': 3.3295774647887324, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4978490', 'n_tokens_mistral': 511, 'n_tokens_neox': 480, 'n_words': 121}