Describe this timedelta in human-readable terms.

    :param delta: datetime.timedelta object
    :returns: str, describing this delta
186426
def describe_delta(delta):
    
    s = delta.total_seconds()
    s = abs(s)
    hours, remainder = divmod(s, 3600)
    minutes, seconds = divmod(remainder, 60)
    if hours:
        return '%d hr %d min' % (hours, minutes)
    if minutes:
        return '%d min %d secs' % (minutes, seconds)
    return '%d secs' % seconds
1052457
def tomorrow(self, date_from=None, date_format=None):
		
		# date de demain
		return self.delta(date_from=date_from, date_format=date_format, days=1)
18710
def get_delta(value):
    
    if isinstance(value, (int, float)):
        return timedelta(seconds=value)
    elif isinstance(value, timedelta):
        return value
    raise Exception('Invalid delta')
975660
def setDelta(self, delta):
        
        days = int(delta.days)
        secs = int(delta.total_seconds())
        
        direction = 'from now'
        if secs < 0:
            direction = 'ago'
        
        if days and days % 365 == 0:
            number = days / 365
            unit = 'year(s)'
        elif days and days % 30 == 0:
            number = days / 30
            unit = 'month(s)'
        elif days and days % 7 == 0:
            number = days / 7
            unit = 'week(s)'
        elif days:
            number = days
            unit = 'day(s)'
        elif secs % 3600 == 0:
            number = secs / 3600
            unit = 'hour(s)'
        elif secs % 60 == 0:
            number = secs / 60
            unit = 'minute(s)'
        else:
            number = secs
            unit = 'second(s)'
        
        self._numberSpinner.setValue(abs(int(number)))
        self._unitCombo.setCurrentIndex(self._unitCombo.findText(unit))
        index = self._directionCombo.findText(direction)
        self._directionCombo.setCurrentIndex(index)
349150
def format_delta(__timedelta: datetime.timedelta) -> str:
    
    if __timedelta == datetime.timedelta(0):
        return ''
    days_s = '{}D'.format(__timedelta.days) if __timedelta.days else ''
    hours, minutes = divmod(__timedelta.seconds, 3600)
    minutes, seconds = divmod(minutes, 60)
    hours_s = '{:02d}H'.format(hours) if hours else ''
    minutes_s = '{:02d}M'.format(minutes) if minutes else ''
    seconds_s = '{:02d}S'.format(seconds) if seconds else ''
    return 'P{}{}{}{}{}'.format(days_s,
                                'T' if hours or minutes or seconds else '',
                                hours_s, minutes_s, seconds_s)
1154196
def timedelta_to_duration(obj):
    
    minutes, hours, days = 0, 0, 0
    seconds = int(obj.total_seconds())
    if seconds > 59:
        minutes = seconds // 60
        seconds = seconds % 60
    if minutes > 59:
        hours = minutes // 60
        minutes = minutes % 60
    if hours > 23:
        days = hours // 24
        hours = hours % 24
    response = []
    if days:
        response.append('%sd' % days)
    if hours:
        response.append('%sh' % hours)
    if minutes:
        response.append('%sm' % minutes)
    if seconds or not response:
        response.append('%ss' % seconds)
    return "".join(response)
678862
def render_delta(d):
    """"""
    s = '' if d >= 0 else '-'
    d = abs(d)

    for unit in _SORTED_UNITS:
        span = __timedelta_millis(unit[1])
        if d >= span:
            count = int(d // span)
            s += '{0}{1}'.format(count, unit[0])
            d -= count * span

    if d or not s:
        s += str(d)

    return s
768445
def describe(self):
        
        counts = self.value_counts(dropna=False)
        freqs = counts / float(counts.sum())

        from pandas.core.reshape.concat import concat
        result = concat([counts, freqs], axis=1)
        result.columns = ['counts', 'freqs']
        result.index.name = 'categories'

        return result
1102341
def describe(df, dtype=None):
    
    if dtype is None:
        dtype = {}
    print('Number of datapoints: {datapoints}'.format(datapoints=len(df)))
    column_info, column_info_meta = _get_column_info(df, dtype)

    if len(column_info['int']) > 0:
        _describe_int(df, column_info)

    if len(column_info['float']) > 0:
        _describe_float(df, column_info)

    if len(column_info['category']) > 0:
        _describe_category(df, column_info, column_info_meta)

    if len(column_info['time']) > 0:
        _describe_time(df, column_info, column_info_meta)

    if len(column_info['other']) > 0:
        _describe_other(df, column_info, column_info_meta)

    column_types = {}
    for column_type, columns in column_info.items():
        for column_name in columns:
            if column_type == 'other':
                column_type = 'str'
            column_types[column_name] = column_type
    return column_types
483783
def unixtimestamp(datetime):
    
    epoch = UTC.localize(datetime.utcfromtimestamp(0))
    if not datetime.tzinfo:
        dt = UTC.localize(datetime)
    else:
        dt = UTC.normalize(datetime)
    delta = dt - epoch
    return total_seconds(delta)
1006484
def next_future_periodic_delta(self) -> Optional[float]:
        """"""
        try:
            next_event = self._scheduler.queue[0]
        except IndexError:
            return None

        now = time.monotonic()
        next_event_time = next_event[0]
        if next_event_time < now:
            return 0

        return next_event_time - now
447497
def next_timer_delta(self):
        ""
        if self.timeouts and not self.active:
            now = getnow()
            timo = self.timeouts[0].timeout
            if now >= timo:
                #looks like we've exceded the time
                return 0
            else:
                return (timo - now)
        else:
            if self.active:
                return 0
            else:
                return None
1338409
def advance_time_delta(timedelta):
    """"""
    assert(utcnow.override_time is not None)
    try:
        for dt in utcnow.override_time:
            dt += timedelta
    except TypeError:
        utcnow.override_time += timedelta
829143
def _time_ym_delta(timestamp, delta, months):
    
    timestamp = list(time.localtime(timestamp))
    timestamp[int(months)] += delta
    return time.mktime(timestamp)
579390
def calculate_delta_date(literal):
    
    mapping = {
        "today": 0,
        "yesterday": 1,
        "this-week": 7,
        "this-month": 30,
        "this-year": 365,
    }
    today = DateTime(DateTime().Date())  # current date without the time
    return today - mapping.get(literal, 0)
605902
private Delta<E> toDelta(difflib.Delta<E> delta) throws DiffException
    {
        Delta<E> newDelta;

        switch (delta.getType()) {
            case CHANGE:
                newDelta = new ChangeDelta<E>(delta.getOriginal(), delta.getRevised());
                break;
            case DELETE:
                newDelta = new DeleteDelta<E>(delta.getOriginal(), delta.getRevised());
                break;
            case INSERT:
                newDelta = new InsertDelta<E>(delta.getOriginal(), delta.getRevised());
                break;
            default:
                throw new DiffException(String.format("Failed to convert [%s] info [%s]. Unknown type [%s]", delta
                    .getClass().getName(), Delta.class.getName(), delta.getType().toString()));
        }

        return newDelta;
    }
299099
def delta_to_str(rd):
    
    parts = []
    if rd.days > 0:
        parts.append("%d day%s" % (rd.days, plural(rd.days)))
    clock_parts = []
    if rd.hours > 0:
        clock_parts.append("%02d" % rd.hours)
    if rd.minutes > 0 or rd.hours > 0:
        clock_parts.append("%02d" % rd.minutes)
    if rd.seconds > 0 or rd.minutes > 0 or rd.hours > 0:
        clock_parts.append("%02d" % rd.seconds)
    if clock_parts:
        parts.append(":".join(clock_parts))
    return " ".join(parts)