Skip to content

Commit

Permalink
Type is_nonzero, is_zero, wrap_in_cse
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Oct 28, 2024
1 parent 0e790f1 commit 802b5aa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pymbolic/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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

Expand Down

0 comments on commit 802b5aa

Please sign in to comment.