<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

####################################################################################
# copyright 2008 <NAME> <<EMAIL>>
#
# This file is part of loaders.py
# 
# loaders.py is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# loaders.py is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with loaders.py.  If not, see <http://www.gnu.org/licenses/>.
##################################################################################

# standards imports
import os, sys, copy
import pygame
import logging
import math

try:
    from pygame.locals import BLEND_RGBA_MAX
    from pygame.locals import BLEND_RGBA_ADD
    from pygame.locals import BLEND_RGBA_SUB
    from pygame.locals import BLEND_RGBA_MULT
    from pygame.locals import BLEND_RGBA_MIN
except:
    Log().log("old version of pygame no BLEND_RGBA_MAX")
    BLEND_RGBA_MAX = None

def memoize(function):
    """
    Any function decorated with memoize will cache it's results and send them
    directly when called with same parameters as before, without calling the
    actual code, please only use with functions which result depend only of
    parameters (not time, state of the game or such).
    """
    cache = {}
    def decorated_function(*args, **kwargs):
        params = (args)+tuple(zip(kwargs.keys(),kwargs.values()))
        try:
            return cache[params]
        except:
            val = function(*args, **kwargs)
            cache[params] = val
            return val
    return decorated_function

@memoize #the memoize is critical for performances!
def image(name, *args, **kwargs):
    """
    A function to load an image, shamelessly picked from pygame<commit_msg>fixed decorator behaviour (on __name__,  __doc__ and __dict__)<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

###############################################################################
# copyright 2008 <NAME> <<EMAIL>>
#
# This file is part of pygame_loaders
# 
# pygame_loaders is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# pygame_loaders is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with pygame_loaders  If not, see <http://www.gnu.org/licenses/>.
###############################################################################

# standards imports
import os, sys, copy
import pygame
import logging
import math

try:
    from pygame.locals import BLEND_RGBA_MAX
    from pygame.locals import BLEND_RGBA_ADD
    from pygame.locals import BLEND_RGBA_SUB
    from pygame.locals import BLEND_RGBA_MULT
    from pygame.locals import BLEND_RGBA_MIN
except:
    Log().log("old version of pygame no BLEND_RGBA_MAX")
    BLEND_RGBA_MAX = None

def memoize(function):
    """
    Any function decorated with memoize will cache it's results and send them
    directly when called with same parameters as before, without calling the
    actual code, please only use with functions which result depend only of
    parameters (not time, state of the game or such).
    """
    cache = {}
    def decorated_function(*args, **kwargs):
        params = (args)+tuple(zip(kwargs.keys(),kwargs.values()))
        try:
            return cache[params]
        except:
            val = function(*args, **kwargs)
            cache[params] = val
            return val
    decorated_function.__name__ = function.__name__
    decorated_function.__doc__ = function.__doc__
    decorated_function.__dict__.update(function.__dict__)

    return decorated_function

@memoize #the memoize is critical for performances!
def image(name, *args, **kwargs):
    """
    A function to load an image, shamelessly picked from pygame
{'fraction_non_alphanumeric': 0.14184554104890462, 'fraction_numerical': 0.0026554547466253594, 'mean_word_length': 3.8034006376195535, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1500605', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1185, 'n_words': 487}