<commit_before>from time import strftime
from datetime import datetime

def dump(data):
    """
    Memdump with no title
    """
    i = 1

    if( isinstance(data, bytes) == False ):
        raise TypeError("Expected bytes for data")

    dump = '\t'
    dump_ascii = ''
    padding = '        '
    
    for c in data:
        try: # python 3
            dump += '{:02x} '.format(c) 
                
        except: # python 2.x
            dump += '{:02x} '.format(ord(c))
            if c >= ' ' and c < '~':
                dump_ascii += c
            else:
                dump_ascii += '.'

        if(i % 16 == 0):
            dump = dump + padding + dump_ascii + '\n\t'
            dump_ascii = ''
        i+=1
       
    if dump_ascii:
        for i in range(16 - len(dump_ascii)):
            padding += '   '
        dump = dump + padding + dump_ascii + '\n\t'

    return dump


def get_datetime():
    """
    Get current date and time (for ISO data fields)
    """
    return int(datetime.now().strftime("%d%m%H%M%S"))

def get_timestamp(t=None):
    """
    Get current timestamp for logging purposes
    TODO: get milliseconds
    """
    return datetime.now().strftime("%H:%M:%S:%f")


def trace(title, data):
    """
    """
    print('\n{} {}\n{}'.format(get_timestamp(), title, dump(data)))<commit_msg>Showing timestamp milliseconds after . delimiter not :<commit_after>from time import strftime
from datetime import datetime

def dump(data):
    """
    Memdump with no title
    """
    i = 1

    if( isinstance(data, bytes) == False ):
        raise TypeError("Expected bytes for data")

    dump = '\t'
    dump_ascii = ''
    padding = '        '
    
    for c in data:
        try: # python 3
            dump += '{:02x} '.format(c) 
                
        except: # python 2.x
            dump += '{:02x} '.format(ord(c))
            if c >= ' ' and c < '~':
                dump_ascii += c
            else:
                dump_ascii += '.'

        if(i % 16 == 0):
            dump = dump + padding + dump_ascii + '\n\t'
            dump_ascii = ''
        i+=1
       
    if dump_ascii:
        for i in range(16 - len(dump_ascii)):
            padding += '   '
        dump = dump + padding + dump_ascii + '\n\t'

    return dump


def get_datetime():
    """
    Get current date and time (for ISO data fields)
    """
    return int(datetime.now().strftime("%d%m%H%M%S"))

def get_timestamp(t=None):
    """
    Get current timestamp for logging purposes
    TODO: get milliseconds
    """
    return datetime.now().strftime("%H:%M:%S.%f")


def trace(title, data):
    """
    """
    print('\n{} {}\n{}'.format(get_timestamp(), title, dump(data)))
{'fraction_non_alphanumeric': 0.1500185666542889, 'fraction_numerical': 0.009654660230226514, 'mean_word_length': 1.7433808553971486, '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': '873169', 'n_tokens_mistral': 878, 'n_tokens_neox': 819, 'n_words': 227}