_validators#
- ns_sdn.engine._core._validators = <module 'ns_sdn.engine._core._validators' from '/home/runner/work/ns-sdn/ns-sdn/src/ns_sdn/engine/_core/_validators.py'>[source]#
Input validation primitives.
Every public constructor routes its argument checking through this module, so a malformed input produces the same exception type and message shape regardless of where it was raised. Each validator coerces as well as checks: it returns the value in the form the rest of the package assumes (a float64 copy, a Python
intorfloat, the string of aLiteral), so a caller can bind the return value and forget the input.The division of labor follows
ns_sdn.exceptions: geometry raisesDimensionError, content raisesSpecificationError, non-finite numbers raiseNumericalError. Messages name the argument, state the rule and quote the value.Example
>>> import numpy as np >>> _validate_endog(np.arange(5.0)).dtype, _validate_positive_int(3, "k") (dtype('float64'), 3)