beartype¶
Type annotations validator using beartype
.
- cneuromax.utils.beartype.not_empty()[source]¶
Makes sure the string is not empty.
- Return type:
BeartypeValidator
- Returns:
- A
beartype
object that raises an exception if the annotated value does not satisfy the condition.
- cneuromax.utils.beartype.equal(element)[source]¶
Verifies that the annotated value is equal to the input argument.
- Parameters:
element (
object
) – The object to compare the annotated value against.- Return type:
BeartypeValidator
- Returns:
See return description of
not_empty()
.
- cneuromax.utils.beartype.one_of(*elements)[source]¶
Verifies that the annotated value is one of the input arguments.
Used to replace
typing.Literal
which is not supported byomegaconf
-based configs.- Parameters:
elements (
object
) – The objects to compare the annotated value against.- Return type:
BeartypeValidator
- Returns:
See return description of
not_empty()
.
- cneuromax.utils.beartype.ge(val)[source]¶
Verifies that the annotated value is
> or =
val
.- Parameters:
val (
float
) – The value to compare the annotated value against.- Return type:
BeartypeValidator
- Returns:
See return description of
not_empty()
.
- cneuromax.utils.beartype.gt(val)[source]¶
Verifies that the annotated value is
>
val
.- Parameters:
- Return type:
BeartypeValidator
- Returns:
See return description of
not_empty()
.
- cneuromax.utils.beartype.le(val)[source]¶
Verifies that the annotated value is
< or =
val
.- Parameters:
- Return type:
BeartypeValidator
- Returns:
See return description of
not_empty()
.