<commit_before>
import pygame
from pygame.locals import *
import logging

log = logging.getLogger("R.Surface")

def scaleImage(surface, width, height):
    """ Return surface scaled to fit width and height. """
    log.debug("scaled image %s" % repr(surface))
    return transform.smoothscale(surface, (width, height))

class ImageSurface(object):
    def __init__(self, pygameSurface, pixelAlpha=True):
        if not pixelAlpha:
            self._surface = pygameSurface.convert()
        else:
            self._surface = pygameSurface.convert_alpha()

        self.composite = self._surface
        self._modScale = None
        self._modColor = None
        self._pixelAlpha = pixelAlpha

    def convert(self):
        if not self._pixelAlpha:
            return self._surface.convert()
        else:
            return self._surface.convert_alpha()

    def applyScale(self):
        # This is a slow pass.  Do this as little as possible.
        self._modScale = scaleImage(self._surface, self._width, self._height)
        self.applyColor()
        self.applyAlpha()

    def applyColor(self):
        # This is a semi fast pass.  Use the scaling slow passed image.
        if not self._pixelAlpha:
            self._modColor = self._modScale.convert()
            self._modColor.fill((self._red, self._green, self._blue),
                                None, BLEND_RGB_MULT)
            self.applyAlpha()
        else:
            self._modColor = self._modScale.convert_alpha()
            self._modColor.fill((self._red, self._green, self._blue, self._alpha),
                                None, BLEND_RGBA_MULT)
            self.composite = self._modColor
        
    def applyAlpha(self):
        # This is a fast pass.  Use the double passed image from scale and color.
        if not self._pixelAlpha:
            self._modColor.set_alpha(alpha)
            self.composite = self._modColor
        else:
            self.applyColor(self._red, self._green, self._blue, self._alpha)

    def getWidth()
    def setWidth()

    def getHeight()
    def setHeight()

    def getSize()
    def setSize()

    def getRed()
    def setRed()

    def getGreen()
    def setGreen()

    def getBlue()
    def setBlue()

    def getAlpha()
    def setAlpha()
        
            
<commit_msg>All property values set up<commit_after>
import pygame
from pygame.locals import *
import logging

log = logging.getLogger("R.Surface")

def scaleImage(surface, width, height):
    """ Return surface scaled to fit width and height. """
    log.debug("scaled image %s" % repr(surface))
    return transform.smoothscale(surface, (width, height))

class ImageSurface(object):
    def __init__(self, pygameSurface, pixelAlpha=True):
        if not pixelAlpha:
            self._surface = pygameSurface.convert()
        else:
            self._surface = pygameSurface.convert_alpha()

        self.composite = self._surface
        self._modScale = None
        self._modColor = None
        self._pixelAlpha = pixelAlpha

        self._width  = self._surface.get_width()
        self._height = self._surface.get_height()

        self._red = 255
        self._green = 255
        self._blue = 255
        self._alpha = 255

        self.refresh()

    def refresh(self):
        self.applyScale()

    def convert(self):
        if not self._pixelAlpha:
            return self._surface.convert()
        else:
            return self._surface.convert_alpha()

    def applyScale(self):
        # This is a slow pass.  Do this as little as possible.
        self._modScale = scaleImage(self._surface, self._width, self._height)
        self.applyColor()
        self.applyAlpha()

    def applyColor(self):
        # This is a semi fast pass.  Use the scaling slow passed image.
        if not self._pixelAlpha:
            self._modColor = self._modScale.convert()
            self._modColor.fill((self._red, self._green, self._blue),
                                None, BLEND_RGB_MULT)
            self.applyAlpha()
        else:
            self._modColor = self._modScale.convert_alpha()
            self._modColor.fill((self._red, self._green, self._blue, self._alpha),
                                None, BLEND_RGBA_MULT)
            self.composite = self._modColor
        
    def applyAlpha(self):
        # This is a fast pass.  Use the double passed image from scale and color.
        if not self._pixelAlpha:
            self._modColor.set_alpha(alpha)
            self.composite = self._modColor
        else:
            self.applyColor(self._red, self._green, self._blue, self._alpha)

    def getWidth(self):
        return self._width
    def setWidth(self, width):
        self._width = width
        self.applyScale()
    width = property(getWidth, setWidth)

    def getHeight(self):
        return self._height
    def setHeight(self, height):
        self._height = height
        self.applyScale()
    height = property(getHeight, setHeight)

    def getSize(self):
        return (self._width, self._height)
    def setSize(self, size):
        self._width = size[0]
        self._height = size[1]
        self.applyScale()
    size = property(getSize, setSize)

    def getRed(self):
        return self._red
    def setRed(self, red):
        self._red = red
        self.applyColor()
    red = property(getRed, setRed)

    def getGreen(self):
        return self._green
    def setGreen(self, green):
        self._green = green
        self.applyColor()
    green = property(getGreen, setGreen)

    def getBlue(self):
        return self._blue
    def setBlue(self, blue):
        self._blue = blue
        self.applyColor()
    blue = property(getBlue, setBlue)

    def getAlpha(self):
        return self._alpha
    def setAlpha(self, alpha):
        self._alpha = alpha
        self.applyAlpha()
    alpha = property(getAlpha, setAlpha)

    def getColor(self):
        return (self._red, self._green, self._blue)
    def setColor(self, color):
        self._red = color[0]
        self._green = color[1]
        self._blue = color[2]
    color = property(getColor, setColor)
        
            

{'fraction_non_alphanumeric': 0.09582790091264667, 'fraction_numerical': 0.0027705345501955673, 'mean_word_length': 2.0669665167416293, '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': '3574579', 'n_tokens_mistral': 1754, 'n_tokens_neox': 1700, 'n_words': 448}