<commit_before>
def cmp(a, b):
    return (a > b) - (a < b)

def bytes_to_string(byte_array):
    return ''.join([chr(b) for b in byte_array])
    #return byte_array.decode('utf-8')

def string_to_bytes(text):
    return bytes([ord(c) for c in text])
    #return text.encode('utf-8')

def bytestr_to_string(bytestr):
    #print ("C %s %s" % (bytestr, type(bytestr)))
    return bytes([c for c in bytestr]).decode('utf-8')

def string_to_bytestr(string):
    #return b''.join([chr(b) for b in string.encode('utf-8')])
    return string.encode('utf-8')
<commit_msg>py3 - make cmp import backwards compatible<commit_after>
try:
    import cmp
except ImportError:
    #No cmp function available, probably Python 3
    def cmp(a, b):
        return (a > b) - (a < b)

def bytes_to_string(byte_array):
    return ''.join([chr(b) for b in byte_array])
    #return byte_array.decode('utf-8')

def string_to_bytes(text):
    return bytes([ord(c) for c in text])
    #return text.encode('utf-8')

def bytestr_to_string(bytestr):
    #print ("C %s %s" % (bytestr, type(bytestr)))
    return bytes([c for c in bytestr]).decode('utf-8')

def string_to_bytestr(string):
    #return b''.join([chr(b) for b in string.encode('utf-8')])
    return string.encode('utf-8')


{'fraction_non_alphanumeric': 0.1634768740031898, 'fraction_numerical': 0.009569377990430622, 'mean_word_length': 3.8832684824902723, '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': '964525', 'n_tokens_mistral': 477, 'n_tokens_neox': 474, 'n_words': 123}