From 802b5aac74dd296349aca9ad03c6efb20ca9affd Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 28 Oct 2024 17:06:01 -0500 Subject: [PATCH] Type is_nonzero, is_zero, wrap_in_cse --- pymbolic/primitives.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pymbolic/primitives.py b/pymbolic/primitives.py index d84e46e1..38d820cd 100644 --- a/pymbolic/primitives.py +++ b/pymbolic/primitives.py @@ -1890,7 +1890,7 @@ def unregister_constant_class(class_): VALID_CONSTANT_CLASSES = tuple(tmp) -def is_nonzero(value): +def is_nonzero(value: object) -> bool: if value is None: raise ValueError("is_nonzero is undefined for None") @@ -1900,11 +1900,11 @@ def is_nonzero(value): return True -def is_zero(value): +def is_zero(value: object) -> bool: return not is_nonzero(value) -def wrap_in_cse(expr, prefix=None): +def wrap_in_cse(expr: ExpressionT, prefix=None) -> ExpressionT: if isinstance(expr, (Variable, Subscript)): return expr