diff --git a/concrete/numpy/internal/__init__.py b/concrete/numpy/internal/__init__.py new file mode 100644 index 000000000..065af833e --- /dev/null +++ b/concrete/numpy/internal/__init__.py @@ -0,0 +1,3 @@ +""" +Declaration of `concrete.numpy.internal` namespace. +""" diff --git a/concrete/numpy/internal/utils.py b/concrete/numpy/internal/utils.py new file mode 100644 index 000000000..804f4fe6c --- /dev/null +++ b/concrete/numpy/internal/utils.py @@ -0,0 +1,31 @@ +""" +Declaration of various functions and constants related to the entire project. +""" + + +def assert_that(condition: bool, message: str = ""): + """ + Assert a condition. + + Args: + condition (bool): + condition to assert + + message (str): + message to give to `AssertionError` if the condition does not hold + + Raises: + AssertionError: + if the condition does not hold + """ + + if not condition: + raise AssertionError(message) + + +def unreachable(): + """ + Raise a RuntimeError to indicate unreachable code is entered. + """ + + raise RuntimeError("Entered unreachable code")