0.1.8
Loading...
Searching...
No Matches
pyhelios.validation.core Namespace Reference

Functions

 validate_input (Dict[str, Callable] param_validators=None, Dict[str, Callable] type_coercions=None)
 Decorator for comprehensive parameter validation.
 
bool is_finite_numeric (Any value)
 Check if value is a finite number (not NaN or inf).
 
 validate_positive_value (Any value, str param_name="value", str function_name=None)
 Validate value is positive and finite.
 
 validate_non_negative_value (Any value, str param_name="value", str function_name=None)
 Validate value is non-negative and finite.
 
'vec3' coerce_to_vec3 (Any value, str param_name="parameter")
 Safely coerce list/tuple to vec3 with validation.
 
'vec2' coerce_to_vec2 (Any value, str param_name="parameter")
 Safely coerce list/tuple to vec2 with validation.
 

Function Documentation

◆ coerce_to_vec2()

'vec2' pyhelios.validation.core.coerce_to_vec2 ( Any value,
str param_name = "parameter" )

Safely coerce list/tuple to vec2 with validation.

Parameters
valueValue to coerce (vec2, list, or tuple)
param_nameParameter name for error messages
Returns
vec2 object
Exceptions
ValidationErrorIf coercion fails or values are invalid

Definition at line 215 of file core.py.

◆ coerce_to_vec3()

'vec3' pyhelios.validation.core.coerce_to_vec3 ( Any value,
str param_name = "parameter" )

Safely coerce list/tuple to vec3 with validation.

Parameters
valueValue to coerce (vec3, list, or tuple)
param_nameParameter name for error messages
Returns
vec3 object
Exceptions
ValidationErrorIf coercion fails or values are invalid

Definition at line 163 of file core.py.

◆ is_finite_numeric()

bool pyhelios.validation.core.is_finite_numeric ( Any value)

Check if value is a finite number (not NaN or inf).

Definition at line 78 of file core.py.

◆ validate_input()

pyhelios.validation.core.validate_input ( Dict[str, Callable] param_validators = None,
Dict[str, Callable] type_coercions = None )

Decorator for comprehensive parameter validation.

Performs type coercion first, then validation, following the pattern:

  1. Coerce types where safe (e.g., list to vec3)
  2. Validate all parameters meet requirements
  3. Call original function if validation passes
Parameters
param_validatorsDict mapping parameter names to validation functions
type_coercionsDict mapping parameter names to coercion functions

Examples

@validate_input(
param_validators={'center': validate_vec3, 'radius': validate_positive_value},
type_coercions={'center': coerce_to_vec3}
)
def addSphere(self, center, radius, **kwargs):
# center is guaranteed to be vec3, radius is positive

Definition at line 37 of file core.py.

◆ validate_non_negative_value()

pyhelios.validation.core.validate_non_negative_value ( Any value,
str param_name = "value",
str function_name = None )

Validate value is non-negative and finite.

Parameters
valueValue to validate
param_nameParameter name for error messages
function_nameFunction name for error messages
Exceptions
ValidationErrorIf value is negative or not finite

Definition at line 129 of file core.py.

◆ validate_positive_value()

pyhelios.validation.core.validate_positive_value ( Any value,
str param_name = "value",
str function_name = None )

Validate value is positive and finite.

Parameters
valueValue to validate
param_nameParameter name for error messages
function_nameFunction name for error messages
Exceptions
ValidationErrorIf value is not positive or not finite

Definition at line 97 of file core.py.