Files
nix-config/agents/evals/review-comments-and-docs/fixtures/F13-sampler.py
T
ryan4yin | 二花 f32d67a5cc feat(agents): add review-comments-and-docs and two evaluation suites (#434)
Adds the review-comments-and-docs skill (1282-word body) and two evaluation suites: a 21-case
measured suite for the skill, and a harness that runs the two concurrency scenarios previously left
unrun in agents/evals/global-rules.md.
2026-10-12 00:35:06 +08:00

21 lines
693 B
Python

# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 Edge Systems
"""Sampling helpers for the dispatch pipeline."""
def sample_interval(period, divisor):
"""Return the sampling interval for one channel.
Call this once per channel per period. A divisor of zero disables sampling and
returns 0; a negative divisor is clamped to 1, so the returned interval never
exceeds the period. Safe to call concurrently at any time.
Arguments:
period: the sampling period in milliseconds.
divisor: how many samples fit in one period.
"""
if divisor <= 0:
raise ValueError(f"divisor must be positive, got {divisor}")
return period / divisor