<commit_before>import socket
import datetime
#maybe need extend
buffer_size = 1024
port = 1111

class SimpleChatServer:
    def __init__(self):
        #start server socket
        print("Starting server on localhost:%d" % port)
        self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.socket.bind(('localhost', port))
        self.socket.listen(100)
        self.currentUsers = {}
        
    def start(self):
        while True:

            connect, address = self.socket.accept()
            msg = connect.recv(buffer_size)

            if address not in self.currentUsers:
                self.currentUsers[address] = {"nickname": msg, "socket": connect}
                connect.send("Welcome to chat %s, type 'exit' for leaving from chat\n" % msg)
                msg = "%s connected to chat\n" % msg
            else:
                now = datetime.datetime.now()
                msg = "[%d:%d:%d] %s: %s" % (now.hour, now.minute, now.second,
                                             self.currentUsers[address]["nickname"], msg)
            for user in self.currentUsers.itervalues():
                user["socket"].send(msg + "\n")
            print(msg)

if __name__ == "__main__":
    server = SimpleChatServer()
    server.start()<commit_msg>Server side: Remove inactive users<commit_after>import socket
import errno
import datetime
#maybe need extend
buffer_size = 1024
port = 1111

class SimpleChatServer:
    def __init__(self):
        #start server socket
        print("Starting server on localhost:%d" % port)
        self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.socket.bind(('localhost', port))
        self.socket.listen(100)
        self.currentUsers = {}
        
    def start(self):
        while True:

            connect, address = self.socket.accept()
            msg = connect.recv(buffer_size)

            if address not in self.currentUsers:
                self.currentUsers[address] = {"nickname": msg, "socket": connect}
                connect.send("Welcome to chat %s, type 'exit' for leaving from chat\n" % msg)
                msg = "%s connected to chat\n" % msg
            else:
                now = datetime.datetime.now()
                msg = "[%d:%d:%d] %s: %s" % (now.hour, now.minute, now.second,
                                             self.currentUsers[address]["nickname"], msg)

            for adr in self.currentUsers.keys():
                try:
                    self.currentUsers[adr]["socket"].send(msg + "\n")
                except socket.error as er:
                    if er.errno == errno.WSAECONNRESET:
                        del self.currentUsers[adr]
            print(msg)

if __name__ == "__main__":
    server = SimpleChatServer()
    server.start()
{'fraction_non_alphanumeric': 0.11564625850340136, 'fraction_numerical': 0.007876834944504118, 'mean_word_length': 1.874485596707819, 'pattern_counts': {'":': 6, '<': 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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2908045', 'n_tokens_mistral': 796, 'n_tokens_neox': 748, 'n_words': 197}