<commit_before>import urllib2, sys

__all__ = ['chunk_report','chunk_read']

def chunk_report(bytes_so_far, chunk_size, total_size):
    if total_size > 0:
        percent = float(bytes_so_far) / total_size
        percent = round(percent*100, 2)
        sys.stdout.write("Downloaded %12d of %12d bytes (%6.2f%%)\r" % 
            (bytes_so_far, total_size, percent))
    else:
        sys.stdout.write("Downloaded %10.2g Mb\r" % 
            (bytes_so_far / 1024.**2))
  

def chunk_read(response, chunk_size=1024, report_hook=None):
    content_length = response.info().getheader('Content-Length')
    if content_length is None:
        total_size = 0
    else:
        total_size = content_length.strip()
        total_size = int(total_size)

    bytes_so_far = 0<commit_msg>progressbar tweaks<commit_after>import urllib2, sys

__all__ = ['chunk_report','chunk_read']

def chunk_report(bytes_so_far, chunk_size, total_size):
    if total_size > 0:
        percent = float(bytes_so_far) / total_size
        percent = round(percent*100, 2)
        sys.stdout.write(u"Downloaded %12d of %12d bytes (%6.2f%%)\r" % 
            (bytes_so_far, total_size, percent))
    else:
        sys.stdout.write(u"Downloaded %10.2g Mb\r" % 
            (bytes_so_far / 1024.**2))
  

def chunk_read(response, chunk_size=1024, report_hook=None):
    content_length = response.info().getheader('Content-Length')
    if content_length is None:
        total_size = 0
    else:
        total_size = content_length.strip()
        total_size = int(total_size)

    bytes_so_far = 0
{'fraction_non_alphanumeric': 0.11900191938579655, 'fraction_numerical': 0.03326935380678183, 'mean_word_length': 3.051813471502591, 'pattern_counts': {'":': 0, '<': 3, '<?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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6061846', 'n_tokens_mistral': 570, 'n_tokens_neox': 529, 'n_words': 104}