<commit_before>#!/usr/bin/env python
from __future__ import print_function
import time
import sys
import math

width = 50.0
try:
    counter = int(sys.argv[1])
except ValueError:
    print('Use a integer value for counter')
    sys.exit(1)
except IndexError:
    print('Usage: {} counter\nwhere counter is a integer'.format(sys.argv[0]))
    sys.exit(1)

for i in xrange(counter):
    nrstars = int(width / counter * i)
    print('[{}{}]'.format('*' * nrstars, ' ' * int(math.ceil(width - nrstars))), end='\r')
    sys.stdout.flush()
    time.sleep(1)<commit_msg>implemented a better time parser<commit_after>#!/usr/bin/env python
from __future__ import print_function
import time
import sys
import math
import re

usage = 'Usage: {} TIME\n\
    Where TIME can be expressed in a couple of ways\n\
    10      -> 10 seconds, just a number will be interpeted as seconds\n\
    10[MHS] -> for 10 minutes, hours or seconds\n\
    1:10    -> for 1 hour and 10 minutes\n\
    1:10:5  -> for 1 hour, 10 minutes and 5 seconds'

if len(sys.argv) > 2:
    print('To many arguments')
    print(usage)
    sys.exit(1)

width = 50.0
try:
    sleep = int(sys.argv[1])
except ValueError:
    try:
        timestr = sys.argv[1]
        if re.match('\d+:\d+:\d+', timestr):
            hours, minutes, seconds = timestr.split(':')
            sleep = 3600*int(hours)+60*int(minutes)+int(seconds)
        elif re.match('\d+:\d+', timestr):
            hours, minutes = timestr.split(':')
            sleep = 3600*int(hours)+60*int(minutes)
        elif re.match('\d+[mhs]', timestr, re.IGNORECASE):
            m = re.match('(\d+)([mhs])', timestr, re.IGNORECASE)
            multiplydict = dict(s=1, m=60, h=3600)
            sleep = int(m.group(1)) * multiplydict[m.group(2)]
    except:
        print('Could not parse given time')
        print(usage)
except IndexError:
    print('To few argumenst')
    print(usage)
    sys.exit(1)

for i in xrange(sleep):
    nrstars = int(width / sleep * i)
    print('[{}{}]'.format('*' * nrstars, ' ' * int(math.ceil(width - nrstars))), end='\r')
    sys.stdout.flush()
    time.sleep(1)
{'fraction_non_alphanumeric': 0.1590909090909091, 'fraction_numerical': 0.028409090909090908, 'mean_word_length': 2.834845735027223, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '3662933', 'n_tokens_mistral': 773, 'n_tokens_neox': 739, 'n_words': 193}