diff --git a/ago.py b/ago.py index 433ae30..455317e 100644 --- a/ago.py +++ b/ago.py @@ -3,6 +3,8 @@ from datetime import ( timedelta, ) +units = ('year', 'day', 'hour', 'minute', 'second', 'microsecond') + def get_delta_from_subject(subject): subject_type = type(subject) if subject_type is timedelta: @@ -42,17 +44,12 @@ def human(subject, precision=2, past_tense='{} ago', future_tense='in {}', abbre :returns: Human readable timedelta string (Str) """ delta = get_delta_from_subject(subject) - - # determine if the_tense is past_tense or future_tense. - the_tense = past_tense - if delta < timedelta(0): - the_tense = future_tense + the_tense = future_tense if delta < timedelta(0) else past_tense d = delta2dict( delta ) hlist = [] count = 0 - units = ( 'year', 'day', 'hour', 'minute', 'second', 'microsecond' ) # start building up the output in the hlist. for unit in units: