<commit_before>import networkx
import claripy

class Function(object):
    '''
    A representation of a function and various information about it.
    '''
    def __init__(self, function_manager, addr, name=None):
        '''
        Function constructor

        @param addr             The address of the function
        @param name             (Optional) The name of the function
        '''
        self._transition_graph = networkx.DiGraph()
        self._ret_sites = set()
        self._call_sites = {}
        self._retn_addr_to_call_site = {}
        self._addr = addr
        self._function_manager = function_manager
        self.name = name
        # Register offsets of those arguments passed in registers
        self._argument_registers = []
        # Stack offsets of those arguments passed in stack variables
        self._argument_stack_variables = []

        # These properties are set by VariableManager
        self._bp_on_stack = False
        self._retaddr_on_stack = False

        self._sp_difference = 0

    @property
    def operations(self):
        '''
        All of the operations that are done by this functions.
        '''
        operations = [ ]
        for b in self.basic_blocks:
            if b in self._function_manager._project.ld.memory:
                try:
                    operations.extend(self._function_manager._project.block(b).operations)
                except AngrTranslationError:
                    continue
        return operations

    @property
    def code_constants(self):
        '''
        All of the constants that are used by this functions's code.
        '''
        # TODO: remove link register values
        constants = [ ]
        for b in self.basic_blocks:
            if b in self._function_manager._project.ld.memory:
                try:
                    constants.extend(self._function_manager._project.block(b).constants)
                except AngrTranslationError:
                    continue
        return constants

    @property
    def runtime_values(self):
        '''
        All of the concrete values used by this function at runtime (i.e., including passed-in arguments and global values).
        '''
        constants = set()
        for b in self.basic_blocks:
            for sirsb in self._function_manager._cfg.get_all_irsbs(b):
                for s in sirsb.successors + sirsb.unsat_successors:
                    for a in s.log.actions:
                        for ao in a.all_objects:<commit_msg>return values of the constants instead of the IRConsts themselves<commit_after>import networkx
import claripy

class Function(object):
    '''
    A representation of a function and various information about it.
    '''
    def __init__(self, function_manager, addr, name=None):
        '''
        Function constructor

        @param addr             The address of the function
        @param name             (Optional) The name of the function
        '''
        self._transition_graph = networkx.DiGraph()
        self._ret_sites = set()
        self._call_sites = {}
        self._retn_addr_to_call_site = {}
        self._addr = addr
        self._function_manager = function_manager
        self.name = name
        # Register offsets of those arguments passed in registers
        self._argument_registers = []
        # Stack offsets of those arguments passed in stack variables
        self._argument_stack_variables = []

        # These properties are set by VariableManager
        self._bp_on_stack = False
        self._retaddr_on_stack = False

        self._sp_difference = 0

    @property
    def operations(self):
        '''
        All of the operations that are done by this functions.
        '''
        operations = [ ]
        for b in self.basic_blocks:
            if b in self._function_manager._project.ld.memory:
                try:
                    operations.extend(self._function_manager._project.block(b).operations)
                except AngrTranslationError:
                    continue
        return operations

    @property
    def code_constants(self):
        '''
        All of the constants that are used by this functions's code.
        '''
        # TODO: remove link register values
        constants = [ ]
        for b in self.basic_blocks:
            if b in self._function_manager._project.ld.memory:
                try:
                    constants.extend(v.value for v in self._function_manager._project.block(b).constants)
                except AngrTranslationError:
                    continue
        return constants

    @property
    def runtime_values(self):
        '''
        All of the concrete values used by this function at runtime (i.e., including passed-in arguments and global values).
        '''
        constants = set()
        for b in self.basic_blocks:
            for sirsb in self._function_manager._cfg.get_all_irsbs(b):
                for s in sirsb.successors + sirsb.unsat_successors:
                    for a in s.log.actions:
                        for ao in a.all_objects:
{'fraction_non_alphanumeric': 0.06860625122862198, 'fraction_numerical': 0.00039315903282877927, 'mean_word_length': 1.8345403899721449, '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': '2450433', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1231, 'n_words': 390}