simplebench.reporters.validators package🔗
simplebench.reporters.validators package.
- Exports:
validate_reporter_callback
validate_report_renderer
ReportersValidatorsErrorTag
- simplebench.reporters.validators.validate_report_renderer(
- renderer: ReportRenderer,
Validate the report renderer method.
Verifies the renderer method has the correct signature. This is functionally equivalent to the
ReportRendererprotocol.A renderer function must accept the following three keyword-only parameters:
case: Casesection: Sectionoptions: ReporterOptions
- Parameters:
renderer – The renderer function to validate.
- Returns:
The validated renderer function.
- Raises:
SimpleBenchTypeError – If the renderer is invalid.
- simplebench.reporters.validators.validate_reporter_callback( ) ReporterCallback | None[source]🔗
Validate the reporter callback function.
Verifies the callback function has the correct signature.
If called without an
allow_noneparameter, the returned value will be guaranteed to conform to theReporterCallbackprotocol and type checkers will automatically type-narrow it.If called with an
allow_none=Trueparameter, the validator will accept either aReporterCallbackconformant method orNoneas valid.If an explicit
allow_noneparameter is passed, regardless of whetherallow_none=Trueorallow_none=False, the return type determined by static type checkers will beReporterCallback | None.A callback function must accept the following four keyword-only parameters:
case: Casesection: Sectionoutput_format: Formatoutput: Any
- Parameters:
callback – The callback function to validate.
allow_none – Whether to allow
Noneas a valid value for the callback. Defaults toFalse.
- Returns:
The validated callback function or
None.- Raises:
SimpleBenchTypeError – If the callback is invalid.