Example #1
0
def noise_stat_last_updated(domain, now=None):
    """Get the last-updated date for the statistics for a domain."""
    if now is None:
        now = datetime.datetime.now()

    value = db.get('noise_statistic_updated', domain)
    if value is None:
        return

    return datetime.datetime.strptime(value, db.datetime_format)
Example #2
0
def noise_stat_last_updated(domain, now=None):
    """Get the last-updated date for the statistics for a domain."""
    if now is None:
        now = datetime.datetime.now()

    value = db.get('noise_statistic_updated', domain)
    if value is None:
        return

    return db.from_db_datetime(value)
Example #3
0
def get_noise_stat(domain):
    """Get the noise statistics for a domain."""
    stat = db.get('noise_statistic', domain)
    if stat is None:
        return

    return NoiseStatistic(
        domain,
        stat['deltas'],
        datetime.datetime.strptime(stat['window_start']),
        stat['noisy'],
    )
Example #4
0
def get_noise_stat(domain):
    """Get the noise statistics for a domain."""
    stat = db.get('noise_statistic', domain)
    if stat is None:
        return

    return NoiseStatistic(
        domain,
        stat['deltas'],
        db.from_db_datetime(stat['window_start']),
        stat['noisy'],
    )