<commit_before>from interfaces.parser_expr import QuantifiedSignal


class FuncDescription:
    def __init__(self, func_name,
                 type_by_arg:dict,
                 output,
                 body):
        self._name = func_name
        self._output = output
        self._body = body

        #TODO: evil hack
        # Tau function of each process though isomorphic has slightly different signals
        # for example, tau_0 has signals indexed with 0 and tau_1 - signals indexed with 1
        #
        # This may lead to different order of arguments in different tau functions.
        # for example, tau0 has r0,sch0,proc0,prev0
        #          and tau1 has prev1,sch0,proc0,r1
        # The problem is that I call the same instance of tau function in the end.
        # Therefore the order of arguments should be the same.
        # To assure this, lets sort signals with respect to their str(s) implementation.

        self._ordered_input_type_pairs = sorted(list(type_by_arg.items()),
                                                key=lambda t_a: str(t_a[0]) if not isinstance(t_a[0], QuantifiedSignal)
                                                else str(t_a[0].name))  # sorting ignores indices

    @property
    def name(self):
        return self._name

    @property
    def inputs(self):
        """ Return: ordered input_type pairs """
        return self._ordered_input_type_pairs

    @property
    def output(self):
        return self._output<commit_msg>fix bug: func description should sort inputs accounting for indices<commit_after>from interfaces.parser_expr import QuantifiedSignal


class FuncDescription:
    def __init__(self, func_name,
                 type_by_arg:dict,
                 output,
                 body):
        self._name = func_name
        self._output = output
        self._body = body

        #TODO: evil hack
        # Tau function of each process though isomorphic has slightly different signals
        # for example, tau_0 has signals indexed with 0 and tau_1 - signals indexed with 1
        #
        # This may lead to different order of arguments in different tau functions.
        # for example, tau0 has r0,sch0,proc0,prev0
        #          and tau1 has prev1,sch0,proc0,r1
        # The problem is that I call the same instance of tau function in the end.
        # Therefore the order of arguments should be the same.
        # To assure this, lets sort signals with respect to their str(s) implementation.

        self._ordered_input_type_pairs = sorted(list(type_by_arg.items()),
                                                key=lambda t_a: str(t_a[0]))

    @property
    def name(self):
        return self._name

    @property
    def inputs(self):
        """ Return: ordered input_type pairs """
        return self._ordered_input_type_pairs

    @property
    def output(self):
        return self._output
{'fraction_non_alphanumeric': 0.061876933654176694, 'fraction_numerical': 0.011000343760742524, 'mean_word_length': 2.0439330543933054, '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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4131689', 'n_tokens_mistral': 768, 'n_tokens_neox': 727, 'n_words': 271}