def bandwidth_all_time() -> Tuple[Any, Any]: data = bandwidth_by_dist(MIRRORS_EPOCH) total = humanize_bytes(sum(x[1] for x in data)) by_dist = [(dist, humanize_bytes(bw)) for dist, bw in data] return total, by_dist
def bandwidth_semester(): data = bandwidth_by_dist(current_semester_start()) total = humanize_bytes(sum(x[1] for x in data)) by_dist = [(dist, humanize_bytes(bw)) for dist, bw in data] return total, by_dist
def bandwidth_semester(humanize: bool = True) -> Tuple[Any, Any]: if current_semester_start() > MIRRORS_REPORTING_FIXED: data = bandwidth_by_dist(current_semester_start()) else: data = bandwidth_by_dist(MIRRORS_REPORTING_FIXED) if humanize: total = humanize_bytes(sum(x[1] for x in data)) by_dist = [(dist, humanize_bytes(bw)) for dist, bw in data] else: total = sum(x[1] for x in data) by_dist = [(dist, bw) for dist, bw in data] return total, by_dist