AllConditionV1

toloka.client.project.template_builder.conditions.AllConditionV1 | Source code

AllConditionV1(
self,
conditions: Optional[Union[BaseComponent, List[BaseComponent]]] = None,
*,
hint: Optional[Any] = None,
version: Optional[str] = '1.0.0'
)

Checks that all child conditions are met.

If any of the conditions is not met, the component returns 'false'.

If you only need one out of several conditions to be met, use the condition.any component. You can also combine these components.

Parameters Description

ParametersTypeDescription
conditionsOptional[Union[BaseComponent, List[BaseComponent]]]

A set of conditions that must be met.

hintOptional[Any]

Validation error message that a Toloker will see.

Examples:

How to check several conditions.

coordinates_validation = tb.conditions.AllConditionV1(
[
tb.conditions.RequiredConditionV1(
tb.data.OutputData('performer_coordinates'),
hint="Couldn't get your coordinates. Please enable geolocation.",
),
tb.conditions.DistanceConditionV1(
tb.data.LocationData(),
tb.data.InputData('coordinates'),
500,
hint='You are too far from the destination coordinates.',
),
],
)
Toloka-Kit
OverviewGetting OAuth tokenQuick start
Recipes
Reference
toloka.client
toloka.async_client
toloka.autoquality [autoquality]
toloka.metrics
toloka.streaming