<commit_before>import tornado.ioloop
import tornado.web
import tornado.wsgi
import io
import time
import random
import os

from PIL import Image
N = 20

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        n = int(self.get_argument("n"))
        img = int(self.get_argument("img"))
        fn = os.path.join(os.path.dirname(__file__), "images/"+str(img)+".jpg")
        im = Image.open(fn)
        dim = im.size
        c = im.crop((int(n*dim[0]/N), 0, int((n+1)*dim[0]/N), dim[1]))
        bio = io.BytesIO()
        c.save(bio, 'JPEG')
        self.set_header('Content-Type', 'image/jpeg')
        time.sleep(abs(random.gauss(0.2, 0.2)))
        self.write(bio.getvalue())

application = tornado.wsgi.WSGIApplication([
    (r"/image", MainHandler),<commit_msg>return a random fragment, in PNG format<commit_after>import tornado.ioloop
import tornado.web
import tornado.wsgi
import io
import time
import random
import os

from PIL import Image
N = 20

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        n = int(random.uniform(0,N))
        img = int(self.get_argument("img"))
        fn = os.path.join(os.path.dirname(__file__), "images/"+str(img)+".jpg")
        im = Image.open(fn)
        dim = im.size
        c = im.crop((int(n*dim[0]/N), 0, int((n+1)*dim[0]/N), dim[1]))
        bio = io.BytesIO()
        c.save(bio, 'PNG')
        self.set_header('Content-Type', 'image/jpeg')
        self.set_header('X-ECE459-Fragment', str(n))
        time.sleep(abs(random.gauss(0.2, 0.2)))
        self.write(bio.getvalue())

application = tornado.wsgi.WSGIApplication([
    (r"/image", MainHandler),
{'fraction_non_alphanumeric': 0.16697135892748324, 'fraction_numerical': 0.015843997562461912, 'mean_word_length': 3.0643564356435644, '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': '5854716', 'n_tokens_mistral': 605, 'n_tokens_neox': 575, 'n_words': 113}