<commit_before># http://stackoverflow.com/questions/4628122/how-to-construct-a-timedelta-object-from-a-simple-string

32m
2h32m
3d2h32m
1w3d2h32m
1w 3d 2h 32m
1 w 3 d 2 h 32 m
4:13
4:13:02
4:13:02.266
2:04:13:02.266
2 days,  4:13:02         # uptime format
2 days,  4:13:02.266
5hr34m56s
5 hours, 34 minutes, 56 seconds
5 hrs, 34 mins, 56 secs
2 days, 5 hours, 34 minutes, 56 seconds
1.2 m
1.2 min
1.2 mins
1.2 minute
1.2 minutes
172 hours
172 hr
172 h
172 hrs
172 hour
1.24 days
5 d
5 day
5 days
5.6 wk
5.6 week
5.6 weeks
#3.1 months
#12.24 year
#12.24 years
#12.24 yr
#12.24 y
#12 years, 3 months, 2 days, 5 hours, 34 minutes, 56 seconds
#12 years, 3 months, 2 days,  4:13:02

# http://stackoverflow.com/questions/538666/python-format-timedelta-to-string
# standard format using
# str(datetime.timedelta(hours=10.56))



def interpret_time_since ( s ):
    '''Attempts to parse a "time since", such as 5.6 wk.  If successful,
    returns the time referred to.'''
    m = re.match ( r'^([0-9.]+)\s*([a-z]*)$', s.strip().lower() )
    if m is not None:
        number, units = m.groups()
        if not units:
            units = ''
        number, units = float(number), units.strip()
        if units in [ 'm', 'min', 'mins', 'minute', 'minutes' ]:
            return ( datetime.datetime.now() -
                     datetime.timedelta ( minutes = number ) )
        elif units in [ 'h', 'hr', 'hrs', 'hour', 'hours' ]:
            return ( datetime.datetime.now() -
                     datetime.timedelta ( hours = number ) )
        elif units in [ 'd', 'day', 'days' ]:
            return ( datetime.datetime.now() -
                     datetime.timedelta ( days = number ) )
        elif units in [ 'w', 'week', 'weeks' ]:
            return ( datetime.datetime.now() -
                     datetime.timedelta ( weeks = number ) )
        elif units in [ 'y', 'year', 'years' ]:
            return ( datetime.datetime.now() -
                     datetime.timedelta ( weeks = number * 52 ) )
    assert False<commit_msg>notes.py: remove old code<commit_after># http://stackoverflow.com/questions/4628122/how-to-construct-a-timedelta-object-from-a-simple-string

32m
2h32m
3d2h32m
1w3d2h32m
1w 3d 2h 32m
1 w 3 d 2 h 32 m
4:13
4:13:02
4:13:02.266
2:04:13:02.266
2 days,  4:13:02         # uptime format
2 days,  4:13:02.266
5hr34m56s
5 hours, 34 minutes, 56 seconds
5 hrs, 34 mins, 56 secs
2 days, 5 hours, 34 minutes, 56 seconds
1.2 m
1.2 min
1.2 mins
1.2 minute
1.2 minutes
172 hours
172 hr
172 h
172 hrs
172 hour
1.24 days
5 d
5 day
5 days
5.6 wk
5.6 week
5.6 weeks
#3.1 months
#12.24 year
#12.24 years
#12.24 yr
#12.24 y
#12 years, 3 months, 2 days, 5 hours, 34 minutes, 56 seconds
#12 years, 3 months, 2 days,  4:13:02

# http://stackoverflow.com/questions/538666/python-format-timedelta-to-string
# standard format using
# str(datetime.timedelta(hours=10.56))
{'fraction_non_alphanumeric': 0.133402995471961, 'fraction_numerical': 0.124695228143504, 'mean_word_length': 2.5369458128078817, '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': '2379863', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1072, 'n_words': 342}