cobald.utility package
- cobald.utility.enforce(condition: bool, exception: BaseException = InvariantError())[source]
Enforce that
conditionis set by raisingexceptionotherwiseThis is a replacement for
assertstatements as part of validation. It cannot be disabled with-Oand may raise arbitrary exceptions.def sqrt(value): condition(value > 0, ValueError('value must be greater than zero') return math.sqrt(value)