Reference
Validators for the configuration options.
We can combine multiple validation conditions by summing them, thus creating a AND condition
Raises:
Type | Description |
---|---|
InvalidConfiguration
|
If passed value does not meet its imposed conditions |
InternalError
|
Passing unknown configuration of the methods |
Constraint
Base class to define a constraint on possible values that a parameter can take.
Serves as parent class, allows the "sum" of two constraints to make "AND" operations
Attributes:
Name | Type | Description |
---|---|---|
constraint_text |
String that describes the constraint |
Raises:
Type | Description |
---|---|
InvalidConfiguration
|
If the constraint on the parameter value is not met |
Source code in src/ASTRA/utils/parameter_validators.py
check_if_value_meets_constraint(value)
Compare the provided value against all constraint.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
Any
|
Value to be compared |
required |
Raises:
Type | Description |
---|---|
InvalidConfiguration
|
If the value is not met |
Source code in src/ASTRA/utils/parameter_validators.py
IterableMustHave
Bases: Constraint
Imposes that certain values must be inside a given iterable.
Source code in src/ASTRA/utils/parameter_validators.py
PathExists
Bases: Constraint
Imposes that a given path must exist.
Source code in src/ASTRA/utils/parameter_validators.py
ValueFromDtype
Bases: Constraint
Constraint that limits the datatype of the input.
Source code in src/ASTRA/utils/parameter_validators.py
ValueFromIterable
Bases: Constraint
Limits the possible values to be inside a list.
Source code in src/ASTRA/utils/parameter_validators.py
ValueInInterval
Bases: Constraint
Constraint that imposes the provided value to be inside a given interval.