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

Functions

 _bind_args_to_params (func, args, kwargs)
 Bind positional and keyword arguments to parameter names.
 
 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

◆ _bind_args_to_params()

pyhelios.validation.core._bind_args_to_params ( func,
args,
kwargs )
protected

Bind positional and keyword arguments to parameter names.

Returns a dict mapping parameter names to their values for all explicitly provided arguments (excludes defaults for unprovided params). Also returns updated args/kwargs suitable for calling the function with any coerced values applied.

Definition at line 25 of file core.py.

◆ 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 270 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 218 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 133 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. Bind all arguments (positional and keyword) to parameter names
  2. Coerce types where safe (e.g., list to vec3)
  3. Validate all parameters meet requirements
  4. Call original function if validation passes
Parameters
param_validatorsDict mapping parameter names to validation functions
type_coercionsDict mapping parameter names to coercion functions

Definition at line 49 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 184 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 152 of file core.py.