<commit_before># -*- coding: utf-8 -*-

"""
pymlgame - Screen
"""

__author__ = "<NAME>"
__copyright__ = "Copyright 2013, <NAME>"
__credits__ = ["<NAME>"]
__license__ = "MIT"
__version__ = "0.0.1"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"

import socket

import pymlgame
from pymlgame.locals import *


class Screen(object):
    """
    Represents the Mate Light screen and has all the drawing methods.
    """
    def __init__(self, host, port, width=40, height=16):
        """
        Create a screen with default size and fill it with black pixels.
        """
        self.host = host
        self.port = port
        self.width = width
        self.height = height

        # fill screen with black pixels
        surface = pymlgame.Surface((self.width, self.height))
        surface.fill(BLACK)
        self.matrix = surface.matrix

    def update(self):
        """
        Sends the current screen contents to Mate Light
        """
        display_data = []
        for y in range(self.height):
            for x in range(self.width):
                for color in self.matrix[x][y]:
                    display_data.append(int(color))

        checksum = bytearray([0, 0, 0, 0])
        data_as_bytes = bytearray(display_data)
        data = data_as_bytes + checksum
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        sock.sendto(data, (self.host, self.port))

    def blit(self, surface, pos=(0, 0)):
        """
        Blits a surface on the screen at pos
        """
        for x in range(surface.width):<commit_msg>reset function added to screen<commit_after># -*- coding: utf-8 -*-

"""
pymlgame - Screen
"""

__author__ = "<NAME>"
__copyright__ = "Copyright 2013, <NAME>"
__credits__ = ["<NAME>"]
__license__ = "MIT"
__version__ = "0.0.1"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"

import socket

import pymlgame


class Screen(object):
    """
    Represents the Mate Light screen and has all the drawing methods.
    """
    def __init__(self, host, port, width=40, height=16):
        """
        Create a screen with default size and fill it with black pixels.
        """
        self.host = host
        self.port = port
        self.width = width
        self.height = height

        self.matrix = None
        self.reset()

    def reset(self):
        """
        Fill the screen with black pixels
        """
        surface = pymlgame.Surface(self.width, self.height)
        surface.fill(pymlgame.BLACK)
        self.matrix = surface.matrix

    def update(self):
        """
        Sends the current screen contents to Mate Light
        """
        display_data = []
        for y in range(self.height):
            for x in range(self.width):
                for color in self.matrix[x][y]:
                    display_data.append(int(color))

        checksum = bytearray([0, 0, 0, 0])
        data_as_bytes = bytearray(display_data)
        data = data_as_bytes + checksum
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        sock.sendto(data, (self.host, self.port))

    def blit(self, surface, pos=(0, 0)):
        """
        Blits a surface on the screen at pos
        """
        for x in range(surface.width):
{'fraction_non_alphanumeric': 0.11901840490797547, 'fraction_numerical': 0.011042944785276074, 'mean_word_length': 2.197058823529412, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1633348', 'n_tokens_mistral': 1026, 'n_tokens_neox': 966, 'n_words': 280}