<commit_before>import csv, json, SocketServer

class RequestHandler(SocketServer.BaseRequestHandler):

    def handle(self):
        request_message = json.loads(self.request[0])
        socket = self.request[1]

        frame_no = request_message['frm']
        
        print "Handling request for {0}".format(frame_no)
        response = {
            "frm": frame_no,
            "dta": self.server.movie_data[frame_no]
        }

        socket.sendto(json.dumps(response), self.client_address)

def seed_movie():

    movie_data = {}
    with open('movie_data.csv', 'rb') as csvfile:
        data = csv.reader(csvfile)
        for row in data:
            frame_no, frame_data = row[0], row[1]
            movie_data[frame_no] = frame_data

    return movie_data

if __name__ == "__main__":
    HOST, PORT = "localhost", 5000
    server = SocketServer.UDPServer((HOST, PORT), RequestHandler)

    print "Seeding movie data..."
    server.movie_data = seed_movie()

    print "Listening for requests..."
    server.serve_forever()<commit_msg>change ip from loopback to all<commit_after>import csv, json, SocketServer

class RequestHandler(SocketServer.BaseRequestHandler):

    def handle(self):
        request_message = json.loads(self.request[0])
        socket = self.request[1]

        frame_no = request_message['frm']

        print "Handling request for {0}".format(frame_no)
        response = {
            "frm": frame_no,
            "dta": self.server.movie_data[frame_no]
        }

        socket.sendto(json.dumps(response), self.client_address)

def seed_movie():

    movie_data = {}
    with open('movie_data.csv', 'rb') as csvfile:
        data = csv.reader(csvfile)
        for row in data:
            frame_no, frame_data = row[0], row[1]
            movie_data[frame_no] = frame_data

    return movie_data

if __name__ == "__main__":
    HOST, PORT = "0.0.0.0", 5000
    server = SocketServer.UDPServer((HOST, PORT), RequestHandler)

    print "Seeding movie data..."
    server.movie_data = seed_movie()

    print "Listening for requests..."
    server.serve_forever()
{'fraction_non_alphanumeric': 0.11756306520704426, 'fraction_numerical': 0.010471204188481676, 'mean_word_length': 2.694200351493849, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '6369903', 'n_tokens_mistral': 688, 'n_tokens_neox': 650, 'n_words': 144}