<commit_before>#!/usr/bin/env python
import os.path, math, string, sys
import Image, ImageDraw


def draw_bitmap(data, name):
    length = len(data)
    side = int(length**0.5)
    c = Image.new("RGB", (side,side))
    cd = ImageDraw.Draw(c)
    cd.point((0, 0), fill="red")
    for i in xrange(side):
        for j in xrange(side):
            val = ord(data[j+side*i]);
            cd.point((j,i), fill=(val,val,val))
    c.resize( (side*2,side*2) )
    c.save(name)

def main():
    from optparse import OptionParser, OptionGroup
    parser = OptionParser(
                usage = "%prog [options] infile [output]",
                version="%prog 0.1",
            )
    parser.add_option(
        "-s", "--size", action="store",
        type="int", dest="size", default=256,
        help="Image width in pixels."
    )
    
    options, args = parser.parse_args()
    if len(args) not in [1, 2]:
        parser.error("Please specify input and output file.")

    d = file(args[0]).read()
    if len(args) == 2:
        dst = args[1]
    else:
        base = os.path.basename(args[0])
        if "." in base:<commit_msg>Now sized correctly so end of file is seen.<commit_after>#!/usr/bin/env python
import os.path, math, string, sys
import Image, ImageDraw


def draw_bitmap(data, name):
    length = len(data)
    side = int(length**0.5)+1
    c = Image.new("RGBA", (side,side))
    cd = ImageDraw.Draw(c)
    cd.point((0, 0), fill="red")
    for i in xrange(side):
        for j in xrange(side):
            index = j+side*i
            if index >= length:
                break
            val = ord(data[index])
            cd.point((j,i), fill=(val,val,val))
    #c.resize( (side*2,side*2) )
    c.save(name)

def main():
    from optparse import OptionParser, OptionGroup
    parser = OptionParser(
                usage = "%prog [options] infile [output]",
                version="%prog 0.1",
            )
    parser.add_option(
        "-s", "--size", action="store",
        type="int", dest="size", default=256,
        help="Image width in pixels."
    )
    
    options, args = parser.parse_args()
    if len(args) not in [1, 2]:
        parser.error("Please specify input and output file.")

    d = open(args[0], "rb").read()
    if len(args) == 2:
        dst = args[1]
    else:
        base = os.path.basename(args[0])
        if "." in base:
{'fraction_non_alphanumeric': 0.15940803382663848, 'fraction_numerical': 0.014799154334038054, 'mean_word_length': 2.175838926174497, 'pattern_counts': {'":': 0, '<': 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': '4657461', 'n_tokens_mistral': 806, 'n_tokens_neox': 777, 'n_words': 204}