<commit_before>import blinkypattern
import blinkylib.blinkycolor

class Gradient(blinkypattern.BlinkyPattern):
    def __init__(self, blinkytape, start_color, end_color):
        super(Gradient, self).__init__(blinkytape)
        self._start_color = start_color
        self._end_color = end_color

    def setup(self):
        super(Gradient, self).setup()
        pixels = self._make_rgb_gradient(self._start_color, self._end_color)
        self._blinkytape.set_pixels(pixels)
        self._blinkytape.update()

    def _make_rgb_gradient(self, start_color, end_color):
        pixel_count = self._blinkytape.pixel_count
        red_delta = self._make_delta(start_color.red, end_color.red, pixel_count)
        green_delta = self._make_delta(start_color.green, end_color.green, pixel_count)
        blue_delta = self._make_delta(start_color.blue, end_color.blue, pixel_count)
        pixels = []
        for index in range(0, pixel_count):
            red = start_color.red + (red_delta * index)
            green = start_color.green + (green_delta * index)
            blue = start_color.blue + (blue_delta * index)
            pixels.append(blinkylib.blinkycolor.BlinkyColor(red, green, blue))
        return pixels

    def _make_delta(self, start, end, step):
        return (end - start) / float(step)
<commit_msg>Refactor Gradient to clean up loops and redundancy<commit_after>import blinkypattern
import blinkylib.blinkycolor

class Gradient(blinkypattern.BlinkyPattern):
    def __init__(self, blinkytape, start_color, end_color):
        super(Gradient, self).__init__(blinkytape)
        self._pixels = self._make_rgb_gradient(start_color, end_color)

    def setup(self):
        super(Gradient, self).setup()
        self._blinkytape.set_pixels(self._pixels)
        self._blinkytape.update()

    def _make_rgb_gradient(self, start_color, end_color):
        pixel_count = self._blinkytape.pixel_count
        red_gradient = self._make_gradient(start_color.red, end_color.red, pixel_count)
        green_gradient = self._make_gradient(start_color.green, end_color.green, pixel_count)
        blue_gradient = self._make_gradient(start_color.blue, end_color.blue, pixel_count)
        rgb_gradient = zip(red_gradient, green_gradient, blue_gradient)
        return [blinkylib.blinkycolor.BlinkyColor(*rgb) for rgb in rgb_gradient]

    def _make_gradient(self, start, end, count):
        delta = (end - start) / float(count)
        return [start + (delta * index) for index in range(0, count)]

{'fraction_non_alphanumeric': 0.09409888357256778, 'fraction_numerical': 0.0007974481658692185, 'mean_word_length': 3.5370705244122966, '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': '2737176', 'n_tokens_mistral': 823, 'n_tokens_neox': 792, 'n_words': 151}