<commit_before>"""
This script reads one of the .dat files generated by the fractal generator,
iterates over each point in the complex grid and assigns each complex point a
color based on a color_function and a color_palette.
"""

from PIL import Image

# We first start by reading in the .dat file
INPUT_FILE = '../fractal_generator/sample_fractal_512_512.dat'

with open(INPUT_FILE) as data_in:
    # We read the first four lines first, telling us what properties the fractals has 
    RESOLUTION_X = int(next(data_in).split(' ')[-1])
    RESOLUTION_Y = int(next(data_in).split(' ')[-1])
    NUMBER_OF_ITERATIONS = int(next(data_in).split(' ')[-1])
    COMPLEX_SEED = complex((next(data_in).split(' ')[-1]))

    # We now initialize an empty bitmap 
    image = Image.new('RGB', (RESOLUTION_X, RESOLUTION_Y ), 'black')
    pixels = image.load()
    
    # Iterate over the complex numbers, given by their indices in the complex grid
    try:
        while data_in.next():
            in_line = next(data_in).split(',')
            x = int(in_line[0])
            y = int(in_line[1])
            iterations = int(in_line[2])
            if iterations == NUMBER_OF_ITERATIONS:
                pixels[x, y] = (255,255,255)
    except:
        # Done!
        pass
    image.show()
<commit_msg>Linted fractal_vis<commit_after>"""
This script reads one of the .dat files generated by the fractal generator,
iterates over each point in the complex grid and assigns each complex point a
color based on a color_function and a color_palette.
"""

from PIL import Image

# We first start by reading in the .dat file
INPUT_FILE = '../fractal_generator/sample_fractal_512_512.dat'

with open(INPUT_FILE) as data_in:
    # We read the first four lines first, telling us what properties the fractals has
    RESOLUTION_X = int(next(data_in).split(' ')[-1])
    RESOLUTION_Y = int(next(data_in).split(' ')[-1])
    NUMBER_OF_ITERATIONS = int(next(data_in).split(' ')[-1])
    COMPLEX_SEED = complex((next(data_in).split(' ')[-1]))

    # We now initialize an empty bitmap
    IMAGE = Image.new('RGB', (RESOLUTION_X, RESOLUTION_Y), 'black')
    PIXELS = IMAGE.load()

    # Iterate over the complex numbers, given by their indices in the complex grid
    try:
        while data_in.next():
            INPUT_LINE = next(data_in).split(',')
            X = int(INPUT_LINE[0])
            Y = int(INPUT_LINE[1])
            ITERATIONS = int(INPUT_LINE[2])
            if ITERATIONS == NUMBER_OF_ITERATIONS:
                PIXELS[X, Y] = (255, 255, 255)
    except StopIteration:
        # Done!
        pass
    IMAGE.show()

{'fraction_non_alphanumeric': 0.11264367816091954, 'fraction_numerical': 0.01685823754789272, 'mean_word_length': 2.992354740061162, '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': '1543325', 'n_tokens_mistral': 888, 'n_tokens_neox': 831, 'n_words': 260}