INNER CODE UNIT · Python

strfdelta

microsoft/botframework-sdk · dri/helpers.py:85

def strfdelta(tdelta, fmt):
    """Utility function.  Formats a `timedelta` into human readable string."""
    d = {"days": tdelta.days}
    d["hours"], rem = divmod(tdelta.seconds, 3600)
    d["minutes"], d["seconds"] = divmod(rem, 60)
    return fmt.format(**d)

def add_last_comment(issue, stale_days=10):
    """Takes an issue, adds the last comment time.
    Filters items, where the last comment is not at least stale_days old.
    Returns a copy of the issue.
    """
    comments_paged = issue.get_comments()
    if comments_paged.totalCount == 0:
        return None
    last_comment = ([msg for msg in comments_paged] or [None])[-1]
    assert last_comment
    if last_comment.created_at > (datetime.utcnow() - timedelta(days=stale_days)):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…