<commit_before>__author__ = '<NAME>'
__version__ = '0.0.1'

import re
import logging
from types import FunctionType
from itertools import product

logger = logging.getLogger(__name__)


def ittr(*args, **kwargs):
    """
    Decorator that adds iteration attributes to test method
    """
    def update_attr(func):
        # combining kwargs and args dict with ittr dict
        ittrs = {str(item): item for item in args or []}
        ittr_dict = getattr(func, 'ittr', dict())
        ittr_dict.update(ittrs)
        ittr_dict.update(kwargs)
        setattr(func, 'ittr', ittr_dict)

        return func
    return update_attr


class IttrMultiplayer(type):
    """
    Multiples the tests in a given test class by
    the parameters given in ittr decorator.
    """
    def __new__(mcs, name, bases, dct):

        for attribute_name, attribute in dct.items():
            # if not a method continue
            if not type(attribute) == FunctionType:
                logging.debug('attribute {0} is not a method'.format(attribute_name))
                continue
            # is method decorated with platform attr
            if not hasattr(attribute, 'ittr') or not attribute.ittr:
                logging.debug('method {0} has not attr decorator'.format(attribute_name))
                continue

            # create product of all the iterators
            b = [map(lambda value: (key, value), values)
                 for key, values in attribute.ittr.iteritems() if values]
            products = map(dict, product(*b))

            for prod in products:
                logging.debug('method product: {0}'.format(prod))
                suffix = re.sub(r'\W+', '',
                                str(prod.values())
                                .translate(None, "[]'")
                                .replace(',', '_'))
                logging.debug('method suffix: {0}'.format(suffix))

                # in case itts passed are empty
                if not suffix:
                    logging.debug('Empty suffix, product: {0}'.format(prod))
                    continue
                new_func_name = attribute_name + '_' + suffix<commit_msg>code review changes<commit_after>__author__ = '<NAME>'
__version__ = '0.0.1'

import re
import logging
from types import FunctionType
from itertools import product

logger = logging.getLogger(__name__)


def ittr(*args, **kwargs):
    """
    Decorator that adds iteration attributes to test method
    """
    def update_attr(func):
        # combining kwargs and args dict with ittr dict
        ittrs = {str(item): item for item in args or []}
        ittr_dict = getattr(func, 'ittr', dict())
        ittr_dict.update(ittrs)
        ittr_dict.update(kwargs)
        setattr(func, 'ittr', ittr_dict)

        return func
    return update_attr


class IttrMultiplayer(type):
    """
    Multiples the tests in a given test class by
    the parameters given in ittr decorator.
    """
    def __new__(mcs, name, bases, dct):

        for attribute_name, attribute in dct.items():
            # if not a method continue
            if not type(attribute) == FunctionType:
                logging.debug('attribute {0} is not a method'.format(attribute_name))
                continue

            # is method decorated with platform attr
            if not hasattr(attribute, 'ittr') or not attribute.ittr:
                logging.debug('method {0} has not attr decorator'.format(attribute_name))
                continue

            # create product of all the iterators
            b = [map(lambda value: (key, value), values)
                 for key, values in attribute.ittr.iteritems() if values]
            products = map(dict, product(*b))

            for prod in products:
                logging.debug('method product: {0}'.format(prod))
                suffix = re.sub(r'\W+', '',
                                str(prod.values())
                                .translate(None, "[]'")
                                .replace(',', '_'))
                logging.debug('method suffix: {0}'.format(suffix))

                # in case itts passed are empty
                if not suffix:
                    logging.debug('Empty suffix, product: {0}'.format(prod))
                    continue
                new_func_name = attribute_name + '_' + suffix
{'fraction_non_alphanumeric': 0.10071610071610071, 'fraction_numerical': 0.003696003696003696, 'mean_word_length': 1.8751660026560426, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3490978', 'n_tokens_mistral': 1166, 'n_tokens_neox': 1118, 'n_words': 355}