From ef8432520045c36edf4a93b4138a24232fcae52f Mon Sep 17 00:00:00 2001 From: DrhF Date: Fri, 20 Jan 2023 11:43:24 +0000 Subject: [PATCH] [Autogenerated] stub files --- src/async_client/client.pyi | 591 +++++++++++------- src/autoquality/optimizer.pyi | 3 +- src/client/__init__.pyi | 587 ++++++++++------- src/client/assignment.pyi | 5 +- src/client/collectors.pyi | 7 +- src/client/conditions.pyi | 6 +- src/client/pool/__init__.pyi | 190 +++--- src/client/pool/dynamic_overlap_config.pyi | 44 +- src/client/pool/dynamic_pricing_config.pyi | 24 +- src/client/pool/mixer_config.pyi | 75 ++- .../pool/speed_quality_balance_config.pyi | 17 +- src/client/project/localization.pyi | 5 +- .../project/template_builder/plugins.pyi | 3 +- src/client/quality_control.pyi | 5 +- src/client/task_suite.pyi | 3 +- src/client/training.pyi | 97 +-- src/metrics/metrics.pyi | 11 +- src/metrics/pool_metrics.pyi | 17 +- src/streaming/cursor.pyi | 13 +- src/streaming/pipeline.pyi | 7 +- src/streaming/storage.pyi | 3 +- 21 files changed, 1015 insertions(+), 698 deletions(-) diff --git a/src/async_client/client.pyi b/src/async_client/client.pyi index 2891641c..301d1de5 100644 --- a/src/async_client/client.pyi +++ b/src/async_client/client.pyi @@ -1,6 +1,7 @@ __all__ = [ 'AsyncTolokaClient', ] +import attr._make import datetime import decimal import pandas @@ -63,6 +64,10 @@ class AsyncTolokaClient: """ ... + def __getstate__(self): ... + + def __setstate__(self, state): ... + @classmethod def from_sync_client(cls, client: toloka.client.TolokaClient) -> 'AsyncTolokaClient': ... @@ -311,7 +316,8 @@ class AsyncTolokaClient: def get_aggregated_solutions( self, operation_id: str, - request: toloka.client.search_requests.AggregatedSolutionSearchRequest + request: toloka.client.search_requests.AggregatedSolutionSearchRequest, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.aggregation.AggregatedSolution, None]: """Finds all aggregated responses that match certain criteria. @@ -330,6 +336,7 @@ class AsyncTolokaClient: Args: operation_id: The ID of the aggregation operation. request: Search criteria. + batch_size: Returned aggregated responses limit for each request. The default batch_size is 50. The maximum allowed limit is 100,000. Yields: AggregatedSolution: The next matching aggregated response. @@ -356,7 +363,8 @@ class AsyncTolokaClient: task_id_lt: typing.Optional[str] = None, task_id_lte: typing.Optional[str] = None, task_id_gt: typing.Optional[str] = None, - task_id_gte: typing.Optional[str] = None + task_id_gte: typing.Optional[str] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.aggregation.AggregatedSolution, None]: """Finds all aggregated responses that match certain criteria. @@ -375,6 +383,7 @@ class AsyncTolokaClient: Args: operation_id: The ID of the aggregation operation. request: Search criteria. + batch_size: Returned aggregated responses limit for each request. The default batch_size is 50. The maximum allowed limit is 100,000. Yields: AggregatedSolution: The next matching aggregated response. @@ -522,7 +531,11 @@ class AsyncTolokaClient: ... @typing.overload - def get_assignments(self, request: toloka.client.search_requests.AssignmentSearchRequest) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.assignment.Assignment, None]: + def get_assignments( + self, + request: toloka.client.search_requests.AssignmentSearchRequest, + batch_size: typing.Optional[int] = None + ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.assignment.Assignment, None]: """Finds all assignments that match certain criteria. `get_assignments` returns a generator. You can iterate over all found assignments using the generator. Several requests to the Toloka server are possible while iterating. @@ -531,6 +544,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned assignments limit for each request. The default batch_size is 50. The maximum allowed batch_size is 100,000. Yields: Assignment: The next matching assignment. @@ -580,7 +594,8 @@ class AsyncTolokaClient: expired_lt: typing.Optional[datetime.datetime] = None, expired_lte: typing.Optional[datetime.datetime] = None, expired_gt: typing.Optional[datetime.datetime] = None, - expired_gte: typing.Optional[datetime.datetime] = None + expired_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.assignment.Assignment, None]: """Finds all assignments that match certain criteria. @@ -590,6 +605,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned assignments limit for each request. The default batch_size is 50. The maximum allowed batch_size is 100,000. Yields: Assignment: The next matching assignment. @@ -768,7 +784,11 @@ class AsyncTolokaClient: ... @typing.overload - def get_attachments(self, request: toloka.client.search_requests.AttachmentSearchRequest) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.attachment.Attachment, None]: + def get_attachments( + self, + request: toloka.client.search_requests.AttachmentSearchRequest, + batch_size: typing.Optional[int] = None + ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.attachment.Attachment, None]: """Finds all attachments that match certain criteria and returns their metadata. `get_attachments` returns a generator. You can iterate over all found attachments using the generator. Several requests to the Toloka server are possible while iterating. @@ -777,6 +797,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned attachments limit for each request. The maximum allowed batch_size is 100. Yields: Attachment: The next matching attachment. @@ -806,7 +827,8 @@ class AsyncTolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.attachment.Attachment, None]: """Finds all attachments that match certain criteria and returns their metadata. @@ -816,6 +838,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned attachments limit for each request. The maximum allowed batch_size is 100. Yields: Attachment: The next matching attachment. @@ -1023,7 +1046,11 @@ class AsyncTolokaClient: ... @typing.overload - def get_message_threads(self, request: toloka.client.search_requests.MessageThreadSearchRequest) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.message_thread.MessageThread, None]: + def get_message_threads( + self, + request: toloka.client.search_requests.MessageThreadSearchRequest, + batch_size: typing.Optional[int] = None + ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.message_thread.MessageThread, None]: """Finds all message threads that match certain criteria. `get_message_threads` returns a generator. You can iterate over all found message threads using the generator. Several requests to the Toloka server are possible while iterating. @@ -1032,6 +1059,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned message threads limit for each request. The default batch_size is 50. The maximum allowed batch_size is 300. Yields: MessageThread: The next matching message thread. @@ -1056,7 +1084,8 @@ class AsyncTolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.message_thread.MessageThread, None]: """Finds all message threads that match certain criteria. @@ -1066,6 +1095,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned message threads limit for each request. The default batch_size is 50. The maximum allowed batch_size is 300. Yields: MessageThread: The next matching message thread. @@ -1250,7 +1280,11 @@ class AsyncTolokaClient: ... @typing.overload - def get_projects(self, request: toloka.client.search_requests.ProjectSearchRequest) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.project.Project, None]: + def get_projects( + self, + request: toloka.client.search_requests.ProjectSearchRequest, + batch_size: typing.Optional[int] = None + ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.project.Project, None]: """Finds all projects that match certain criteria. `get_projects` returns a generator. You can iterate over all found projects using the generator. Several requests to the Toloka server are possible while iterating. @@ -1259,6 +1293,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned projects limit for each request. The default batch_size is 20. The maximum allowed batch_size is 300. Yields: Project: The next matching project. @@ -1286,7 +1321,8 @@ class AsyncTolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.project.Project, None]: """Finds all projects that match certain criteria. @@ -1296,6 +1332,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned projects limit for each request. The default batch_size is 20. The maximum allowed batch_size is 300. Yields: Project: The next matching project. @@ -1366,16 +1403,17 @@ class AsyncTolokaClient: ... async def archive_pool(self, pool_id: str) -> toloka.client.pool.Pool: - """Sends pool to archive + """Archives a pool. + + Only closed pools can be archived. - The pool must be in the status "closed". - The archived pool is not deleted. You can access it when you will need it. + You can't open archived pools, but you can [clone](toloka.client.TolokaClient.clone_pool.md) them if needed. Args: - pool_id: ID of pool that will be archived. + pool_id: The ID of the pool to be archived. Returns: - Pool: Object with updated status. + Pool: The pool with updated status. Example: >>> closed_pool = next(toloka_client.get_pools(status='CLOSED')) @@ -1385,17 +1423,17 @@ class AsyncTolokaClient: ... async def archive_pool_async(self, pool_id: str) -> typing.Optional[toloka.client.operations.PoolArchiveOperation]: - """Sends pool to archive, asynchronous version + """Archives a pool. Sends an asynchronous request to Toloka. + + Only closed pools can be archived. - The pool must be in the status "closed". - The archived pool is not deleted. You can access it when you will need it. + You can't open archived pools, but you can [clone](toloka.client.TolokaClient.clone_pool.md) them if needed. Args: - pool_id: ID of pool that will be archived. + pool_id: The ID of the pool to be archived. Returns: - PoolArchiveOperation: An operation upon completion of which you can get the pool with updated status. If - pool is already archived then None is returned + PoolArchiveOperation: An object to track the progress of the operation. If the pool is already archived then `None` is returned. Example: >>> closed_pool = next(toloka_client.get_pools(status='CLOSED')) @@ -1406,15 +1444,15 @@ class AsyncTolokaClient: ... async def close_pool(self, pool_id: str) -> toloka.client.pool.Pool: - """Stops distributing tasks from the pool + """Closes a pool. - If all tasks done, the pool will be closed automatically. + If all tasks in a pool are completed, then the pool is closed automatically. Args: - pool_id: ID of the pool that will be closed. + pool_id: The ID of the pool to be closed. Returns: - Pool: Pool object with new status. + Pool: The pool with updated status. Example: >>> open_pool = next(toloka_client.get_pools(status='OPEN')) @@ -1424,16 +1462,15 @@ class AsyncTolokaClient: ... async def close_pool_async(self, pool_id: str) -> typing.Optional[toloka.client.operations.PoolCloseOperation]: - """Stops distributing tasks from the pool, asynchronous version + """Closes a pool. Sends an asynchronous request to Toloka. - If all tasks done, the pool will be closed automatically. + If all tasks in a pool are completed, then the pool is closed automatically. Args: - pool_id: ID of the pool that will be closed. + pool_id: The ID of the pool to be closed. Returns: - Optional[PoolCloseOperation]: An operation upon completion of which you can get the pool with updated - status. If pool is already closed then None is returned. + PoolCloseOperation: An object to track the progress of the operation. If the pool is already closed then `None` is returned. Example: >>> open_pool = next(toloka_client.get_pools(status='OPEN')) @@ -1444,13 +1481,16 @@ class AsyncTolokaClient: ... async def close_pool_for_update(self, pool_id: str) -> toloka.client.pool.Pool: - """Closes pool for update + """Closes a pool that is to be updated. + + To make changes to a pool, close it before updating parameters. + If you don't open the pool after updating, it opens automatically in 15 minutes. Args: - pool_id: ID of the pool that will be closed for update. + pool_id: The ID of the pool to be closed. Returns: - Pool: Pool object with new status. + Pool: The pool with updated status. Example: >>> toloka_client.close_pool_for_update(pool_id='1') @@ -1459,14 +1499,16 @@ class AsyncTolokaClient: ... async def close_pool_for_update_async(self, pool_id: str) -> typing.Optional[toloka.client.operations.PoolCloseOperation]: - """Closes pool for update, asynchronous version + """Closes a pool that is to be updated. Sends an asynchronous request to Toloka. + + To make changes to a pool, close it before updating parameters. + If you don't open the pool after updating, it opens automatically in 15 minutes. Args: - pool_id: ID of the pool that will be closed for update. + pool_id: The ID of the pool to be closed. Returns: - Optional[PoolCloseOperation]: An operation upon completion of which you can get the pool with updated - status. If pool is already closed for update then None is returned. + PoolCloseOperation: An object to track the progress of the operation. If the pool is already closed then `None` is returned. Example: >>> close_op = toloka_client.close_pool_for_update_async(pool_id='1') @@ -1476,16 +1518,16 @@ class AsyncTolokaClient: ... async def clone_pool(self, pool_id: str) -> toloka.client.pool.Pool: - """Duplicates existing pool + """Clones an existing pool. - An empty pool with the same parameters will be created. - A new pool will be attached to the same project. + An empty pool with the same parameters is created. + The new pool is attached to the same project. Args: - pool_id: ID of the existing pool. + pool_id: The ID of the pool to be cloned. Returns: - Pool: New pool. + Pool: The new pool. Example: >>> toloka_client.clone_pool(pool_id='1') @@ -1494,47 +1536,47 @@ class AsyncTolokaClient: ... async def clone_pool_async(self, pool_id: str) -> toloka.client.operations.PoolCloneOperation: - """Duplicates existing pool, asynchronous version + """Clones an existing pool. Sends an asynchronous request to Toloka. - An empty pool with the same parameters will be created. - A new pool will be attached to the same project. + An empty pool with the same parameters is created. + The new pool is attached to the same project. Args: - pool_id: ID of the existing pool. + pool_id: The ID of the pool to be cloned. Returns: - PoolCloneOperation: An operation upon completion of which you can get the new pool. + PoolCloneOperation: An object to track the progress of the operation. Example: - >>> new_pool = toloka_client.clone_pool_async(pool_id='1') - >>> toloka_client.wait_operation(new_pool) + >>> clone_op = toloka_client.clone_pool_async(pool_id='1') + >>> toloka_client.wait_operation(clone_op) ... """ ... async def create_pool(self, pool: toloka.client.pool.Pool) -> toloka.client.pool.Pool: - """Creates a new pool + """Creates a new pool in Toloka. You can send a maximum of 20 requests of this kind per minute and 100 requests per day. Args: - pool: New Pool with set parameters. + pool: The pool to be created. Returns: - Pool: Created pool. With read-only fields. + Pool: The pool with updated read-only fields. Example: - How to create a new pool in a project. + Creating a new pool. - >>> new_pool = toloka.pool.Pool( - >>> project_id=existing_project_id, + >>> new_pool = toloka.client.Pool( + >>> project_id='1', >>> private_name='Pool 1', >>> may_contain_adult_content=False, >>> will_expire=datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(days=365), >>> reward_per_assignment=0.01, >>> assignment_max_duration_seconds=60*20, - >>> defaults=toloka.pool.Pool.Defaults(default_overlap_for_new_task_suites=3), - >>> filter=toloka.filter.Languages.in_('EN'), + >>> defaults=toloka.client.Pool.Defaults(default_overlap_for_new_task_suites=3), + >>> filter=toloka.client.filter.Languages.in_('EN'), >>> ) >>> new_pool.set_mixer_config(real_tasks_count=10, golden_tasks_count=0, training_tasks_count=0) >>> new_pool.quality_control.add_action(...) @@ -1566,17 +1608,17 @@ class AsyncTolokaClient: PoolSearchResult: Found pools and a flag showing whether there are more matching pools exceeding the limit. Examples: - Find all pools in all projects. + Finding all pools in all projects. >>> pools = toloka_client.find_pools() ... - Find all open pools in all projects. + Finding all open pools in all projects. >>> pools = toloka_client.find_pools(status='OPEN') ... - Find open pools in a specific project. + Finding open pools in a specific project. >>> pools = toloka_client.find_pools(status='OPEN', project_id='1') ... @@ -1620,17 +1662,17 @@ class AsyncTolokaClient: PoolSearchResult: Found pools and a flag showing whether there are more matching pools exceeding the limit. Examples: - Find all pools in all projects. + Finding all pools in all projects. >>> pools = toloka_client.find_pools() ... - Find all open pools in all projects. + Finding all open pools in all projects. >>> pools = toloka_client.find_pools(status='OPEN') ... - Find open pools in a specific project. + Finding open pools in a specific project. >>> pools = toloka_client.find_pools(status='OPEN', project_id='1') ... @@ -1640,10 +1682,10 @@ class AsyncTolokaClient: ... async def get_pool(self, pool_id: str) -> toloka.client.pool.Pool: - """Reads one specific pool + """Gets pool data from Toloka. Args: - pool_id: ID of the pool. + pool_id: The ID of the pool. Returns: Pool: The pool. @@ -1655,7 +1697,11 @@ class AsyncTolokaClient: ... @typing.overload - def get_pools(self, request: toloka.client.search_requests.PoolSearchRequest) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.pool.Pool, None]: + def get_pools( + self, + request: toloka.client.search_requests.PoolSearchRequest, + batch_size: typing.Optional[int] = None + ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.pool.Pool, None]: """Finds all pools that match certain criteria. `get_pools` returns a generator. You can iterate over all found pools using the generator. Several requests to the Toloka server are possible while iterating. @@ -1664,6 +1710,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned pools limit for each request. The default batch_size is 20. The maximum allowed batch_size is 300. Yields: Pool: The next matching pool. @@ -1697,7 +1744,8 @@ class AsyncTolokaClient: last_started_lt: typing.Optional[datetime.datetime] = None, last_started_lte: typing.Optional[datetime.datetime] = None, last_started_gt: typing.Optional[datetime.datetime] = None, - last_started_gte: typing.Optional[datetime.datetime] = None + last_started_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.pool.Pool, None]: """Finds all pools that match certain criteria. @@ -1707,6 +1755,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned pools limit for each request. The default batch_size is 20. The maximum allowed batch_size is 300. Yields: Pool: The next matching pool. @@ -1725,18 +1774,18 @@ class AsyncTolokaClient: ... async def open_pool(self, pool_id: str) -> toloka.client.pool.Pool: - """Starts distributing tasks from the pool + """Opens a pool. - Tolokers will see your tasks only after that call. + After opening the pool, tasks can be assigned to Tolokers. Args: - pool_id: ID of the pool that will be started. + pool_id: The ID of the pool. Returns: - Pool: Pool object with new status. + Pool: The pool with updated status. Example: - Open the pool for Tolokers. + Opening a pool. >>> toloka_client.open_pool(pool_id='1') ... @@ -1744,22 +1793,21 @@ class AsyncTolokaClient: ... async def open_pool_async(self, pool_id: str) -> typing.Optional[toloka.client.operations.PoolOpenOperation]: - """Starts distributing tasks from the pool, asynchronous version + """Opens a pool. Sends an asynchronous request to Toloka. - Tolokers will see your tasks only after that call. + After opening the pool, tasks can be assigned to Tolokers. Args: - pool_id: ID of the pool that will be started. + pool_id: The ID of the pool. Returns: - PoolOpenOperation: An operation upon completion of which you can get the pool with new status. If pool is - already opened then None is returned. + PoolOpenOperation: An object to track the progress of the operation. If the pool is already opened then `None` is returned. Example: - Open the pool for Tolokers. + Opening a pool. - >>> open_pool = toloka_client.open_pool(pool_id='1') - >>> toloka_client.wait_operation(open_pool) + >>> open_op = toloka_client.open_pool(pool_id='1') + >>> toloka_client.wait_operation(open_op) ... """ ... @@ -1770,17 +1818,19 @@ class AsyncTolokaClient: pool_id: str, request: toloka.client.pool.PoolPatchRequest ) -> toloka.client.pool.Pool: - """Changes the priority of the pool issue + """Changes pool parameters in Toloka. + + If a parameter is not specified in the `patch_pool` method, then it is left unchanged in Toloka. Args: - pool_id: ID of the pool that will be patched. - request: New priority of the pool. + pool_id: The ID of the pool to be changed. + request: New pool parameters. Returns: - Pool: Object with updated priority. + Pool: The pool with updated parameters. Example: - Set the highest priority to a specified pool. + Changing priority of a pool. >>> toloka_client.patch_pool(pool_id='1', priority=100) ... @@ -1793,17 +1843,19 @@ class AsyncTolokaClient: pool_id: str, priority: typing.Optional[int] = None ) -> toloka.client.pool.Pool: - """Changes the priority of the pool issue + """Changes pool parameters in Toloka. + + If a parameter is not specified in the `patch_pool` method, then it is left unchanged in Toloka. Args: - pool_id: ID of the pool that will be patched. - request: New priority of the pool. + pool_id: The ID of the pool to be changed. + request: New pool parameters. Returns: - Pool: Object with updated priority. + Pool: The pool with updated parameters. Example: - Set the highest priority to a specified pool. + Changing priority of a pool. >>> toloka_client.patch_pool(pool_id='1', priority=100) ... @@ -1815,32 +1867,35 @@ class AsyncTolokaClient: pool_id: str, pool: toloka.client.pool.Pool ) -> toloka.client.pool.Pool: - """Makes changes to the pool + """Updates all pool parameters in Toloka. Args: - pool_id: ID of the pool that will be changed. - pool: A pool object with all the fields: those that will be updated and those that will not. + pool_id: The ID of the pool to be updated. + pool: The pool with new parameters. Returns: - Pool: Pool object with all fields. + Pool: The pool with updated parameters. Example: - >>> updated_pool = toloka_client.update_pool(pool_id=old_pool_id, pool=new_pool_object) + >>> updated_pool = toloka_client.get_pool(pool_id='1') + >>> updated_pool.will_expire = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(days=30) + >>> toloka_client.update_pool(pool_id=updated_pool.id, pool=updated_pool) ... """ ... async def archive_training(self, training_id: str) -> toloka.client.training.Training: - """Sends training to archive + """Archives a training. + + Only closed trainings can be archived. - The training must be in the status "closed". - The archived training is not deleted. You can access it when you will need it. + You can access archived trainings later. Args: - training_id: ID of training that will be archived. + training_id: The ID of the training to be archived. Returns: - Training: Object with updated status. + Training: The training with updated status. Example: >>> closed_training = next(toloka_client.get_trainings(status='CLOSED')) @@ -1850,17 +1905,17 @@ class AsyncTolokaClient: ... async def archive_training_async(self, training_id: str) -> typing.Optional[toloka.client.operations.TrainingArchiveOperation]: - """Sends training to archive, asynchronous version + """Archives a training. Sends an asynchronous request to Toloka. - The training must be in the status "closed". - The archived training is not deleted. You can access it when you will need it. + Only closed trainings can be archived. + + You can access archived trainings later. Args: - training_id: ID of training that will be archived. + training_id: The ID of the training to be archived. Returns: - TrainingArchiveOperation: An operation upon completion of which you can get the training with updated - status. If pool is already archived then None is returned. + TrainingArchiveOperation: An object to track the progress of the operation. If the training is already archived then `None` is returned. Example: >>> closed_training = next(toloka_client.find_trainings(status='CLOSED')) @@ -1871,50 +1926,53 @@ class AsyncTolokaClient: ... async def close_training(self, training_id: str) -> toloka.client.training.Training: - """Stops distributing tasks from the training + """Closes a training. + + Tasks from closed trainings are not assigned to Tolokers. Args: - training_id: ID of the training that will be closed. + training_id: The ID of the training to be closed. Returns: - Training: Training object with new status. + Training: The training with updated status. Example: - >>> open_training = next(toloka_client.get_trainings(status='OPEN')) - >>> toloka_client.close_training(training_id=open_training.id) + >>> opened_training = next(toloka_client.get_trainings(status='OPEN')) + >>> toloka_client.close_training(training_id=opened_training.id) ... """ ... async def close_training_async(self, training_id: str) -> typing.Optional[toloka.client.operations.TrainingCloseOperation]: - """Stops distributing tasks from the training, asynchronous version + """Closes a training. Sends an asynchronous request to Toloka. + + Tasks from closed trainings are not assigned to Tolokers. Args: - training_id: ID of the training that will be closed. + training_id: The ID of the training to be closed. Returns: - TrainingCloseOperation: An operation upon completion of which you can get the training with updated status. - If training is already closed then None is returned. + TrainingCloseOperation: An object to track the progress of the operation. If the training is already closed then `None` is returned. Example: - >>> open_training = next(toloka_client.get_trainings(status='OPEN')) - >>> close_training = toloka_client.close_training_async(training_id=open_training.id) - >>> toloka_client.wait_operation(close_training) + >>> opened_training = next(toloka_client.get_trainings(status='OPEN')) + >>> close_op = toloka_client.close_training_async(training_id=opened_training.id) + >>> toloka_client.wait_operation(close_op) ... """ ... async def clone_training(self, training_id: str) -> toloka.client.training.Training: - """Duplicates existing training + """Clones an existing training. - An empty training with the same parameters will be created. - A new training will be attached to the same project. + An empty training with the same parameters is created. + The new training is attached to the same project. Args: - training_id: ID of the existing training. + training_id: The ID of the training to be cloned. Returns: - Training: New training. + Training: The new training. Example: >>> toloka_client.clone_training(training_id='1') @@ -1923,41 +1981,41 @@ class AsyncTolokaClient: ... async def clone_training_async(self, training_id: str) -> toloka.client.operations.TrainingCloneOperation: - """Duplicates existing training, asynchronous version + """Clones an existing training. Sends an asynchronous request to Toloka. - An empty training with the same parameters will be created. - A new training will be attached to the same project. + An empty training with the same parameters is created. + The new training is attached to the same project. Args: - training_id: ID of the existing training. + training_id: The ID of the training to be cloned. Returns: - TrainingCloneOperation: An operation upon completion of which you can get the new training. + TrainingCloneOperation: An object to track the progress of the operation. Example: - >>> clone_training = toloka_client.clone_training_async(training_id='1') - >>> toloka_client.wait_operation(clone_training) + >>> clone_op = toloka_client.clone_training_async(training_id='1') + >>> toloka_client.wait_operation(clone_op) ... """ ... async def create_training(self, training: toloka.client.training.Training) -> toloka.client.training.Training: - """Creates a new training + """Creates a new training in Toloka. Args: - training: New Training with set parameters. + training: A training to be created. Returns: - Training: Created training. With read-only fields. + Training: Created training with initialized read-only fields. Example: - How to create a new training in a project. + Creating a new training. - >>> new_training = toloka.training.Training( - >>> project_id=existing_project_id, + >>> new_training = toloka.client.Training( + >>> project_id='1', >>> private_name='Some training in my project', >>> may_contain_adult_content=True, - >>> assignment_max_duration_seconds=10000, + >>> assignment_max_duration_seconds=60*5, >>> mix_tasks_in_creation_order=True, >>> shuffle_tasks_in_task_suite=True, >>> training_tasks_in_task_suite_count=3, @@ -1979,37 +2037,37 @@ class AsyncTolokaClient: sort: typing.Union[typing.List[str], toloka.client.search_requests.TrainingSortItems, None] = None, limit: typing.Optional[int] = None ) -> toloka.client.search_results.TrainingSearchResult: - """Finds training pools that match certain criteria. + """Finds trainings that match certain criteria. - The number of returned pools is limited. To find remaining pools call `find_trainings` with updated search criteria. + The number of returned trainings is limited. To find remaining trainings call `find_trainings` with updated search criteria. - To iterate over all matching training pools you may use the [get_trainings](toloka.client.TolokaClient.get_trainings.md) method. + To iterate over all matching trainings you may use the [get_trainings](toloka.client.TolokaClient.get_trainings.md) method. Args: request: Search criteria. sort: Sorting options. Default: `None`. - limit: Returned training pools limit. The maximum allowed limit is 300. + limit: Returned trainings limit. The maximum allowed limit is 300. Returns: - TrainingSearchResult: Found training pools and a flag showing whether there are more matching pools exceeding the limit. + TrainingSearchResult: Found trainings and a flag showing whether there are more matching trainings exceeding the limit. Examples: - Find all training pools in all projects. + Finding all trainings in all projects. - >>> pools = toloka_client.find_trainings() + >>> trainings = toloka_client.find_trainings() ... - Find all open training pools in all projects. + Finding all opened trainings in all projects. - >>> pools = toloka_client.find_trainings(status='OPEN') + >>> trainings = toloka_client.find_trainings(status='OPEN') ... - Find all open training pools in a specific project. + Finding all opened trainings in a specific project. - >>> pools = toloka_client.find_trainings(status='OPEN', project_id='1') + >>> trainings = toloka_client.find_trainings(status='OPEN', project_id='1') ... - If there are pools exceeding the `limit`, then `pools.has_more` is set to `True`. + If there are trainings exceeding the `limit`, then `trainings.has_more` is set to `True`. """ ... @@ -2033,73 +2091,78 @@ class AsyncTolokaClient: sort: typing.Union[typing.List[str], toloka.client.search_requests.TrainingSortItems, None] = None, limit: typing.Optional[int] = None ) -> toloka.client.search_results.TrainingSearchResult: - """Finds training pools that match certain criteria. + """Finds trainings that match certain criteria. - The number of returned pools is limited. To find remaining pools call `find_trainings` with updated search criteria. + The number of returned trainings is limited. To find remaining trainings call `find_trainings` with updated search criteria. - To iterate over all matching training pools you may use the [get_trainings](toloka.client.TolokaClient.get_trainings.md) method. + To iterate over all matching trainings you may use the [get_trainings](toloka.client.TolokaClient.get_trainings.md) method. Args: request: Search criteria. sort: Sorting options. Default: `None`. - limit: Returned training pools limit. The maximum allowed limit is 300. + limit: Returned trainings limit. The maximum allowed limit is 300. Returns: - TrainingSearchResult: Found training pools and a flag showing whether there are more matching pools exceeding the limit. + TrainingSearchResult: Found trainings and a flag showing whether there are more matching trainings exceeding the limit. Examples: - Find all training pools in all projects. + Finding all trainings in all projects. - >>> pools = toloka_client.find_trainings() + >>> trainings = toloka_client.find_trainings() ... - Find all open training pools in all projects. + Finding all opened trainings in all projects. - >>> pools = toloka_client.find_trainings(status='OPEN') + >>> trainings = toloka_client.find_trainings(status='OPEN') ... - Find all open training pools in a specific project. + Finding all opened trainings in a specific project. - >>> pools = toloka_client.find_trainings(status='OPEN', project_id='1') + >>> trainings = toloka_client.find_trainings(status='OPEN', project_id='1') ... - If there are pools exceeding the `limit`, then `pools.has_more` is set to `True`. + If there are trainings exceeding the `limit`, then `trainings.has_more` is set to `True`. """ ... async def get_training(self, training_id: str) -> toloka.client.training.Training: - """Reads one specific training + """Gets information about a training from Toloka. Args: - training_id: ID of the training. + training_id: The ID of the training. Returns: Training: The training. Example: - >>> toloka_client.get_training(training_id='1') + >>> t = toloka_client.get_training(training_id='1') ... """ ... @typing.overload - def get_trainings(self, request: toloka.client.search_requests.TrainingSearchRequest) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.training.Training, None]: - """Finds all training pools that match certain criteria. + def get_trainings( + self, + request: toloka.client.search_requests.TrainingSearchRequest, + batch_size: typing.Optional[int] = None + ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.training.Training, None]: + """Finds all trainings that match certain criteria. - `get_trainings` returns a generator. You can iterate over all found training pools using the generator. Several requests to the Toloka server are possible while iterating. + `get_trainings` returns a generator. You can iterate over all found trainings using the generator. Several requests to the Toloka server are possible while iterating. - If you need to sort training pools use the [find_trainings](toloka.client.TolokaClient.find_trainings.md) method. + If you need to sort trainings use the [find_trainings](toloka.client.TolokaClient.find_trainings.md) method. Args: request: Search criteria. + batch_size: Returned trainings limit for each request. The maximum allowed batch_size is 300. Yields: - Training: The next matching training pool. + Training: The next matching training. Example: - How to get all training pools in a project. + Getting all trainings in a project. - >>> trainings = toloka_client.get_trainings(project_id=project_id) + >>> trainings = toloka_client.get_trainings(project_id='1') ... """ ... @@ -2120,39 +2183,43 @@ class AsyncTolokaClient: last_started_lt: typing.Optional[datetime.datetime] = None, last_started_lte: typing.Optional[datetime.datetime] = None, last_started_gt: typing.Optional[datetime.datetime] = None, - last_started_gte: typing.Optional[datetime.datetime] = None + last_started_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.training.Training, None]: - """Finds all training pools that match certain criteria. + """Finds all trainings that match certain criteria. - `get_trainings` returns a generator. You can iterate over all found training pools using the generator. Several requests to the Toloka server are possible while iterating. + `get_trainings` returns a generator. You can iterate over all found trainings using the generator. Several requests to the Toloka server are possible while iterating. - If you need to sort training pools use the [find_trainings](toloka.client.TolokaClient.find_trainings.md) method. + If you need to sort trainings use the [find_trainings](toloka.client.TolokaClient.find_trainings.md) method. Args: request: Search criteria. + batch_size: Returned trainings limit for each request. The maximum allowed batch_size is 300. Yields: - Training: The next matching training pool. + Training: The next matching training. Example: - How to get all training pools in a project. + Getting all trainings in a project. - >>> trainings = toloka_client.get_trainings(project_id=project_id) + >>> trainings = toloka_client.get_trainings(project_id='1') ... """ ... async def open_training(self, training_id: str) -> toloka.client.training.Training: - """Starts distributing tasks from the training + """Opens a training. + + Tasks from opened trainings can be assigned to Tolokers. Args: - training_id: ID of the training that will be started. + training_id: The ID of the training. Returns: - Training: Training object with new status. + Training: The training with updated status. Example: - Open the training for Tolokers. + Opening a training. >>> toloka_client.open_training(training_id='1') ... @@ -2160,20 +2227,22 @@ class AsyncTolokaClient: ... async def open_training_async(self, training_id: str) -> typing.Optional[toloka.client.operations.TrainingOpenOperation]: - """Starts distributing tasks from the training, asynchronous version + """Opens a training. Sends an asynchronous request to Toloka. + + Tasks from opened trainings can be assigned to Tolokers. Args: - training_id: ID of the training that will be started. + training_id: The ID of the training. Returns: - TrainingOpenOperation: An operation upon completion of which you can get the training with new status. If - training is already opened then None is returned. + TrainingOpenOperation: An object to track the progress of the operation. + If the training is already opened then `None` is returned. Example: - Open the training for Tolokers. + Opening a training. - >>> open_training = toloka_client.open_training_async(training_id='1') - >>> toloka_client.wait_operation(open_training) + >>> open_op = toloka_client.open_training_async(training_id='1') + >>> toloka_client.wait_operation(open_op) ... """ ... @@ -2183,19 +2252,21 @@ class AsyncTolokaClient: training_id: str, training: toloka.client.training.Training ) -> toloka.client.training.Training: - """Makes changes to the training + """Updates parameters of a training in Toloka. Args: - training_id: ID of the training that will be changed. - training: A training object with all the fields: those that will be updated and those that will not. + training_id: The ID of the training to be updated. + training: A training object with new parameter values. Returns: - Training: Training object with all fields. + Training: The updated training. Example: - If you want to update any configurations of the existing training. + The example shows how to set new time limit in a training. - >>> updated_training = toloka_client.update_training(training_id=old_training_id, training=new_training_object) + >>> updated_training = toloka_client.get_training(training_id='1') + >>> updated_training.assignment_max_duration_seconds = 600 + >>> toloka_client.update_training(training_id=updated_training.id, training=updated_training) ... """ ... @@ -2347,7 +2418,11 @@ class AsyncTolokaClient: ... @typing.overload - def get_skills(self, request: toloka.client.search_requests.SkillSearchRequest) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.skill.Skill, None]: + def get_skills( + self, + request: toloka.client.search_requests.SkillSearchRequest, + batch_size: typing.Optional[int] = None + ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.skill.Skill, None]: """Finds all skills that match certain criteria. `get_skills` returns a generator. You can iterate over all found skills using the generator. Several requests to the Toloka server are possible while iterating. @@ -2356,6 +2431,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned skills limit for each request. The maximum allowed batch_size is 100. Yields: Skill: The next matching skill. @@ -2383,7 +2459,8 @@ class AsyncTolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.skill.Skill, None]: """Finds all skills that match certain criteria. @@ -2393,6 +2470,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned skills limit for each request. The maximum allowed batch_size is 100. Yields: Skill: The next matching skill. @@ -2791,7 +2869,11 @@ class AsyncTolokaClient: ... @typing.overload - def get_tasks(self, request: toloka.client.search_requests.TaskSearchRequest) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.task.Task, None]: + def get_tasks( + self, + request: toloka.client.search_requests.TaskSearchRequest, + batch_size: typing.Optional[int] = None + ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.task.Task, None]: """Finds all tasks that match certain criteria. `get_tasks` returns a generator. You can iterate over all found tasks using the generator. Several requests to the Toloka server are possible while iterating. @@ -2800,6 +2882,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned tasks limit for each request. The default batch_size is 50. The maximum allowed batch_size is 100,000. Yields: Task: The next matching task. @@ -2828,7 +2911,8 @@ class AsyncTolokaClient: overlap_lt: typing.Optional[int] = None, overlap_lte: typing.Optional[int] = None, overlap_gt: typing.Optional[int] = None, - overlap_gte: typing.Optional[int] = None + overlap_gte: typing.Optional[int] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.task.Task, None]: """Finds all tasks that match certain criteria. @@ -2838,6 +2922,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned tasks limit for each request. The default batch_size is 50. The maximum allowed batch_size is 100,000. Yields: Task: The next matching task. @@ -3290,7 +3375,11 @@ class AsyncTolokaClient: ... @typing.overload - def get_task_suites(self, request: toloka.client.search_requests.TaskSuiteSearchRequest) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.task_suite.TaskSuite, None]: + def get_task_suites( + self, + request: toloka.client.search_requests.TaskSuiteSearchRequest, + batch_size: typing.Optional[int] = None + ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.task_suite.TaskSuite, None]: """Finds all task suites that match certain criteria. `get_task_suites` returns a generator. You can iterate over all found task suites using the generator. Several requests to the Toloka server are possible while iterating. @@ -3299,6 +3388,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned task suites limit for each request. The default batch_size is 50. The maximum allowed batch_size is 100,000. Yields: TaskSuite: The next matching task suite. @@ -3328,7 +3418,8 @@ class AsyncTolokaClient: overlap_lt: typing.Optional[int] = None, overlap_lte: typing.Optional[int] = None, overlap_gt: typing.Optional[int] = None, - overlap_gte: typing.Optional[int] = None + overlap_gte: typing.Optional[int] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.task_suite.TaskSuite, None]: """Finds all task suites that match certain criteria. @@ -3338,6 +3429,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned task suites limit for each request. The default batch_size is 50. The maximum allowed batch_size is 100,000. Yields: TaskSuite: The next matching task suite. @@ -3529,7 +3621,11 @@ class AsyncTolokaClient: ... @typing.overload - def get_operations(self, request: toloka.client.search_requests.OperationSearchRequest) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.operations.Operation, None]: + def get_operations( + self, + request: toloka.client.search_requests.OperationSearchRequest, + batch_size: typing.Optional[int] = None + ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.operations.Operation, None]: """Finds all operations that match certain rules and returns them in an iterable object `get_operations` returns a generator. You can iterate over all found operations using the generator. Several requests to the Toloka server are possible while iterating. @@ -3538,6 +3634,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned operations limit for each request. The default batch_size is 50. The maximum allowed batch_size is 500. Yields: Operation: The next matching operations. @@ -3564,7 +3661,8 @@ class AsyncTolokaClient: finished_lt: typing.Optional[datetime.datetime] = None, finished_lte: typing.Optional[datetime.datetime] = None, finished_gt: typing.Optional[datetime.datetime] = None, - finished_gte: typing.Optional[datetime.datetime] = None + finished_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.operations.Operation, None]: """Finds all operations that match certain rules and returns them in an iterable object @@ -3574,6 +3672,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned operations limit for each request. The default batch_size is 50. The maximum allowed batch_size is 500. Yields: Operation: The next matching operations. @@ -3983,7 +4082,11 @@ class AsyncTolokaClient: ... @typing.overload - def get_user_bonuses(self, request: toloka.client.search_requests.UserBonusSearchRequest) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.user_bonus.UserBonus, None]: + def get_user_bonuses( + self, + request: toloka.client.search_requests.UserBonusSearchRequest, + batch_size: typing.Optional[int] = None + ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.user_bonus.UserBonus, None]: """Finds all Tolokers' rewards that match certain rules and returns them in an iterable object `get_user_bonuses` returns a generator. You can iterate over all found Tolokers' rewards using the generator. Several requests to the Toloka server are possible while iterating. @@ -3992,6 +4095,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned Tolokers' rewards limit for each request. The maximum allowed batch_size is 300. Yields: UserBonus: The next matching Toloker's reward. @@ -4015,7 +4119,8 @@ class AsyncTolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.user_bonus.UserBonus, None]: """Finds all Tolokers' rewards that match certain rules and returns them in an iterable object @@ -4025,6 +4130,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned Tolokers' rewards limit for each request. The maximum allowed batch_size is 300. Yields: UserBonus: The next matching Toloker's reward. @@ -4120,7 +4226,11 @@ class AsyncTolokaClient: ... @typing.overload - def get_user_restrictions(self, request: toloka.client.search_requests.UserRestrictionSearchRequest) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.user_restriction.UserRestriction, None]: + def get_user_restrictions( + self, + request: toloka.client.search_requests.UserRestrictionSearchRequest, + batch_size: typing.Optional[int] = None + ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.user_restriction.UserRestriction, None]: """Finds all Toloker restrictions that match certain criteria. `get_user_restrictions` returns a generator. You can iterate over all found Toloker restrictions using the generator. Several requests to the Toloka server are possible while iterating. @@ -4129,6 +4239,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned Toloker restrictions limit for each request. The maximum allowed batch_size is 500. Yields: UserRestriction: The next matching Toloker restriction. @@ -4153,7 +4264,8 @@ class AsyncTolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.user_restriction.UserRestriction, None]: """Finds all Toloker restrictions that match certain criteria. @@ -4163,6 +4275,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned Toloker restrictions limit for each request. The maximum allowed batch_size is 500. Yields: UserRestriction: The next matching Toloker restriction. @@ -4320,7 +4433,11 @@ class AsyncTolokaClient: ... @typing.overload - def get_user_skills(self, request: toloka.client.search_requests.UserSkillSearchRequest) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.user_skill.UserSkill, None]: + def get_user_skills( + self, + request: toloka.client.search_requests.UserSkillSearchRequest, + batch_size: typing.Optional[int] = None + ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.user_skill.UserSkill, None]: """Finds all Toloker's skills that match certain criteria. `get_user_skills` returns a generator. You can iterate over all found Toloker's skills using the generator. Several requests to the Toloka server are possible while iterating. @@ -4329,6 +4446,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned skills limit for each request. The maximum allowed batch_size is 1000. Yields: UserSkill: The next matching Toloker's skill. @@ -4355,7 +4473,8 @@ class AsyncTolokaClient: modified_lt: typing.Optional[datetime.datetime] = None, modified_lte: typing.Optional[datetime.datetime] = None, modified_gt: typing.Optional[datetime.datetime] = None, - modified_gte: typing.Optional[datetime.datetime] = None + modified_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.user_skill.UserSkill, None]: """Finds all Toloker's skills that match certain criteria. @@ -4365,6 +4484,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned skills limit for each request. The maximum allowed batch_size is 1000. Yields: UserSkill: The next matching Toloker's skill. @@ -4540,7 +4660,11 @@ class AsyncTolokaClient: ... @typing.overload - def get_webhook_subscriptions(self, request: toloka.client.search_requests.WebhookSubscriptionSearchRequest) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.webhook_subscription.WebhookSubscription, None]: + def get_webhook_subscriptions( + self, + request: toloka.client.search_requests.WebhookSubscriptionSearchRequest, + batch_size: typing.Optional[int] = None + ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.webhook_subscription.WebhookSubscription, None]: """Finds all webhook subscriptions that match certain criteria. `get_webhook_subscriptions` returns a generator. You can iterate over all found webhook subscriptions using the generator. Several requests to the Toloka server are possible while iterating. @@ -4549,6 +4673,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned webhook subscriptions limit for each request. The maximum allowed batch_size is 300. Yields: WebhookSubscription: The next matching webhook subscription. @@ -4567,7 +4692,8 @@ class AsyncTolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.webhook_subscription.WebhookSubscription, None]: """Finds all webhook subscriptions that match certain criteria. @@ -4577,6 +4703,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned webhook subscriptions limit for each request. The maximum allowed batch_size is 300. Yields: WebhookSubscription: The next matching webhook subscription. @@ -4644,11 +4771,11 @@ class AsyncTolokaClient: self, pool_id: str, *, - status: typing.Optional[typing.List[toloka.client.assignment.GetAssignmentsTsvParameters.Status]] = ..., + status: typing.Optional[typing.List[toloka.client.assignment.GetAssignmentsTsvParameters.Status]] = attr._make._Nothing.NOTHING, start_time_from: typing.Optional[datetime.datetime] = None, start_time_to: typing.Optional[datetime.datetime] = None, exclude_banned: typing.Optional[bool] = None, - field: typing.Optional[typing.List[toloka.client.assignment.GetAssignmentsTsvParameters.Field]] = ... + field: typing.Optional[typing.List[toloka.client.assignment.GetAssignmentsTsvParameters.Field]] = attr._make._Nothing.NOTHING ) -> pandas.DataFrame: """Downloads assignments as pandas.DataFrame. @@ -4756,7 +4883,11 @@ class AsyncTolokaClient: ... @typing.overload - def get_app_projects(self, request: toloka.client.search_requests.AppProjectSearchRequest) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.app.AppProject, None]: + def get_app_projects( + self, + request: toloka.client.search_requests.AppProjectSearchRequest, + batch_size: typing.Optional[int] = None + ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.app.AppProject, None]: """Finds all App projects that match certain criteria. `get_app_projects` returns a generator. You can iterate over all found projects using the generator. Several requests to the Toloka server are possible while iterating. @@ -4765,6 +4896,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned projects limit for each request. The maximum batch_size is 5000. Yields: AppProject: The next matching App project. @@ -4791,7 +4923,8 @@ class AsyncTolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.app.AppProject, None]: """Finds all App projects that match certain criteria. @@ -4801,6 +4934,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned projects limit for each request. The maximum batch_size is 5000. Yields: AppProject: The next matching App project. @@ -4907,7 +5041,11 @@ class AsyncTolokaClient: ... @typing.overload - def get_apps(self, request: toloka.client.search_requests.AppSearchRequest) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.app.App, None]: + def get_apps( + self, + request: toloka.client.search_requests.AppSearchRequest, + batch_size: typing.Optional[int] = None + ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.app.App, None]: """Finds all App solutions that match certain criteria. `get_apps` returns a generator. You can iterate over all found solutions using the generator. Several requests to the Toloka server are possible while iterating. @@ -4916,6 +5054,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned solutions limit for each request. The maximum allowed batch_size is 1000. Yields: App: The next matching solution. @@ -4930,7 +5069,8 @@ class AsyncTolokaClient: id_lt: typing.Optional[str] = None, id_lte: typing.Optional[str] = None, id_gt: typing.Optional[str] = None, - id_gte: typing.Optional[str] = None + id_gte: typing.Optional[str] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.app.App, None]: """Finds all App solutions that match certain criteria. @@ -4940,6 +5080,7 @@ class AsyncTolokaClient: Args: request: Search criteria. + batch_size: Returned solutions limit for each request. The maximum allowed batch_size is 1000. Yields: App: The next matching solution. @@ -5030,7 +5171,8 @@ class AsyncTolokaClient: def get_app_items( self, app_project_id: str, - request: toloka.client.search_requests.AppItemSearchRequest + request: toloka.client.search_requests.AppItemSearchRequest, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.app.AppItem, None]: """Finds all App task items that match certain criteria in an App project. @@ -5041,6 +5183,7 @@ class AsyncTolokaClient: Args: app_project_id: The ID of the App project. request: Search criteria. + batch_size: Returned items limit for each request. The maximum allowed batch_size is 1000. Yields: AppItem: The next matching item. @@ -5065,7 +5208,8 @@ class AsyncTolokaClient: finished_lt: typing.Optional[datetime.datetime] = None, finished_lte: typing.Optional[datetime.datetime] = None, finished_gt: typing.Optional[datetime.datetime] = None, - finished_gte: typing.Optional[datetime.datetime] = None + finished_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.app.AppItem, None]: """Finds all App task items that match certain criteria in an App project. @@ -5076,6 +5220,7 @@ class AsyncTolokaClient: Args: app_project_id: The ID of the App project. request: Search criteria. + batch_size: Returned items limit for each request. The maximum allowed batch_size is 1000. Yields: AppItem: The next matching item. @@ -5231,7 +5376,8 @@ class AsyncTolokaClient: def get_app_batches( self, app_project_id: str, - request: toloka.client.search_requests.AppBatchSearchRequest + request: toloka.client.search_requests.AppBatchSearchRequest, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.app.AppBatch, None]: """Finds all batches that match certain criteria in an App project. @@ -5242,6 +5388,7 @@ class AsyncTolokaClient: Args: app_project_id: The ID of the App project. request: Search criteria. + batch_size: Returned app batches limit for each request. The maximum allowed batch_size is 1000. Yields: AppBatch: The next matching batch. @@ -5265,7 +5412,8 @@ class AsyncTolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.app.AppBatch, None]: """Finds all batches that match certain criteria in an App project. @@ -5276,6 +5424,7 @@ class AsyncTolokaClient: Args: app_project_id: The ID of the App project. request: Search criteria. + batch_size: Returned app batches limit for each request. The maximum allowed batch_size is 1000. Yields: AppBatch: The next matching batch. diff --git a/src/autoquality/optimizer.pyi b/src/autoquality/optimizer.pyi index 82502289..e1bacc4d 100644 --- a/src/autoquality/optimizer.pyi +++ b/src/autoquality/optimizer.pyi @@ -2,6 +2,7 @@ __all__ = [ 'AutoQuality', 'DEFAULT_DISTRIBUTIONS', ] +import attr._make import pandas import toloka.autoquality.scoring import toloka.client @@ -85,7 +86,7 @@ class AutoQuality: exam_skill_id: typing.Optional[str] = None, label_field: str = 'label', n_iter: int = 10, - parameter_distributions: typing.Dict = ..., + parameter_distributions: typing.Dict = attr._make._Nothing.NOTHING, score_func: typing.Callable = toloka.autoquality.scoring.default_calc_scores, ranking_func: typing.Callable = toloka.autoquality.scoring.default_calc_ranks, create_autoquality_pool_func: typing.Callable = _create_autoquality_pool_default diff --git a/src/client/__init__.pyi b/src/client/__init__.pyi index a566aa38..fb106420 100644 --- a/src/client/__init__.pyi +++ b/src/client/__init__.pyi @@ -67,6 +67,7 @@ __all__ = [ 'AppBatch', 'AppBatchCreateRequest', ] +import attr._make import datetime import decimal import enum @@ -504,7 +505,8 @@ class TolokaClient: def get_aggregated_solutions( self, operation_id: str, - request: toloka.client.search_requests.AggregatedSolutionSearchRequest + request: toloka.client.search_requests.AggregatedSolutionSearchRequest, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.aggregation.AggregatedSolution, None, None]: """Finds all aggregated responses that match certain criteria. @@ -523,6 +525,7 @@ class TolokaClient: Args: operation_id: The ID of the aggregation operation. request: Search criteria. + batch_size: Returned aggregated responses limit for each request. The default batch_size is 50. The maximum allowed limit is 100,000. Yields: AggregatedSolution: The next matching aggregated response. @@ -549,7 +552,8 @@ class TolokaClient: task_id_lt: typing.Optional[str] = None, task_id_lte: typing.Optional[str] = None, task_id_gt: typing.Optional[str] = None, - task_id_gte: typing.Optional[str] = None + task_id_gte: typing.Optional[str] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.aggregation.AggregatedSolution, None, None]: """Finds all aggregated responses that match certain criteria. @@ -568,6 +572,7 @@ class TolokaClient: Args: operation_id: The ID of the aggregation operation. request: Search criteria. + batch_size: Returned aggregated responses limit for each request. The default batch_size is 50. The maximum allowed limit is 100,000. Yields: AggregatedSolution: The next matching aggregated response. @@ -715,7 +720,11 @@ class TolokaClient: ... @typing.overload - def get_assignments(self, request: toloka.client.search_requests.AssignmentSearchRequest) -> typing.Generator[toloka.client.assignment.Assignment, None, None]: + def get_assignments( + self, + request: toloka.client.search_requests.AssignmentSearchRequest, + batch_size: typing.Optional[int] = None + ) -> typing.Generator[toloka.client.assignment.Assignment, None, None]: """Finds all assignments that match certain criteria. `get_assignments` returns a generator. You can iterate over all found assignments using the generator. Several requests to the Toloka server are possible while iterating. @@ -724,6 +733,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned assignments limit for each request. The default batch_size is 50. The maximum allowed batch_size is 100,000. Yields: Assignment: The next matching assignment. @@ -773,7 +783,8 @@ class TolokaClient: expired_lt: typing.Optional[datetime.datetime] = None, expired_lte: typing.Optional[datetime.datetime] = None, expired_gt: typing.Optional[datetime.datetime] = None, - expired_gte: typing.Optional[datetime.datetime] = None + expired_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.assignment.Assignment, None, None]: """Finds all assignments that match certain criteria. @@ -783,6 +794,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned assignments limit for each request. The default batch_size is 50. The maximum allowed batch_size is 100,000. Yields: Assignment: The next matching assignment. @@ -961,7 +973,11 @@ class TolokaClient: ... @typing.overload - def get_attachments(self, request: toloka.client.search_requests.AttachmentSearchRequest) -> typing.Generator[toloka.client.attachment.Attachment, None, None]: + def get_attachments( + self, + request: toloka.client.search_requests.AttachmentSearchRequest, + batch_size: typing.Optional[int] = None + ) -> typing.Generator[toloka.client.attachment.Attachment, None, None]: """Finds all attachments that match certain criteria and returns their metadata. `get_attachments` returns a generator. You can iterate over all found attachments using the generator. Several requests to the Toloka server are possible while iterating. @@ -970,6 +986,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned attachments limit for each request. The maximum allowed batch_size is 100. Yields: Attachment: The next matching attachment. @@ -999,7 +1016,8 @@ class TolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.attachment.Attachment, None, None]: """Finds all attachments that match certain criteria and returns their metadata. @@ -1009,6 +1027,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned attachments limit for each request. The maximum allowed batch_size is 100. Yields: Attachment: The next matching attachment. @@ -1216,7 +1235,11 @@ class TolokaClient: ... @typing.overload - def get_message_threads(self, request: toloka.client.search_requests.MessageThreadSearchRequest) -> typing.Generator[toloka.client.message_thread.MessageThread, None, None]: + def get_message_threads( + self, + request: toloka.client.search_requests.MessageThreadSearchRequest, + batch_size: typing.Optional[int] = None + ) -> typing.Generator[toloka.client.message_thread.MessageThread, None, None]: """Finds all message threads that match certain criteria. `get_message_threads` returns a generator. You can iterate over all found message threads using the generator. Several requests to the Toloka server are possible while iterating. @@ -1225,6 +1248,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned message threads limit for each request. The default batch_size is 50. The maximum allowed batch_size is 300. Yields: MessageThread: The next matching message thread. @@ -1249,7 +1273,8 @@ class TolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.message_thread.MessageThread, None, None]: """Finds all message threads that match certain criteria. @@ -1259,6 +1284,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned message threads limit for each request. The default batch_size is 50. The maximum allowed batch_size is 300. Yields: MessageThread: The next matching message thread. @@ -1443,7 +1469,11 @@ class TolokaClient: ... @typing.overload - def get_projects(self, request: toloka.client.search_requests.ProjectSearchRequest) -> typing.Generator[toloka.client.project.Project, None, None]: + def get_projects( + self, + request: toloka.client.search_requests.ProjectSearchRequest, + batch_size: typing.Optional[int] = None + ) -> typing.Generator[toloka.client.project.Project, None, None]: """Finds all projects that match certain criteria. `get_projects` returns a generator. You can iterate over all found projects using the generator. Several requests to the Toloka server are possible while iterating. @@ -1452,6 +1482,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned projects limit for each request. The default batch_size is 20. The maximum allowed batch_size is 300. Yields: Project: The next matching project. @@ -1479,7 +1510,8 @@ class TolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.project.Project, None, None]: """Finds all projects that match certain criteria. @@ -1489,6 +1521,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned projects limit for each request. The default batch_size is 20. The maximum allowed batch_size is 300. Yields: Project: The next matching project. @@ -1559,16 +1592,17 @@ class TolokaClient: ... def archive_pool(self, pool_id: str) -> toloka.client.pool.Pool: - """Sends pool to archive + """Archives a pool. + + Only closed pools can be archived. - The pool must be in the status "closed". - The archived pool is not deleted. You can access it when you will need it. + You can't open archived pools, but you can [clone](toloka.client.TolokaClient.clone_pool.md) them if needed. Args: - pool_id: ID of pool that will be archived. + pool_id: The ID of the pool to be archived. Returns: - Pool: Object with updated status. + Pool: The pool with updated status. Example: >>> closed_pool = next(toloka_client.get_pools(status='CLOSED')) @@ -1578,17 +1612,17 @@ class TolokaClient: ... def archive_pool_async(self, pool_id: str) -> typing.Optional[toloka.client.operations.PoolArchiveOperation]: - """Sends pool to archive, asynchronous version + """Archives a pool. Sends an asynchronous request to Toloka. - The pool must be in the status "closed". - The archived pool is not deleted. You can access it when you will need it. + Only closed pools can be archived. + + You can't open archived pools, but you can [clone](toloka.client.TolokaClient.clone_pool.md) them if needed. Args: - pool_id: ID of pool that will be archived. + pool_id: The ID of the pool to be archived. Returns: - PoolArchiveOperation: An operation upon completion of which you can get the pool with updated status. If - pool is already archived then None is returned + PoolArchiveOperation: An object to track the progress of the operation. If the pool is already archived then `None` is returned. Example: >>> closed_pool = next(toloka_client.get_pools(status='CLOSED')) @@ -1599,15 +1633,15 @@ class TolokaClient: ... def close_pool(self, pool_id: str) -> toloka.client.pool.Pool: - """Stops distributing tasks from the pool + """Closes a pool. - If all tasks done, the pool will be closed automatically. + If all tasks in a pool are completed, then the pool is closed automatically. Args: - pool_id: ID of the pool that will be closed. + pool_id: The ID of the pool to be closed. Returns: - Pool: Pool object with new status. + Pool: The pool with updated status. Example: >>> open_pool = next(toloka_client.get_pools(status='OPEN')) @@ -1617,16 +1651,15 @@ class TolokaClient: ... def close_pool_async(self, pool_id: str) -> typing.Optional[toloka.client.operations.PoolCloseOperation]: - """Stops distributing tasks from the pool, asynchronous version + """Closes a pool. Sends an asynchronous request to Toloka. - If all tasks done, the pool will be closed automatically. + If all tasks in a pool are completed, then the pool is closed automatically. Args: - pool_id: ID of the pool that will be closed. + pool_id: The ID of the pool to be closed. Returns: - Optional[PoolCloseOperation]: An operation upon completion of which you can get the pool with updated - status. If pool is already closed then None is returned. + PoolCloseOperation: An object to track the progress of the operation. If the pool is already closed then `None` is returned. Example: >>> open_pool = next(toloka_client.get_pools(status='OPEN')) @@ -1637,13 +1670,16 @@ class TolokaClient: ... def close_pool_for_update(self, pool_id: str) -> toloka.client.pool.Pool: - """Closes pool for update + """Closes a pool that is to be updated. + + To make changes to a pool, close it before updating parameters. + If you don't open the pool after updating, it opens automatically in 15 minutes. Args: - pool_id: ID of the pool that will be closed for update. + pool_id: The ID of the pool to be closed. Returns: - Pool: Pool object with new status. + Pool: The pool with updated status. Example: >>> toloka_client.close_pool_for_update(pool_id='1') @@ -1652,14 +1688,16 @@ class TolokaClient: ... def close_pool_for_update_async(self, pool_id: str) -> typing.Optional[toloka.client.operations.PoolCloseOperation]: - """Closes pool for update, asynchronous version + """Closes a pool that is to be updated. Sends an asynchronous request to Toloka. + + To make changes to a pool, close it before updating parameters. + If you don't open the pool after updating, it opens automatically in 15 minutes. Args: - pool_id: ID of the pool that will be closed for update. + pool_id: The ID of the pool to be closed. Returns: - Optional[PoolCloseOperation]: An operation upon completion of which you can get the pool with updated - status. If pool is already closed for update then None is returned. + PoolCloseOperation: An object to track the progress of the operation. If the pool is already closed then `None` is returned. Example: >>> close_op = toloka_client.close_pool_for_update_async(pool_id='1') @@ -1669,16 +1707,16 @@ class TolokaClient: ... def clone_pool(self, pool_id: str) -> toloka.client.pool.Pool: - """Duplicates existing pool + """Clones an existing pool. - An empty pool with the same parameters will be created. - A new pool will be attached to the same project. + An empty pool with the same parameters is created. + The new pool is attached to the same project. Args: - pool_id: ID of the existing pool. + pool_id: The ID of the pool to be cloned. Returns: - Pool: New pool. + Pool: The new pool. Example: >>> toloka_client.clone_pool(pool_id='1') @@ -1687,47 +1725,47 @@ class TolokaClient: ... def clone_pool_async(self, pool_id: str) -> toloka.client.operations.PoolCloneOperation: - """Duplicates existing pool, asynchronous version + """Clones an existing pool. Sends an asynchronous request to Toloka. - An empty pool with the same parameters will be created. - A new pool will be attached to the same project. + An empty pool with the same parameters is created. + The new pool is attached to the same project. Args: - pool_id: ID of the existing pool. + pool_id: The ID of the pool to be cloned. Returns: - PoolCloneOperation: An operation upon completion of which you can get the new pool. + PoolCloneOperation: An object to track the progress of the operation. Example: - >>> new_pool = toloka_client.clone_pool_async(pool_id='1') - >>> toloka_client.wait_operation(new_pool) + >>> clone_op = toloka_client.clone_pool_async(pool_id='1') + >>> toloka_client.wait_operation(clone_op) ... """ ... def create_pool(self, pool: toloka.client.pool.Pool) -> toloka.client.pool.Pool: - """Creates a new pool + """Creates a new pool in Toloka. You can send a maximum of 20 requests of this kind per minute and 100 requests per day. Args: - pool: New Pool with set parameters. + pool: The pool to be created. Returns: - Pool: Created pool. With read-only fields. + Pool: The pool with updated read-only fields. Example: - How to create a new pool in a project. + Creating a new pool. - >>> new_pool = toloka.pool.Pool( - >>> project_id=existing_project_id, + >>> new_pool = toloka.client.Pool( + >>> project_id='1', >>> private_name='Pool 1', >>> may_contain_adult_content=False, >>> will_expire=datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(days=365), >>> reward_per_assignment=0.01, >>> assignment_max_duration_seconds=60*20, - >>> defaults=toloka.pool.Pool.Defaults(default_overlap_for_new_task_suites=3), - >>> filter=toloka.filter.Languages.in_('EN'), + >>> defaults=toloka.client.Pool.Defaults(default_overlap_for_new_task_suites=3), + >>> filter=toloka.client.filter.Languages.in_('EN'), >>> ) >>> new_pool.set_mixer_config(real_tasks_count=10, golden_tasks_count=0, training_tasks_count=0) >>> new_pool.quality_control.add_action(...) @@ -1759,17 +1797,17 @@ class TolokaClient: PoolSearchResult: Found pools and a flag showing whether there are more matching pools exceeding the limit. Examples: - Find all pools in all projects. + Finding all pools in all projects. >>> pools = toloka_client.find_pools() ... - Find all open pools in all projects. + Finding all open pools in all projects. >>> pools = toloka_client.find_pools(status='OPEN') ... - Find open pools in a specific project. + Finding open pools in a specific project. >>> pools = toloka_client.find_pools(status='OPEN', project_id='1') ... @@ -1813,17 +1851,17 @@ class TolokaClient: PoolSearchResult: Found pools and a flag showing whether there are more matching pools exceeding the limit. Examples: - Find all pools in all projects. + Finding all pools in all projects. >>> pools = toloka_client.find_pools() ... - Find all open pools in all projects. + Finding all open pools in all projects. >>> pools = toloka_client.find_pools(status='OPEN') ... - Find open pools in a specific project. + Finding open pools in a specific project. >>> pools = toloka_client.find_pools(status='OPEN', project_id='1') ... @@ -1833,10 +1871,10 @@ class TolokaClient: ... def get_pool(self, pool_id: str) -> toloka.client.pool.Pool: - """Reads one specific pool + """Gets pool data from Toloka. Args: - pool_id: ID of the pool. + pool_id: The ID of the pool. Returns: Pool: The pool. @@ -1848,7 +1886,11 @@ class TolokaClient: ... @typing.overload - def get_pools(self, request: toloka.client.search_requests.PoolSearchRequest) -> typing.Generator[toloka.client.pool.Pool, None, None]: + def get_pools( + self, + request: toloka.client.search_requests.PoolSearchRequest, + batch_size: typing.Optional[int] = None + ) -> typing.Generator[toloka.client.pool.Pool, None, None]: """Finds all pools that match certain criteria. `get_pools` returns a generator. You can iterate over all found pools using the generator. Several requests to the Toloka server are possible while iterating. @@ -1857,6 +1899,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned pools limit for each request. The default batch_size is 20. The maximum allowed batch_size is 300. Yields: Pool: The next matching pool. @@ -1890,7 +1933,8 @@ class TolokaClient: last_started_lt: typing.Optional[datetime.datetime] = None, last_started_lte: typing.Optional[datetime.datetime] = None, last_started_gt: typing.Optional[datetime.datetime] = None, - last_started_gte: typing.Optional[datetime.datetime] = None + last_started_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.pool.Pool, None, None]: """Finds all pools that match certain criteria. @@ -1900,6 +1944,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned pools limit for each request. The default batch_size is 20. The maximum allowed batch_size is 300. Yields: Pool: The next matching pool. @@ -1918,18 +1963,18 @@ class TolokaClient: ... def open_pool(self, pool_id: str) -> toloka.client.pool.Pool: - """Starts distributing tasks from the pool + """Opens a pool. - Tolokers will see your tasks only after that call. + After opening the pool, tasks can be assigned to Tolokers. Args: - pool_id: ID of the pool that will be started. + pool_id: The ID of the pool. Returns: - Pool: Pool object with new status. + Pool: The pool with updated status. Example: - Open the pool for Tolokers. + Opening a pool. >>> toloka_client.open_pool(pool_id='1') ... @@ -1937,22 +1982,21 @@ class TolokaClient: ... def open_pool_async(self, pool_id: str) -> typing.Optional[toloka.client.operations.PoolOpenOperation]: - """Starts distributing tasks from the pool, asynchronous version + """Opens a pool. Sends an asynchronous request to Toloka. - Tolokers will see your tasks only after that call. + After opening the pool, tasks can be assigned to Tolokers. Args: - pool_id: ID of the pool that will be started. + pool_id: The ID of the pool. Returns: - PoolOpenOperation: An operation upon completion of which you can get the pool with new status. If pool is - already opened then None is returned. + PoolOpenOperation: An object to track the progress of the operation. If the pool is already opened then `None` is returned. Example: - Open the pool for Tolokers. + Opening a pool. - >>> open_pool = toloka_client.open_pool(pool_id='1') - >>> toloka_client.wait_operation(open_pool) + >>> open_op = toloka_client.open_pool(pool_id='1') + >>> toloka_client.wait_operation(open_op) ... """ ... @@ -1963,17 +2007,19 @@ class TolokaClient: pool_id: str, request: toloka.client.pool.PoolPatchRequest ) -> toloka.client.pool.Pool: - """Changes the priority of the pool issue + """Changes pool parameters in Toloka. + + If a parameter is not specified in the `patch_pool` method, then it is left unchanged in Toloka. Args: - pool_id: ID of the pool that will be patched. - request: New priority of the pool. + pool_id: The ID of the pool to be changed. + request: New pool parameters. Returns: - Pool: Object with updated priority. + Pool: The pool with updated parameters. Example: - Set the highest priority to a specified pool. + Changing priority of a pool. >>> toloka_client.patch_pool(pool_id='1', priority=100) ... @@ -1986,17 +2032,19 @@ class TolokaClient: pool_id: str, priority: typing.Optional[int] = None ) -> toloka.client.pool.Pool: - """Changes the priority of the pool issue + """Changes pool parameters in Toloka. + + If a parameter is not specified in the `patch_pool` method, then it is left unchanged in Toloka. Args: - pool_id: ID of the pool that will be patched. - request: New priority of the pool. + pool_id: The ID of the pool to be changed. + request: New pool parameters. Returns: - Pool: Object with updated priority. + Pool: The pool with updated parameters. Example: - Set the highest priority to a specified pool. + Changing priority of a pool. >>> toloka_client.patch_pool(pool_id='1', priority=100) ... @@ -2008,32 +2056,35 @@ class TolokaClient: pool_id: str, pool: toloka.client.pool.Pool ) -> toloka.client.pool.Pool: - """Makes changes to the pool + """Updates all pool parameters in Toloka. Args: - pool_id: ID of the pool that will be changed. - pool: A pool object with all the fields: those that will be updated and those that will not. + pool_id: The ID of the pool to be updated. + pool: The pool with new parameters. Returns: - Pool: Pool object with all fields. + Pool: The pool with updated parameters. Example: - >>> updated_pool = toloka_client.update_pool(pool_id=old_pool_id, pool=new_pool_object) + >>> updated_pool = toloka_client.get_pool(pool_id='1') + >>> updated_pool.will_expire = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(days=30) + >>> toloka_client.update_pool(pool_id=updated_pool.id, pool=updated_pool) ... """ ... def archive_training(self, training_id: str) -> toloka.client.training.Training: - """Sends training to archive + """Archives a training. - The training must be in the status "closed". - The archived training is not deleted. You can access it when you will need it. + Only closed trainings can be archived. + + You can access archived trainings later. Args: - training_id: ID of training that will be archived. + training_id: The ID of the training to be archived. Returns: - Training: Object with updated status. + Training: The training with updated status. Example: >>> closed_training = next(toloka_client.get_trainings(status='CLOSED')) @@ -2043,17 +2094,17 @@ class TolokaClient: ... def archive_training_async(self, training_id: str) -> typing.Optional[toloka.client.operations.TrainingArchiveOperation]: - """Sends training to archive, asynchronous version + """Archives a training. Sends an asynchronous request to Toloka. + + Only closed trainings can be archived. - The training must be in the status "closed". - The archived training is not deleted. You can access it when you will need it. + You can access archived trainings later. Args: - training_id: ID of training that will be archived. + training_id: The ID of the training to be archived. Returns: - TrainingArchiveOperation: An operation upon completion of which you can get the training with updated - status. If pool is already archived then None is returned. + TrainingArchiveOperation: An object to track the progress of the operation. If the training is already archived then `None` is returned. Example: >>> closed_training = next(toloka_client.find_trainings(status='CLOSED')) @@ -2064,50 +2115,53 @@ class TolokaClient: ... def close_training(self, training_id: str) -> toloka.client.training.Training: - """Stops distributing tasks from the training + """Closes a training. + + Tasks from closed trainings are not assigned to Tolokers. Args: - training_id: ID of the training that will be closed. + training_id: The ID of the training to be closed. Returns: - Training: Training object with new status. + Training: The training with updated status. Example: - >>> open_training = next(toloka_client.get_trainings(status='OPEN')) - >>> toloka_client.close_training(training_id=open_training.id) + >>> opened_training = next(toloka_client.get_trainings(status='OPEN')) + >>> toloka_client.close_training(training_id=opened_training.id) ... """ ... def close_training_async(self, training_id: str) -> typing.Optional[toloka.client.operations.TrainingCloseOperation]: - """Stops distributing tasks from the training, asynchronous version + """Closes a training. Sends an asynchronous request to Toloka. + + Tasks from closed trainings are not assigned to Tolokers. Args: - training_id: ID of the training that will be closed. + training_id: The ID of the training to be closed. Returns: - TrainingCloseOperation: An operation upon completion of which you can get the training with updated status. - If training is already closed then None is returned. + TrainingCloseOperation: An object to track the progress of the operation. If the training is already closed then `None` is returned. Example: - >>> open_training = next(toloka_client.get_trainings(status='OPEN')) - >>> close_training = toloka_client.close_training_async(training_id=open_training.id) - >>> toloka_client.wait_operation(close_training) + >>> opened_training = next(toloka_client.get_trainings(status='OPEN')) + >>> close_op = toloka_client.close_training_async(training_id=opened_training.id) + >>> toloka_client.wait_operation(close_op) ... """ ... def clone_training(self, training_id: str) -> toloka.client.training.Training: - """Duplicates existing training + """Clones an existing training. - An empty training with the same parameters will be created. - A new training will be attached to the same project. + An empty training with the same parameters is created. + The new training is attached to the same project. Args: - training_id: ID of the existing training. + training_id: The ID of the training to be cloned. Returns: - Training: New training. + Training: The new training. Example: >>> toloka_client.clone_training(training_id='1') @@ -2116,41 +2170,41 @@ class TolokaClient: ... def clone_training_async(self, training_id: str) -> toloka.client.operations.TrainingCloneOperation: - """Duplicates existing training, asynchronous version + """Clones an existing training. Sends an asynchronous request to Toloka. - An empty training with the same parameters will be created. - A new training will be attached to the same project. + An empty training with the same parameters is created. + The new training is attached to the same project. Args: - training_id: ID of the existing training. + training_id: The ID of the training to be cloned. Returns: - TrainingCloneOperation: An operation upon completion of which you can get the new training. + TrainingCloneOperation: An object to track the progress of the operation. Example: - >>> clone_training = toloka_client.clone_training_async(training_id='1') - >>> toloka_client.wait_operation(clone_training) + >>> clone_op = toloka_client.clone_training_async(training_id='1') + >>> toloka_client.wait_operation(clone_op) ... """ ... def create_training(self, training: toloka.client.training.Training) -> toloka.client.training.Training: - """Creates a new training + """Creates a new training in Toloka. Args: - training: New Training with set parameters. + training: A training to be created. Returns: - Training: Created training. With read-only fields. + Training: Created training with initialized read-only fields. Example: - How to create a new training in a project. + Creating a new training. - >>> new_training = toloka.training.Training( - >>> project_id=existing_project_id, + >>> new_training = toloka.client.Training( + >>> project_id='1', >>> private_name='Some training in my project', >>> may_contain_adult_content=True, - >>> assignment_max_duration_seconds=10000, + >>> assignment_max_duration_seconds=60*5, >>> mix_tasks_in_creation_order=True, >>> shuffle_tasks_in_task_suite=True, >>> training_tasks_in_task_suite_count=3, @@ -2172,37 +2226,37 @@ class TolokaClient: sort: typing.Union[typing.List[str], toloka.client.search_requests.TrainingSortItems, None] = None, limit: typing.Optional[int] = None ) -> toloka.client.search_results.TrainingSearchResult: - """Finds training pools that match certain criteria. + """Finds trainings that match certain criteria. - The number of returned pools is limited. To find remaining pools call `find_trainings` with updated search criteria. + The number of returned trainings is limited. To find remaining trainings call `find_trainings` with updated search criteria. - To iterate over all matching training pools you may use the [get_trainings](toloka.client.TolokaClient.get_trainings.md) method. + To iterate over all matching trainings you may use the [get_trainings](toloka.client.TolokaClient.get_trainings.md) method. Args: request: Search criteria. sort: Sorting options. Default: `None`. - limit: Returned training pools limit. The maximum allowed limit is 300. + limit: Returned trainings limit. The maximum allowed limit is 300. Returns: - TrainingSearchResult: Found training pools and a flag showing whether there are more matching pools exceeding the limit. + TrainingSearchResult: Found trainings and a flag showing whether there are more matching trainings exceeding the limit. Examples: - Find all training pools in all projects. + Finding all trainings in all projects. - >>> pools = toloka_client.find_trainings() + >>> trainings = toloka_client.find_trainings() ... - Find all open training pools in all projects. + Finding all opened trainings in all projects. - >>> pools = toloka_client.find_trainings(status='OPEN') + >>> trainings = toloka_client.find_trainings(status='OPEN') ... - Find all open training pools in a specific project. + Finding all opened trainings in a specific project. - >>> pools = toloka_client.find_trainings(status='OPEN', project_id='1') + >>> trainings = toloka_client.find_trainings(status='OPEN', project_id='1') ... - If there are pools exceeding the `limit`, then `pools.has_more` is set to `True`. + If there are trainings exceeding the `limit`, then `trainings.has_more` is set to `True`. """ ... @@ -2226,73 +2280,78 @@ class TolokaClient: sort: typing.Union[typing.List[str], toloka.client.search_requests.TrainingSortItems, None] = None, limit: typing.Optional[int] = None ) -> toloka.client.search_results.TrainingSearchResult: - """Finds training pools that match certain criteria. + """Finds trainings that match certain criteria. - The number of returned pools is limited. To find remaining pools call `find_trainings` with updated search criteria. + The number of returned trainings is limited. To find remaining trainings call `find_trainings` with updated search criteria. - To iterate over all matching training pools you may use the [get_trainings](toloka.client.TolokaClient.get_trainings.md) method. + To iterate over all matching trainings you may use the [get_trainings](toloka.client.TolokaClient.get_trainings.md) method. Args: request: Search criteria. sort: Sorting options. Default: `None`. - limit: Returned training pools limit. The maximum allowed limit is 300. + limit: Returned trainings limit. The maximum allowed limit is 300. Returns: - TrainingSearchResult: Found training pools and a flag showing whether there are more matching pools exceeding the limit. + TrainingSearchResult: Found trainings and a flag showing whether there are more matching trainings exceeding the limit. Examples: - Find all training pools in all projects. + Finding all trainings in all projects. - >>> pools = toloka_client.find_trainings() + >>> trainings = toloka_client.find_trainings() ... - Find all open training pools in all projects. + Finding all opened trainings in all projects. - >>> pools = toloka_client.find_trainings(status='OPEN') + >>> trainings = toloka_client.find_trainings(status='OPEN') ... - Find all open training pools in a specific project. + Finding all opened trainings in a specific project. - >>> pools = toloka_client.find_trainings(status='OPEN', project_id='1') + >>> trainings = toloka_client.find_trainings(status='OPEN', project_id='1') ... - If there are pools exceeding the `limit`, then `pools.has_more` is set to `True`. + If there are trainings exceeding the `limit`, then `trainings.has_more` is set to `True`. """ ... def get_training(self, training_id: str) -> toloka.client.training.Training: - """Reads one specific training + """Gets information about a training from Toloka. Args: - training_id: ID of the training. + training_id: The ID of the training. Returns: Training: The training. Example: - >>> toloka_client.get_training(training_id='1') + >>> t = toloka_client.get_training(training_id='1') ... """ ... @typing.overload - def get_trainings(self, request: toloka.client.search_requests.TrainingSearchRequest) -> typing.Generator[toloka.client.training.Training, None, None]: - """Finds all training pools that match certain criteria. + def get_trainings( + self, + request: toloka.client.search_requests.TrainingSearchRequest, + batch_size: typing.Optional[int] = None + ) -> typing.Generator[toloka.client.training.Training, None, None]: + """Finds all trainings that match certain criteria. - `get_trainings` returns a generator. You can iterate over all found training pools using the generator. Several requests to the Toloka server are possible while iterating. + `get_trainings` returns a generator. You can iterate over all found trainings using the generator. Several requests to the Toloka server are possible while iterating. - If you need to sort training pools use the [find_trainings](toloka.client.TolokaClient.find_trainings.md) method. + If you need to sort trainings use the [find_trainings](toloka.client.TolokaClient.find_trainings.md) method. Args: request: Search criteria. + batch_size: Returned trainings limit for each request. The maximum allowed batch_size is 300. Yields: - Training: The next matching training pool. + Training: The next matching training. Example: - How to get all training pools in a project. + Getting all trainings in a project. - >>> trainings = toloka_client.get_trainings(project_id=project_id) + >>> trainings = toloka_client.get_trainings(project_id='1') ... """ ... @@ -2313,39 +2372,43 @@ class TolokaClient: last_started_lt: typing.Optional[datetime.datetime] = None, last_started_lte: typing.Optional[datetime.datetime] = None, last_started_gt: typing.Optional[datetime.datetime] = None, - last_started_gte: typing.Optional[datetime.datetime] = None + last_started_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.training.Training, None, None]: - """Finds all training pools that match certain criteria. + """Finds all trainings that match certain criteria. - `get_trainings` returns a generator. You can iterate over all found training pools using the generator. Several requests to the Toloka server are possible while iterating. + `get_trainings` returns a generator. You can iterate over all found trainings using the generator. Several requests to the Toloka server are possible while iterating. - If you need to sort training pools use the [find_trainings](toloka.client.TolokaClient.find_trainings.md) method. + If you need to sort trainings use the [find_trainings](toloka.client.TolokaClient.find_trainings.md) method. Args: request: Search criteria. + batch_size: Returned trainings limit for each request. The maximum allowed batch_size is 300. Yields: - Training: The next matching training pool. + Training: The next matching training. Example: - How to get all training pools in a project. + Getting all trainings in a project. - >>> trainings = toloka_client.get_trainings(project_id=project_id) + >>> trainings = toloka_client.get_trainings(project_id='1') ... """ ... def open_training(self, training_id: str) -> toloka.client.training.Training: - """Starts distributing tasks from the training + """Opens a training. + + Tasks from opened trainings can be assigned to Tolokers. Args: - training_id: ID of the training that will be started. + training_id: The ID of the training. Returns: - Training: Training object with new status. + Training: The training with updated status. Example: - Open the training for Tolokers. + Opening a training. >>> toloka_client.open_training(training_id='1') ... @@ -2353,20 +2416,22 @@ class TolokaClient: ... def open_training_async(self, training_id: str) -> typing.Optional[toloka.client.operations.TrainingOpenOperation]: - """Starts distributing tasks from the training, asynchronous version + """Opens a training. Sends an asynchronous request to Toloka. + + Tasks from opened trainings can be assigned to Tolokers. Args: - training_id: ID of the training that will be started. + training_id: The ID of the training. Returns: - TrainingOpenOperation: An operation upon completion of which you can get the training with new status. If - training is already opened then None is returned. + TrainingOpenOperation: An object to track the progress of the operation. + If the training is already opened then `None` is returned. Example: - Open the training for Tolokers. + Opening a training. - >>> open_training = toloka_client.open_training_async(training_id='1') - >>> toloka_client.wait_operation(open_training) + >>> open_op = toloka_client.open_training_async(training_id='1') + >>> toloka_client.wait_operation(open_op) ... """ ... @@ -2376,19 +2441,21 @@ class TolokaClient: training_id: str, training: toloka.client.training.Training ) -> toloka.client.training.Training: - """Makes changes to the training + """Updates parameters of a training in Toloka. Args: - training_id: ID of the training that will be changed. - training: A training object with all the fields: those that will be updated and those that will not. + training_id: The ID of the training to be updated. + training: A training object with new parameter values. Returns: - Training: Training object with all fields. + Training: The updated training. Example: - If you want to update any configurations of the existing training. + The example shows how to set new time limit in a training. - >>> updated_training = toloka_client.update_training(training_id=old_training_id, training=new_training_object) + >>> updated_training = toloka_client.get_training(training_id='1') + >>> updated_training.assignment_max_duration_seconds = 600 + >>> toloka_client.update_training(training_id=updated_training.id, training=updated_training) ... """ ... @@ -2540,7 +2607,11 @@ class TolokaClient: ... @typing.overload - def get_skills(self, request: toloka.client.search_requests.SkillSearchRequest) -> typing.Generator[toloka.client.skill.Skill, None, None]: + def get_skills( + self, + request: toloka.client.search_requests.SkillSearchRequest, + batch_size: typing.Optional[int] = None + ) -> typing.Generator[toloka.client.skill.Skill, None, None]: """Finds all skills that match certain criteria. `get_skills` returns a generator. You can iterate over all found skills using the generator. Several requests to the Toloka server are possible while iterating. @@ -2549,6 +2620,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned skills limit for each request. The maximum allowed batch_size is 100. Yields: Skill: The next matching skill. @@ -2576,7 +2648,8 @@ class TolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.skill.Skill, None, None]: """Finds all skills that match certain criteria. @@ -2586,6 +2659,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned skills limit for each request. The maximum allowed batch_size is 100. Yields: Skill: The next matching skill. @@ -2984,7 +3058,11 @@ class TolokaClient: ... @typing.overload - def get_tasks(self, request: toloka.client.search_requests.TaskSearchRequest) -> typing.Generator[toloka.client.task.Task, None, None]: + def get_tasks( + self, + request: toloka.client.search_requests.TaskSearchRequest, + batch_size: typing.Optional[int] = None + ) -> typing.Generator[toloka.client.task.Task, None, None]: """Finds all tasks that match certain criteria. `get_tasks` returns a generator. You can iterate over all found tasks using the generator. Several requests to the Toloka server are possible while iterating. @@ -2993,6 +3071,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned tasks limit for each request. The default batch_size is 50. The maximum allowed batch_size is 100,000. Yields: Task: The next matching task. @@ -3021,7 +3100,8 @@ class TolokaClient: overlap_lt: typing.Optional[int] = None, overlap_lte: typing.Optional[int] = None, overlap_gt: typing.Optional[int] = None, - overlap_gte: typing.Optional[int] = None + overlap_gte: typing.Optional[int] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.task.Task, None, None]: """Finds all tasks that match certain criteria. @@ -3031,6 +3111,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned tasks limit for each request. The default batch_size is 50. The maximum allowed batch_size is 100,000. Yields: Task: The next matching task. @@ -3483,7 +3564,11 @@ class TolokaClient: ... @typing.overload - def get_task_suites(self, request: toloka.client.search_requests.TaskSuiteSearchRequest) -> typing.Generator[toloka.client.task_suite.TaskSuite, None, None]: + def get_task_suites( + self, + request: toloka.client.search_requests.TaskSuiteSearchRequest, + batch_size: typing.Optional[int] = None + ) -> typing.Generator[toloka.client.task_suite.TaskSuite, None, None]: """Finds all task suites that match certain criteria. `get_task_suites` returns a generator. You can iterate over all found task suites using the generator. Several requests to the Toloka server are possible while iterating. @@ -3492,6 +3577,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned task suites limit for each request. The default batch_size is 50. The maximum allowed batch_size is 100,000. Yields: TaskSuite: The next matching task suite. @@ -3521,7 +3607,8 @@ class TolokaClient: overlap_lt: typing.Optional[int] = None, overlap_lte: typing.Optional[int] = None, overlap_gt: typing.Optional[int] = None, - overlap_gte: typing.Optional[int] = None + overlap_gte: typing.Optional[int] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.task_suite.TaskSuite, None, None]: """Finds all task suites that match certain criteria. @@ -3531,6 +3618,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned task suites limit for each request. The default batch_size is 50. The maximum allowed batch_size is 100,000. Yields: TaskSuite: The next matching task suite. @@ -3762,7 +3850,11 @@ class TolokaClient: ... @typing.overload - def get_operations(self, request: toloka.client.search_requests.OperationSearchRequest) -> typing.Generator[toloka.client.operations.Operation, None, None]: + def get_operations( + self, + request: toloka.client.search_requests.OperationSearchRequest, + batch_size: typing.Optional[int] = None + ) -> typing.Generator[toloka.client.operations.Operation, None, None]: """Finds all operations that match certain rules and returns them in an iterable object `get_operations` returns a generator. You can iterate over all found operations using the generator. Several requests to the Toloka server are possible while iterating. @@ -3771,6 +3863,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned operations limit for each request. The default batch_size is 50. The maximum allowed batch_size is 500. Yields: Operation: The next matching operations. @@ -3797,7 +3890,8 @@ class TolokaClient: finished_lt: typing.Optional[datetime.datetime] = None, finished_lte: typing.Optional[datetime.datetime] = None, finished_gt: typing.Optional[datetime.datetime] = None, - finished_gte: typing.Optional[datetime.datetime] = None + finished_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.operations.Operation, None, None]: """Finds all operations that match certain rules and returns them in an iterable object @@ -3807,6 +3901,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned operations limit for each request. The default batch_size is 50. The maximum allowed batch_size is 500. Yields: Operation: The next matching operations. @@ -4216,7 +4311,11 @@ class TolokaClient: ... @typing.overload - def get_user_bonuses(self, request: toloka.client.search_requests.UserBonusSearchRequest) -> typing.Generator[toloka.client.user_bonus.UserBonus, None, None]: + def get_user_bonuses( + self, + request: toloka.client.search_requests.UserBonusSearchRequest, + batch_size: typing.Optional[int] = None + ) -> typing.Generator[toloka.client.user_bonus.UserBonus, None, None]: """Finds all Tolokers' rewards that match certain rules and returns them in an iterable object `get_user_bonuses` returns a generator. You can iterate over all found Tolokers' rewards using the generator. Several requests to the Toloka server are possible while iterating. @@ -4225,6 +4324,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned Tolokers' rewards limit for each request. The maximum allowed batch_size is 300. Yields: UserBonus: The next matching Toloker's reward. @@ -4248,7 +4348,8 @@ class TolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.user_bonus.UserBonus, None, None]: """Finds all Tolokers' rewards that match certain rules and returns them in an iterable object @@ -4258,6 +4359,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned Tolokers' rewards limit for each request. The maximum allowed batch_size is 300. Yields: UserBonus: The next matching Toloker's reward. @@ -4353,7 +4455,11 @@ class TolokaClient: ... @typing.overload - def get_user_restrictions(self, request: toloka.client.search_requests.UserRestrictionSearchRequest) -> typing.Generator[toloka.client.user_restriction.UserRestriction, None, None]: + def get_user_restrictions( + self, + request: toloka.client.search_requests.UserRestrictionSearchRequest, + batch_size: typing.Optional[int] = None + ) -> typing.Generator[toloka.client.user_restriction.UserRestriction, None, None]: """Finds all Toloker restrictions that match certain criteria. `get_user_restrictions` returns a generator. You can iterate over all found Toloker restrictions using the generator. Several requests to the Toloka server are possible while iterating. @@ -4362,6 +4468,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned Toloker restrictions limit for each request. The maximum allowed batch_size is 500. Yields: UserRestriction: The next matching Toloker restriction. @@ -4386,7 +4493,8 @@ class TolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.user_restriction.UserRestriction, None, None]: """Finds all Toloker restrictions that match certain criteria. @@ -4396,6 +4504,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned Toloker restrictions limit for each request. The maximum allowed batch_size is 500. Yields: UserRestriction: The next matching Toloker restriction. @@ -4553,7 +4662,11 @@ class TolokaClient: ... @typing.overload - def get_user_skills(self, request: toloka.client.search_requests.UserSkillSearchRequest) -> typing.Generator[toloka.client.user_skill.UserSkill, None, None]: + def get_user_skills( + self, + request: toloka.client.search_requests.UserSkillSearchRequest, + batch_size: typing.Optional[int] = None + ) -> typing.Generator[toloka.client.user_skill.UserSkill, None, None]: """Finds all Toloker's skills that match certain criteria. `get_user_skills` returns a generator. You can iterate over all found Toloker's skills using the generator. Several requests to the Toloka server are possible while iterating. @@ -4562,6 +4675,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned skills limit for each request. The maximum allowed batch_size is 1000. Yields: UserSkill: The next matching Toloker's skill. @@ -4588,7 +4702,8 @@ class TolokaClient: modified_lt: typing.Optional[datetime.datetime] = None, modified_lte: typing.Optional[datetime.datetime] = None, modified_gt: typing.Optional[datetime.datetime] = None, - modified_gte: typing.Optional[datetime.datetime] = None + modified_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.user_skill.UserSkill, None, None]: """Finds all Toloker's skills that match certain criteria. @@ -4598,6 +4713,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned skills limit for each request. The maximum allowed batch_size is 1000. Yields: UserSkill: The next matching Toloker's skill. @@ -4773,7 +4889,11 @@ class TolokaClient: ... @typing.overload - def get_webhook_subscriptions(self, request: toloka.client.search_requests.WebhookSubscriptionSearchRequest) -> typing.Generator[toloka.client.webhook_subscription.WebhookSubscription, None, None]: + def get_webhook_subscriptions( + self, + request: toloka.client.search_requests.WebhookSubscriptionSearchRequest, + batch_size: typing.Optional[int] = None + ) -> typing.Generator[toloka.client.webhook_subscription.WebhookSubscription, None, None]: """Finds all webhook subscriptions that match certain criteria. `get_webhook_subscriptions` returns a generator. You can iterate over all found webhook subscriptions using the generator. Several requests to the Toloka server are possible while iterating. @@ -4782,6 +4902,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned webhook subscriptions limit for each request. The maximum allowed batch_size is 300. Yields: WebhookSubscription: The next matching webhook subscription. @@ -4800,7 +4921,8 @@ class TolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.webhook_subscription.WebhookSubscription, None, None]: """Finds all webhook subscriptions that match certain criteria. @@ -4810,6 +4932,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned webhook subscriptions limit for each request. The maximum allowed batch_size is 300. Yields: WebhookSubscription: The next matching webhook subscription. @@ -4877,11 +5000,11 @@ class TolokaClient: self, pool_id: str, *, - status: typing.Optional[typing.List[toloka.client.assignment.GetAssignmentsTsvParameters.Status]] = ..., + status: typing.Optional[typing.List[toloka.client.assignment.GetAssignmentsTsvParameters.Status]] = attr._make._Nothing.NOTHING, start_time_from: typing.Optional[datetime.datetime] = None, start_time_to: typing.Optional[datetime.datetime] = None, exclude_banned: typing.Optional[bool] = None, - field: typing.Optional[typing.List[toloka.client.assignment.GetAssignmentsTsvParameters.Field]] = ... + field: typing.Optional[typing.List[toloka.client.assignment.GetAssignmentsTsvParameters.Field]] = attr._make._Nothing.NOTHING ) -> pandas.DataFrame: """Downloads assignments as pandas.DataFrame. @@ -4989,7 +5112,11 @@ class TolokaClient: ... @typing.overload - def get_app_projects(self, request: toloka.client.search_requests.AppProjectSearchRequest) -> typing.Generator[toloka.client.app.AppProject, None, None]: + def get_app_projects( + self, + request: toloka.client.search_requests.AppProjectSearchRequest, + batch_size: typing.Optional[int] = None + ) -> typing.Generator[toloka.client.app.AppProject, None, None]: """Finds all App projects that match certain criteria. `get_app_projects` returns a generator. You can iterate over all found projects using the generator. Several requests to the Toloka server are possible while iterating. @@ -4998,6 +5125,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned projects limit for each request. The maximum batch_size is 5000. Yields: AppProject: The next matching App project. @@ -5024,7 +5152,8 @@ class TolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.app.AppProject, None, None]: """Finds all App projects that match certain criteria. @@ -5034,6 +5163,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned projects limit for each request. The maximum batch_size is 5000. Yields: AppProject: The next matching App project. @@ -5140,7 +5270,11 @@ class TolokaClient: ... @typing.overload - def get_apps(self, request: toloka.client.search_requests.AppSearchRequest) -> typing.Generator[toloka.client.app.App, None, None]: + def get_apps( + self, + request: toloka.client.search_requests.AppSearchRequest, + batch_size: typing.Optional[int] = None + ) -> typing.Generator[toloka.client.app.App, None, None]: """Finds all App solutions that match certain criteria. `get_apps` returns a generator. You can iterate over all found solutions using the generator. Several requests to the Toloka server are possible while iterating. @@ -5149,6 +5283,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned solutions limit for each request. The maximum allowed batch_size is 1000. Yields: App: The next matching solution. @@ -5163,7 +5298,8 @@ class TolokaClient: id_lt: typing.Optional[str] = None, id_lte: typing.Optional[str] = None, id_gt: typing.Optional[str] = None, - id_gte: typing.Optional[str] = None + id_gte: typing.Optional[str] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.app.App, None, None]: """Finds all App solutions that match certain criteria. @@ -5173,6 +5309,7 @@ class TolokaClient: Args: request: Search criteria. + batch_size: Returned solutions limit for each request. The maximum allowed batch_size is 1000. Yields: App: The next matching solution. @@ -5263,7 +5400,8 @@ class TolokaClient: def get_app_items( self, app_project_id: str, - request: toloka.client.search_requests.AppItemSearchRequest + request: toloka.client.search_requests.AppItemSearchRequest, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.app.AppItem, None, None]: """Finds all App task items that match certain criteria in an App project. @@ -5274,6 +5412,7 @@ class TolokaClient: Args: app_project_id: The ID of the App project. request: Search criteria. + batch_size: Returned items limit for each request. The maximum allowed batch_size is 1000. Yields: AppItem: The next matching item. @@ -5298,7 +5437,8 @@ class TolokaClient: finished_lt: typing.Optional[datetime.datetime] = None, finished_lte: typing.Optional[datetime.datetime] = None, finished_gt: typing.Optional[datetime.datetime] = None, - finished_gte: typing.Optional[datetime.datetime] = None + finished_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.app.AppItem, None, None]: """Finds all App task items that match certain criteria in an App project. @@ -5309,6 +5449,7 @@ class TolokaClient: Args: app_project_id: The ID of the App project. request: Search criteria. + batch_size: Returned items limit for each request. The maximum allowed batch_size is 1000. Yields: AppItem: The next matching item. @@ -5464,7 +5605,8 @@ class TolokaClient: def get_app_batches( self, app_project_id: str, - request: toloka.client.search_requests.AppBatchSearchRequest + request: toloka.client.search_requests.AppBatchSearchRequest, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.app.AppBatch, None, None]: """Finds all batches that match certain criteria in an App project. @@ -5475,6 +5617,7 @@ class TolokaClient: Args: app_project_id: The ID of the App project. request: Search criteria. + batch_size: Returned app batches limit for each request. The maximum allowed batch_size is 1000. Yields: AppBatch: The next matching batch. @@ -5498,7 +5641,8 @@ class TolokaClient: created_lt: typing.Optional[datetime.datetime] = None, created_lte: typing.Optional[datetime.datetime] = None, created_gt: typing.Optional[datetime.datetime] = None, - created_gte: typing.Optional[datetime.datetime] = None + created_gte: typing.Optional[datetime.datetime] = None, + batch_size: typing.Optional[int] = None ) -> typing.Generator[toloka.client.app.AppBatch, None, None]: """Finds all batches that match certain criteria in an App project. @@ -5509,6 +5653,7 @@ class TolokaClient: Args: app_project_id: The ID of the App project. request: Search criteria. + batch_size: Returned app batches limit for each request. The maximum allowed batch_size is 1000. Yields: AppBatch: The next matching batch. diff --git a/src/client/assignment.pyi b/src/client/assignment.pyi index db4d107c..1b9fdaec 100644 --- a/src/client/assignment.pyi +++ b/src/client/assignment.pyi @@ -3,6 +3,7 @@ __all__ = [ 'AssignmentPatch', 'GetAssignmentsTsvParameters', ] +import attr._make import datetime import decimal import toloka.client.owner @@ -200,11 +201,11 @@ class GetAssignmentsTsvParameters(toloka.client.primitives.parameter.Parameters) def __init__( self, *, - status: typing.Optional[typing.List[Status]] = ..., + status: typing.Optional[typing.List[Status]] = attr._make._Nothing.NOTHING, start_time_from: typing.Optional[datetime.datetime] = None, start_time_to: typing.Optional[datetime.datetime] = None, exclude_banned: typing.Optional[bool] = None, - field: typing.Optional[typing.List[Field]] = ... + field: typing.Optional[typing.List[Field]] = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class GetAssignmentsTsvParameters. """ diff --git a/src/client/collectors.pyi b/src/client/collectors.pyi index 47aac875..a3249ac1 100644 --- a/src/client/collectors.pyi +++ b/src/client/collectors.pyi @@ -19,6 +19,9 @@ import typing import uuid +def _captcha_deprecation_warning(*args, **kwargs): ... + + class CollectorConfig(toloka.client.primitives.base.BaseParameters): """Base class for all collectors. @@ -325,7 +328,7 @@ class AssignmentSubmitTime(CollectorConfig): class Captcha(CollectorConfig): - """Collects captcha statistics for every Toloker. + """Deprecated. Collects captcha statistics for every Toloker. Captcha provides an advanced protection against robots. It is used with conditions: * [StoredResultsCount](toloka.client.conditions.StoredResultsCount.md) — How many times the Toloker entered a captcha. @@ -377,6 +380,8 @@ class Captcha(CollectorConfig): _unexpected: typing.Optional[typing.Dict[str, typing.Any]] history_size: typing.Optional[int] + def __attrs_post_init__(*args, **kwargs): ... + @typing.overload def __init__( self, diff --git a/src/client/conditions.pyi b/src/client/conditions.pyi index 7bc272c4..42d9bb0b 100644 --- a/src/client/conditions.pyi +++ b/src/client/conditions.pyi @@ -253,7 +253,7 @@ class CorrectAnswersRate(ComparableRuleCondition): class FailRate(ComparableRuleCondition): - """The percentage of unsolved captchas. + """Deprecated. The percentage of unsolved captchas. `FailRate` is used with collectors: - [Captcha](toloka.client.collectors.Captcha.md) @@ -558,7 +558,7 @@ class SkippedInRowCount(ComparableRuleCondition): class StoredResultsCount(ComparableRuleCondition): - """The number of times a Toloker entered captcha. + """Deprecated. The number of times a Toloker entered captcha. `StoredResultsCount` is used with collectors: - [Captcha](toloka.client.collectors.Captcha.md) @@ -594,7 +594,7 @@ class SubmittedAssignmentsCount(ComparableRuleCondition): class SuccessRate(ComparableRuleCondition): - """A percentage of solved captchas out of all entered captchas. + """Deprecated. A percentage of solved captchas out of all entered captchas. `SuccessRate` is used with collectors: - [Captcha](toloka.client.collectors.Captcha.md) diff --git a/src/client/pool/__init__.pyi b/src/client/pool/__init__.pyi index 52d814cc..a4c4222a 100644 --- a/src/client/pool/__init__.pyi +++ b/src/client/pool/__init__.pyi @@ -9,6 +9,7 @@ __all__ = [ 'MixerConfig', 'SpeedQualityBalanceConfig', ] +import attr._make import datetime import toloka.client.filter import toloka.client.owner @@ -34,97 +35,93 @@ from toloka.client.pool.speed_quality_balance_config import SpeedQualityBalanceC class Pool(toloka.client.primitives.base.BaseTolokaObject): - """A set of tasks that are issued and checked according to the same rules within the project + """A set of [tasks](toloka.client.task.Task.md) that share the same properties. - Groups tasks by the following criteria: one-time start-up, which Tolokers can perform tasks, quality control, - price for TaskSuite's, overlap. - Tasks, golden tasks and assignments are related to a pool. + In the pool properties, you set the task price, overlap, Toloker selection filters, quality control rules, and so on. + + Pool tasks are grouped into [task suites](toloka.client.task_suite.TaskSuite.md). Whole task suites are assigned to Tolokers. + + Learn more in the Requester's guide about: + * [Pools](https://toloka.ai/en/docs/guide/concepts/pool-main) + * [Pricing](https://toloka.ai/en/docs/guide/concepts/dynamic-pricing) Attributes: - project_id: ID of the project that the pool was created for. - private_name: Name of the pool (only visible to the requester). - may_contain_adult_content: Whether the tasks contain adult content. - reward_per_assignment: Payment per task suite in U.S. dollars. For cents, use the dot (".") as the separator. - The minimum payment is $0.01. - Only training and control tasks can be uploaded to zero-price pools. - assignment_max_duration_seconds: The time allowed for completing a task suite, in seconds. - Tasks not completed within this time are reassigned to other Tolokers. - We recommend allowing no more than 60 seconds per task suite (including the time for page loading - and sending responses). - defaults: Settings that are applied by default when uploading new task suites to a pool. - will_expire: The date and time in UTC when the pool should be closed (even if all the task suites haven't - been completed). - private_comment: Comments on the pool (only visible to the requester). - public_description: Description for Tolokers. If it is filled in, the text will be displayed instead of - the project's public_description in the list of tasks for Tolokers. - public_instructions: Optional[str] - auto_close_after_complete_delay_seconds: Waiting time (in seconds) before automatic closure of the pool - after all tasks are completed. Minimum — 0, maximum — 259200 seconds (three days). - Use it if: - * Your data processing is close to real time. - * You need an open pool where you upload tasks. - * Dynamic overlap is enabled in the pool (dynamic_overlap_config). + project_id: The ID of the project containing the pool. + private_name: The pool name. It is visible to the requester and is not visible to Tolokers. + may_contain_adult_content: The presence of adult content. + reward_per_assignment: Payment in US dollars for a Toloker for completing a task suite. For cents, use the dot as a separator. + If the pool `type` is `REGULAR`, the minimum payment per task suite is $0.005. For other pool types, you can set the `reward_per_assignment` to zero. + assignment_max_duration_seconds: Time limit to complete one task suite. + Take into account loading a page with a task suite and sending responses to the server. It is recommended that you set at least 60 seconds. + Tasks not completed within the limit are reassigned to other Tolokers. + defaults: Default settings that are applied to new tasks in the pool. + will_expire: The UTC date and time when the pool is closed automatically, even if not all tasks are completed. + private_comment: A comment about the pool. It is visible to the requester and is not visible to Tolokers. + public_description: The pool description. If pool's `public_description` is not set, then project's `public_description` is used. + public_instructions: The pool instructions for Tolokers. If pool's `public_instructions` is not set, then project's `public_instructions` is used. + auto_close_after_complete_delay_seconds: The pool remains open after all tasks are completed during the specified time in seconds. + + Use non zero value if: + * You process data in real time. + * The pool must stay open so that you can upload new tasks. + * Dynamic overlap is enabled in the pool. + + Allowed range: from 0 to 259200 seconds (3 days). The default value is 0. dynamic_pricing_config: The dynamic pricing settings. - auto_accept_solutions: Whether tasks must be checked manually: - * True - Automatic task acceptance (manual checking isn't necessary). - * False - The requester will check the tasks. - auto_accept_period_day: Optional[int] + auto_accept_solutions: + * True — Responses from Tolokers are accepted or rejected automatically based on some rules. + * False — Responses are checked manually. Time reserved for checking is limited by the `auto_accept_period_day` parameter. + Learn more about [non-automatic acceptance](https://toloka.ai/en/docs/guide/concepts/offline-accept). + auto_accept_period_day: The number of days reserved for checking responses if the `auto_accept_solutions` parameter is set to `False`. assignments_issuing_config: Settings for assigning tasks in the pool. - priority: The priority of the pool in relation to other pools in the project with the same task - price and set of filters. Tolokers are assigned tasks with a higher priority first. - Possible values: from -100 to 100. - If the project has multiple pools, the order for completing them depends on the parameters: - * Pools with identical filter settings and price per task are assigned to Tolokers in the order - in which they were started. The pool that was started earlier will be completed sooner. - You can change the order for completing the pools. - * Pools with different filter settings and/or a different price per task are sent out for completion - when the pool opens. + priority: The priority of the pool in relation to other pools in the project with the same task price and set of filters. + Tolokers are assigned tasks with a higher priority first. + + Allowed range: from 0 to 100. The default value is 0. filter: Settings for Toloker selection filters. quality_control: Settings for quality control rules and the ID of the pool with training tasks. - speed_quality_balance: Settings for balance between speed and quality of pool done. - dynamic_overlap_config: Dynamic overlap setting. Allows you to change the overlap depending on - how well Tolokers handle the task. - mixer_config: Parameters for automatically creating a task suite (“smart mixing”). - training_config: Optional[TrainingConfig] - metadata: Optional[Dict[str, List[str]]] - owner: Optional[Owner] - id: Pool ID. Read only field. - status: Status of the pool. Read only field. - last_close_reason: The reason for closing the pool the last time. Read only field. - created: When this pool was created. Read only field. - last_started: The date and time when the pool was last started. Read only field. - last_stopped: The date and time when the pool was last stopped. Read only field. - type: Types of pool. Read only field. + speed_quality_balance: Settings for choosing Tolokers for your tasks. + dynamic_overlap_config: Dynamic overlap settings. + mixer_config: Parameters for automatically creating task suites. + training_config: Additional settings for linked training. + metadata: A dictionary with metadata. + owner: The pool owner. + id: The ID of the pool. Read-only field. + status: The status of the pool. Read-only field. + last_close_reason: A reason why the pool was closed last time. Read-only field. + created: The UTC date and time when the pool was created. Read-only field. + last_started: The UTC date and time when the pool was started last time. Read-only field. + last_stopped: The UTC date and time when the pool was stopped last time. Read-only field. + type: The type of the pool. Deprecated. Example: - How to create a new pool in a project. + Creating a new pool. - >>> toloka_client = toloka.TolokaClient(your_token, 'PRODUCTION') - >>> new_pool = toloka.pool.Pool( - >>> project_id=existing_project_id, - >>> private_name='Pool 1', + >>> new_pool = toloka.client.Pool( + >>> project_id='1', + >>> private_name='Experimental pool', >>> may_contain_adult_content=False, >>> will_expire=datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(days=365), >>> reward_per_assignment=0.01, >>> assignment_max_duration_seconds=60*20, - >>> defaults=toloka.pool.Pool.Defaults(default_overlap_for_new_task_suites=3), - >>> filter=toloka.filter.Languages.in_('EN'), + >>> defaults=toloka.client.Pool.Defaults(default_overlap_for_new_task_suites=3), + >>> filter=toloka.client.filter.Languages.in_('EN'), >>> ) >>> new_pool.set_mixer_config(real_tasks_count=10) - >>> new_pool.quality_control.add_action(...) >>> new_pool = toloka_client.create_pool(new_pool) >>> print(new_pool.id) ... """ class AssignmentsIssuingConfig(toloka.client.primitives.base.BaseTolokaObject): - """Settings for assigning tasks in the pool. + """Settings for assigning task suites in the pool. Attributes: - issue_task_suites_in_creation_order: For pools that don't use “smart mixing”. - Assign task suites in the order in which they were uploaded. For example, for a pool with an - overlap of 5, the first task suite is assigned to five Tolokers, then the second task suite, and so on. - This parameter is available when the project has "assignments_issuing_type": "AUTOMATED". + issue_task_suites_in_creation_order: + Task suites are assigned in the order in which they were created. + + This parameter is used when tasks are [grouped into suites](https://toloka.ai/en/docs/guide/concepts/distribute-tasks-by-pages) + manually and the `assignments_issuing_type` project parameter is set to `AUTOMATED`. """ def __init__(self, issue_task_suites_in_creation_order: typing.Optional[bool] = None) -> None: @@ -136,16 +133,16 @@ class Pool(toloka.client.primitives.base.BaseTolokaObject): issue_task_suites_in_creation_order: typing.Optional[bool] class CloseReason(toloka.util._extendable_enum.ExtendableStrEnum): - """The reason for closing the pool the last time: + """The reason for closing the pool. Attributes: - MANUAL: Closed by the requester. - EXPIRED: Reached the date and time set in will_expire. - COMPLETED: Closed automatically because all the pool tasks were completed. - NOT_ENOUGH_BALANCE: Closed automatically because the Toloka account ran out of funds. - ASSIGNMENTS_LIMIT_EXCEEDED: Closed automatically because it exceeded the limit on assigned task suites - (maximum of 2 million). - BLOCKED: Closed automatically because the requester's account was blocked by a Toloka administrator. + MANUAL: A pool was closed by a requester. + EXPIRED: The lifetime of the pool expired. + COMPLETED: All tasks were completed. + NOT_ENOUGH_BALANCE: There is not enough money to run the pool. + ASSIGNMENTS_LIMIT_EXCEEDED: A limit of 2 million assignments is reached. + BLOCKED: The requester's account was blocked. + FOR_UPDATE: Pool parameters are changing at the moment. """ MANUAL = 'MANUAL' @@ -157,13 +154,13 @@ class Pool(toloka.client.primitives.base.BaseTolokaObject): FOR_UPDATE = 'FOR_UPDATE' class Defaults(toloka.client.primitives.base.BaseTolokaObject): - """Settings that are applied by default when uploading new task suites to a pool. + """Default settings that are applied to new tasks and task suites in a pool. + + These settings are used when tasks or task suites are created with `allow_defaults=True`. Attributes: - default_overlap_for_new_task_suites: The overlap for task suites that are uploaded to the pool - (used if the allow_defaults=True parameter is set when uploading). - default_overlap_for_new_tasks: The overlap for tasks that are uploaded to the pool - (used if the allow_defaults=True parameter is set when uploading). + default_overlap_for_new_task_suites: The default overlap of a task suite. + default_overlap_for_new_tasks: The default overlap of a task. """ def __init__( @@ -181,13 +178,13 @@ class Pool(toloka.client.primitives.base.BaseTolokaObject): default_overlap_for_new_tasks: typing.Optional[int] class Status(toloka.util._extendable_enum.ExtendableStrEnum): - """Status of the pool + """The status of a pool. Attributes: - OPEN: Pool is open - CLOSED: Pool is closed - ARCHIVED: Pool is archived - LOCKED: Pool is locked + OPEN: The pool is open. + CLOSED: The pool is closed. + ARCHIVED: The pool is archived. + LOCKED: The pool is locked. """ OPEN = 'OPEN' @@ -205,7 +202,7 @@ class Pool(toloka.client.primitives.base.BaseTolokaObject): training_skill_ttl_days: typing.Optional[int] class Type(toloka.util._extendable_enum.ExtendableStrEnum): - """An enumeration. + """The type of a pool. """ REGULAR = 'REGULAR' @@ -285,7 +282,7 @@ class Pool(toloka.client.primitives.base.BaseTolokaObject): may_contain_adult_content: typing.Optional[bool] = None, reward_per_assignment: typing.Optional[float] = None, assignment_max_duration_seconds: typing.Optional[int] = None, - defaults: typing.Optional[Defaults] = ..., + defaults: typing.Optional[Defaults] = attr._make._Nothing.NOTHING, will_expire: typing.Optional[datetime.datetime] = None, private_comment: typing.Optional[str] = None, public_description: typing.Optional[str] = None, @@ -297,7 +294,7 @@ class Pool(toloka.client.primitives.base.BaseTolokaObject): assignments_issuing_config: typing.Optional[AssignmentsIssuingConfig] = None, priority: typing.Optional[int] = None, filter: typing.Optional[toloka.client.filter.FilterCondition] = None, - quality_control: typing.Optional[toloka.client.quality_control.QualityControl] = ..., + quality_control: typing.Optional[toloka.client.quality_control.QualityControl] = attr._make._Nothing.NOTHING, speed_quality_balance: typing.Optional[toloka.client.pool.speed_quality_balance_config.SpeedQualityBalanceConfig] = None, dynamic_overlap_config: typing.Optional[toloka.client.pool.dynamic_overlap_config.DynamicOverlapConfig] = None, mixer_config: typing.Optional[toloka.client.pool.mixer_config.MixerConfig] = None, @@ -386,7 +383,7 @@ class Pool(toloka.client.primitives.base.BaseTolokaObject): *, training_requirement: typing.Optional[toloka.client.quality_control.QualityControl.TrainingRequirement] = None, captcha_frequency: typing.Union[toloka.client.quality_control.QualityControl.CaptchaFrequency, str, None] = None, - configs: typing.Optional[typing.List[toloka.client.quality_control.QualityControl.QualityControlConfig]] = ..., + configs: typing.Optional[typing.List[toloka.client.quality_control.QualityControl.QualityControlConfig]] = attr._make._Nothing.NOTHING, checkpoints_config: typing.Optional[toloka.client.quality_control.QualityControl.CheckpointsConfig] = None ): """A shortcut setter for quality_control @@ -517,22 +514,13 @@ class Pool(toloka.client.primitives.base.BaseTolokaObject): class PoolPatchRequest(toloka.client.primitives.base.BaseTolokaObject): - """Class for changing the priority of the pool issue + """New pool parameters. - To do this use TolokaClient.patch_pool(). You can use expanded version, then pass "priority" directly to "patch_pool". + This class is used with the [patch_pool](toloka.client.TolokaClient.patch_pool.md) method. Attributes: - priority: The priority of the pool in relation to other pools in the project with the same task - price and set of filters. Tolokers are assigned tasks with a higher priority first. + priority: The new priority of the pool. Possible values: from -100 to 100. - - Example: - How to set highest priority to some pool. - - >>> toloka_client = toloka.TolokaClient(your_token, 'PRODUCTION') - >>> patched_pool = toloka_client.patch_pool(existing_pool_id, 100) - >>> print(patched_pool.priority) - ... """ def __init__(self, priority: typing.Optional[int] = None) -> None: diff --git a/src/client/pool/dynamic_overlap_config.pyi b/src/client/pool/dynamic_overlap_config.pyi index d768f317..eacf2e94 100644 --- a/src/client/pool/dynamic_overlap_config.pyi +++ b/src/client/pool/dynamic_overlap_config.pyi @@ -7,42 +7,44 @@ import typing class DynamicOverlapConfig(toloka.client.primitives.base.BaseTolokaObject): - """Dynamic overlap setting. + """Dynamic overlap settings. + + Toloka can automatically increase an overlap of tasks if the confidence level of aggregated responses is not high enough. + + Dynamic overlap uses the `BASIC` algorithm. + Each response is assigned a weight depending on the Toloker's skill value. + The aggregated response confidence is calculated based on the probability algorithm. + The task overlap increases until it reaches `max_overlap` or until the confidence of the aggregated response exceeds `min_confidence`. + + Note, that if you use dynamic overlap, then set the `auto_close_after_complete_delay_seconds` pool parameter to a non zero value. + + Learn more about the [Dynamic overlap](https://toloka.ai/en/docs/guide/concepts/dynamic-overlap) in the guide. - Allows you to change the overlap depending on how well Tolokers handle the task. - Set the closing interval (auto_close_after_complete_delay_seconds). It should be enough to complete tasks - with an overlap higher than the minimum. - When all pool tasks are completed, aggregate the responses. Attributes: - type: The algorithm for dynamic overlap. - max_overlap: Maximum overlap. Must be higher than the values in defaults. Minimum — 1. Maximum — 30000. - min_confidence: Minimum confidence of the aggregated response. Values from 0 to 1. - answer_weight_skill_id: A skill that determines the weight of the Toloker's response. For best results, use - a skill calculated as percentage of correct responses in control tasks. - fields: Output data fields to use for aggregating responses. + type: The dynamic overlap algorithm. + max_overlap: Maximum overlap. The value must be higher than the default overlap value. Allowed range: from 1 to 30,000. + min_confidence: Minimum required confidence of the aggregated response. Allowed range: from 0 to 1. + answer_weight_skill_id: A skill that determines the weight of the Toloker's responses. + For the best results, use a skill calculated as a percentage of correct responses in control tasks. + fields: A list of output data fields used for aggregating responses. + For the best results, each field must have a limited number of response options. + Don't specify fields in the list together if they depend on each other. """ class Type(toloka.util._extendable_enum.ExtendableStrEnum): """The algorithm for dynamic overlap. Attributes: - BASIC: Each response is assigned a weight depending on the Toloker's skill value. - The aggregated response confidence is calculated based on the probability algorithm. The task overlap - increases until it reaches max_overlap or until the confidence of the aggregated response - exceeds min_confidence. - You have to specify max_overlap, min_confidence, answer_weight_skill_id and fields. + BASIC: The algorithm based on a Toloker's skill value. """ BASIC = 'BASIC' class Field(toloka.client.primitives.base.BaseTolokaObject): - """Output data fields to use for aggregating responses. + """An output data field used for aggregating responses. - For best results, each of these fields must - have a limited number of response options. - Don't specify several fields if their values depend on each other. Attributes: - name: The output data field name. + name: The name of the output field. """ def __init__(self, name: typing.Optional[str] = None) -> None: diff --git a/src/client/pool/dynamic_pricing_config.pyi b/src/client/pool/dynamic_pricing_config.pyi index 6e994a3f..8a0d7ef4 100644 --- a/src/client/pool/dynamic_pricing_config.pyi +++ b/src/client/pool/dynamic_pricing_config.pyi @@ -9,27 +9,31 @@ import typing class DynamicPricingConfig(toloka.client.primitives.base.BaseTolokaObject): """The dynamic pricing settings. + A price per task suite can be variable depending on a Toloker's skill. + If a Toloker is not covered by dynamic pricing settings then the default price is used. It is set in the `reward_per_assignment` pool parameter. + Attributes: - type: Parameter type for calculating dynamic pricing. The SKILL value. - skill_id: ID of the skill that the task price is based on - intervals: Skill level intervals. Must not overlap. - A Toloker with a skill level that is not included in any interval will receive the basic - price for a task suite. + type: The dynamic pricing type. Only `SKILL` type is supported now. + skill_id: The ID of the skill that dynamic pricing is based on. + intervals: A list of skill intervals and prices. + The intervals must not overlap. """ class Type(toloka.util._extendable_enum.ExtendableStrEnum): - """Dynamic pricing type + """Dynamic pricing type. """ SKILL = 'SKILL' class Interval(toloka.client.primitives.base.BaseTolokaObject): - """Skill level interval + """Skill level interval with the associated price per task suite. + + The lower and upper skill bounds are included in the interval. Attributes: - from_: Lower bound of the interval. - to: dynamic_pricing_config.intervals.to - reward_per_assignment: The price per task page for a Toloker with the specified skill level. + from_: The lower bound of the interval. + to: The upper bound of the interval. + reward_per_assignment: The price per task suite for a Toloker with the specified skill level. """ def __init__( diff --git a/src/client/pool/mixer_config.pyi b/src/client/pool/mixer_config.pyi index 6ba907cc..d6cb2b10 100644 --- a/src/client/pool/mixer_config.pyi +++ b/src/client/pool/mixer_config.pyi @@ -7,47 +7,46 @@ import typing class MixerConfig(toloka.client.primitives.base.BaseTolokaObject): - """Parameters for automatically creating a task suite ("smart mixing"). + """Settings for automatically grouping tasks into suites (smart mixing). - For more information about creating task see Toloka Requester's guide. + You can set the number of general, training and control tasks in a task suite. Also, you control task shuffling and other settings. Attributes: - real_tasks_count: The number of main tasks to put in a task suite. - The maximum number of tasks in a task suite if training_task_distribution_function or - golden_task_distribution_function are used. - golden_tasks_count: The number of control ("golden set") tasks to put in a task suite. - training_tasks_count: The number of training tasks to put in a task suite. - min_real_tasks_count: Minimum number of main tasks in a task suite (if the number of assignments left is less - than the one specified in real_tasks_count). Minimum — 0. By default, the value is the same as in - real_tasks_count. - min_golden_tasks_count: Minimum number of control tasks in a task suite (if the number of assignments left is - less than the one specified in golden_tasks_count). Minimum — 0. By default, the value is the same as - in golden_tasks_count. - min_training_tasks_count: Minimum number of training tasks in a task suite (if the number of assignments left is - less than the one specified in golden_tasks_count). Minimum — 0. By default, the value is the same - as in training_tasks_count. - force_last_assignment: Setup for the last set of tasks in the pool, if less than the minimum remaining number of - tasks are not completed (mixer_config.min_real_tasks_count). Values: - * true - issue an incomplete task set. - * false - don't issue tasks. This option can be used if you are adding tasks after the pool is started. - This parameter only applies to main tasks. The number of control and training tasks in the last set must be - complete (golden_tasks_count, training_tasks_count). - force_last_assignment_delay_seconds: Waiting time (in seconds) since the addition of the task, or increase in - the overlap, prior to the issuance of the last set of tasks in the pool. The minimum is 0, the maximum is - 86,400 seconds (one day). - This parameter can be used if the pool has force_last_assignment: True. - mix_tasks_in_creation_order: The order for including tasks in suites: - * True — Add tasks to suites in the order in which they were uploaded. For example, in a pool with an - overlap of 5, the first uploaded task will be included in the first 5 task suites. They will be - assigned to 5 Tolokers. - * False — Add tasks to suites in random order. - shuffle_tasks_in_task_suite: The order of tasks within a suite: - * True — Random. - * False — The order in which tasks were uploaded. - golden_task_distribution_function: Issue of control tasks with uneven frequency. The option allows you to change - the frequency of checking as the Toloker completes more tasks. - training_task_distribution_function: Issue of training tasks with uneven frequency. The option allows you to - change the frequency of training tasks as the Toloker completes more tasks. + real_tasks_count: The number of general tasks in a task suite. + + If `training_task_distribution_function` or `golden_task_distribution_function` are used then `real_tasks_count` denotes the maximum number of tasks in a task suite. + golden_tasks_count: The number of control tasks in a task suite. + training_tasks_count: The number of training tasks in a task suite. + min_real_tasks_count: The minimum number of general tasks in a task suite if there are not enough tasks left to create a full task suite. + + Allowed range: from 0 to `real_tasks_count`. + By default, the `min_real_tasks_count` value equals to the `real_tasks_count` value. + min_golden_tasks_count: The minimum number of control tasks in a task suite if there are not enough control tasks left to create a full task suite. + + Allowed range: from 0 to `golden_tasks_count`. + By default, the `min_golden_tasks_count` value equals to the `golden_tasks_count` value. + min_training_tasks_count: The minimum number of training tasks in a task suite if there are not enough training tasks left to create a full task suite. + + Allowed range: from 0 to `training_tasks_count`. + By default, the `min_training_tasks_count` value equals to the `training_tasks_count` value. + force_last_assignment: A setting used when the number of remaining general tasks in the pool is less than the `min_real_tasks_count` value. + Note, that there must be enough control and training tasks to create a task suite. + + * True — An incomplete task suite is assigned. + * False — An incomplete task suite is not assigned. It is useful if you add tasks to an open pool. + + Default: `True`. + force_last_assignment_delay_seconds: Time in seconds before assigning the last task suite. This parameter is used if `force_last_assignment` is set to `True`. + + Allowed range: from 0 to 86,400 seconds (one day). + mix_tasks_in_creation_order: + * True — Tasks are grouped in task suites in the order they were created. + * False — Tasks are chosen for a task suite in a random order. + shuffle_tasks_in_task_suite: + * True — Tasks in a task suite are shuffled on the page. + * False — Tasks in a task suite are placed on the page in the order they were created. + golden_task_distribution_function: Customizing the number of control tasks in a task suite depending on completed tasks by a Toloker. + training_task_distribution_function: Customizing the number of training tasks in a task suite depending on completed tasks by a Toloker. """ def __init__( diff --git a/src/client/pool/speed_quality_balance_config.pyi b/src/client/pool/speed_quality_balance_config.pyi index 417995d6..cd0432f6 100644 --- a/src/client/pool/speed_quality_balance_config.pyi +++ b/src/client/pool/speed_quality_balance_config.pyi @@ -9,15 +9,20 @@ import typing class SpeedQualityBalanceConfig(toloka.client.primitives.base.BaseTolokaObject): - """Adjust balance between speed and quality. + """A configuration of selecting Tolokers based on a personalized quality forecast. + + Tolokers are sorted by their quality forecast. You can limit the number of the best Tolokers who have access to your tasks. + It influences quality of results and speed of getting results. + + Learn more about [Speed/quality balance](https://toloka.ai/en/docs/guide/concepts/adjust). """ class Type(toloka.util._extendable_enum.ExtendableStrEnum): - """The type of speed quality balance: + """The type of the filter used in [SpeedQualityBalanceConfig](toloka.client.pool.speed_quality_balance_config.SpeedQualityBalanceConfig.md). Attributes: - TOP_PERCENTAGE_BY_QUALITY: get top XX% Tolokers by quality. - BEST_CONCURRENT_USERS_BY_QUALITY: get top x Tolokers by quality. + TOP_PERCENTAGE_BY_QUALITY: A percentage of the best Tolokers is configured. + BEST_CONCURRENT_USERS_BY_QUALITY: A maximum number of the best Tolokers is configured. """ TOP_PERCENTAGE_BY_QUALITY = 'TOP_PERCENTAGE_BY_QUALITY' @@ -32,7 +37,7 @@ class SpeedQualityBalanceConfig(toloka.client.primitives.base.BaseTolokaObject): class TopPercentageByQuality(SpeedQualityBalanceConfig): - """The percentage of Tolokers ordered by quality that will work on pool. + """`SpeedQualityBalanceConfig` that uses percentage of Tolokers. """ def __init__(self, *, percent: typing.Optional[int] = None) -> None: @@ -45,7 +50,7 @@ class TopPercentageByQuality(SpeedQualityBalanceConfig): class BestConcurrentUsersByQuality(SpeedQualityBalanceConfig): - """How many concurrent Tolokers ordered by quality will work on pool. + """`SpeedQualityBalanceConfig` that uses a maximum number of Tolokers. """ def __init__(self, *, count: typing.Optional[int] = None) -> None: diff --git a/src/client/project/localization.pyi b/src/client/project/localization.pyi index 1be6ebdf..afcd960d 100644 --- a/src/client/project/localization.pyi +++ b/src/client/project/localization.pyi @@ -2,6 +2,7 @@ __all__ = [ 'AdditionalLanguage', 'LocalizationConfig', ] +import attr._make import enum import toloka.client.primitives.base import typing @@ -37,7 +38,7 @@ class AdditionalLanguage(toloka.client.primitives.base.BaseTolokaObject): self, *, value: typing.Optional[str] = None, - source: typing.Union[Source, str, None] = ... + source: typing.Union[Source, str, None] = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class AdditionalLanguage.FieldTranslation. """ @@ -82,7 +83,7 @@ class LocalizationConfig(toloka.client.primitives.base.BaseTolokaObject): self, *, default_language: typing.Optional[str] = None, - additional_languages: typing.Optional[typing.List[AdditionalLanguage]] = ... + additional_languages: typing.Optional[typing.List[AdditionalLanguage]] = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class LocalizationConfig. """ diff --git a/src/client/project/template_builder/plugins.pyi b/src/client/project/template_builder/plugins.pyi index 9c87f2be..130f5f70 100644 --- a/src/client/project/template_builder/plugins.pyi +++ b/src/client/project/template_builder/plugins.pyi @@ -6,6 +6,7 @@ __all__ = [ 'TriggerPluginV1', 'TolokaPluginV1', ] +import attr._make import toloka.client.project.template_builder.base import toloka.util._extendable_enum import typing @@ -337,7 +338,7 @@ class TolokaPluginV1(BasePluginV1): @typing.overload def __init__( self, - layout: typing.Optional[typing.Union[toloka.client.project.template_builder.base.BaseComponent, TolokaPluginLayout]] = ..., + layout: typing.Optional[typing.Union[toloka.client.project.template_builder.base.BaseComponent, TolokaPluginLayout]] = attr._make._Nothing.NOTHING, *, notifications: typing.Optional[typing.Union[toloka.client.project.template_builder.base.BaseComponent, typing.List[toloka.client.project.template_builder.base.BaseComponent]]] = None, version: typing.Optional[str] = '1.0.0' diff --git a/src/client/quality_control.pyi b/src/client/quality_control.pyi index 0f73fe0b..12cca040 100644 --- a/src/client/quality_control.pyi +++ b/src/client/quality_control.pyi @@ -1,6 +1,7 @@ __all__ = [ 'QualityControl', ] +import attr._make import toloka.client.actions import toloka.client.collectors import toloka.client.conditions @@ -18,7 +19,7 @@ class QualityControl(toloka.client.primitives.base.BaseTolokaObject): Attributes: training_requirement: Parameters of the training pool that is linked to the pool with the main tasks. - captcha_frequency: Frequency of captcha display (By default, captcha is not shown): + captcha_frequency: Deprecated. Frequency of captcha display (By default, captcha is not shown): LOW - show every 20 tasks. MEDIUM, HIGH - show every 10 tasks. configs: List of quality control units. See QualityControl.QualityControlConfig @@ -202,7 +203,7 @@ class QualityControl(toloka.client.primitives.base.BaseTolokaObject): *, training_requirement: typing.Optional[TrainingRequirement] = None, captcha_frequency: typing.Union[CaptchaFrequency, str, None] = None, - configs: typing.Optional[typing.List[QualityControlConfig]] = ..., + configs: typing.Optional[typing.List[QualityControlConfig]] = attr._make._Nothing.NOTHING, checkpoints_config: typing.Optional[CheckpointsConfig] = None ) -> None: """Method generated by attrs for class QualityControl. diff --git a/src/client/task_suite.pyi b/src/client/task_suite.pyi index 60f00f44..77298723 100644 --- a/src/client/task_suite.pyi +++ b/src/client/task_suite.pyi @@ -4,6 +4,7 @@ __all__ = [ 'TaskSuiteOverlapPatch', 'TaskSuitePatch', ] +import attr._make import datetime import toloka.client.primitives.base import toloka.client.primitives.infinite_overlap @@ -62,7 +63,7 @@ class TaskSuite(toloka.client.primitives.infinite_overlap.InfiniteOverlapParamet infinite_overlap=None, overlap=None, pool_id: typing.Optional[str] = None, - tasks: typing.Optional[typing.List[toloka.client.task.BaseTask]] = ..., + tasks: typing.Optional[typing.List[toloka.client.task.BaseTask]] = attr._make._Nothing.NOTHING, reserved_for: typing.Optional[typing.List[str]] = None, unavailable_for: typing.Optional[typing.List[str]] = None, issuing_order_override: typing.Optional[float] = None, diff --git a/src/client/training.pyi b/src/client/training.pyi index 175cccd5..97ab92c9 100644 --- a/src/client/training.pyi +++ b/src/client/training.pyi @@ -9,53 +9,63 @@ import typing class Training(toloka.client.primitives.base.BaseTolokaObject): - """Training pool + """A training. - Allows: - - Select for the main pool only those Tolokers who successfully complete the training tasks. - - Practice Tolokers before the main pool and figure out how to respond correctly. + A training is a pool containing tasks with known solutions and hints for Tolokers. Use trainings: + - To train Tolokers so they solve general tasks better. + - To select Tolokers who successfully completed training tasks and to give them access to a general pool. + + To link a training to a general pool set the + [Pool](toloka.client.pool.Pool.md).[quality_control](toloka.client.quality_control.QualityControl.md).[training_requirement](toloka.client.quality_control.QualityControl.TrainingRequirement.md) + parameter. + + For more information, see [Adding a training](https://toloka.ai/en/docs/guide/concepts/train). Attributes: - project_id: ID of the project to which the training pool belongs. - private_name: Training pool name (only visible to the requester). - may_contain_adult_content: The presence of adult content in learning tasks. - assignment_max_duration_seconds: Time to complete a set of tasks in seconds. - It is recommended to allocate at least 60 seconds for a set of tasks - (taking into account the time for loading the page, sending responses). - mix_tasks_in_creation_order: The order in which tasks are included in sets: - * True - Default behavior. Include tasks in sets in the order they were loaded. - * False - Include tasks in sets in random order. - shuffle_tasks_in_task_suite: Order of tasks within the task set: - * true - Random. Default behavior. - * false - The order in which the tasks were loaded. - training_tasks_in_task_suite_count: The number of tasks in the set. - task_suites_required_to_pass: The number of task suites that must be successfully completed to assign a skill - and access the main tasks. - retry_training_after_days: After how many days the replay will become available. - inherited_instructions: Indicates whether to use a project statement. - If training need their own instruction, then specify it in public_instructions. Default value - False. - public_instructions: Instructions for completing training tasks. May contain HTML markup. - metadata: - owner: Training pool owner. - id: Internal ID of the training pool. Read only. - status: Training pool status. Read only. - last_close_reason: The reason the training pool was last closed. - created: UTC date and time of creation of the training pool in ISO 8601 format. Read only. - last_started: UTC date and time of the last start of the training pool in ISO 8601 format. Read only. - last_stopped: UTC date and time of the last stop of the training pool in ISO 8601 format. Read only. + project_id: The ID of the project containing the training. + private_name: The training name. It is visible to the requester only. + may_contain_adult_content: The presence of adult content. + assignment_max_duration_seconds: Time limit to complete a task suite. + Take into account loading a page with a task suite and sending responses to the server. It is recommended that you set at least 60 seconds. + mix_tasks_in_creation_order: + * True — Tasks are grouped in suites in the order they were created. + * False — Tasks are chosen for a task suite in a random order. + + Default: `True`. + shuffle_tasks_in_task_suite: + * True — Tasks from a task suite are shuffled on the page. + * False — Tasks from a task suite are placed on the page in the order they were created. + + Default: `True`. + training_tasks_in_task_suite_count: The number of training tasks in one task suite. + task_suites_required_to_pass: The number of task suites that must be completed by a Toloker to get a training skill. + retry_training_after_days: The training can be completed again after the specified number of days to update the training skill. + If the parameter is not specified, then the training skill is issued for an unlimited time. + inherited_instructions: + * True — Project instructions are used in the training. + * False — Instruction, specified in the `public_instructions` parameter, are used. + + Default: `False`. + public_instructions: Instructions for Tolokers used when the `inherited_instructions` parameter is False. Describe in the instructions how to complete training tasks. + You can use HTML markup inside `public_instructions`. + metadata: A dictionary with metadata. + owner: The training owner. + id: The ID of the training. Read only. + status: The training status. Read only. + last_close_reason: A reason why the training was closed last time. Read only. + created: The UTC date and time when the training was created. Read only. + last_started: The UTC date and time when the training was started last time. Read only. + last_stopped: The UTC date and time when the training was stopped last time. Read only. """ class CloseReason(toloka.util._extendable_enum.ExtendableStrEnum): - """The reason for closing the pool the last time: + """A reason for closing a training. Attributes: - MANUAL: Closed by the requester. - EXPIRED: Reached the date and time set in will_expire. - COMPLETED: Closed automatically because all the pool tasks were completed. - NOT_ENOUGH_BALANCE: Closed automatically because the Toloka account ran out of funds. - ASSIGNMENTS_LIMIT_EXCEEDED: Closed automatically because it exceeded the limit on assigned task suites - (maximum of 2 million). - BLOCKED: Closed automatically because the requester's account was blocked by a Toloka administrator. + MANUAL: A training was closed by a requester. + COMPLETED: All linked pool tasks were completed. + ASSIGNMENTS_LIMIT_EXCEEDED: A limit of 2 millions assignments is reached. + BLOCKED: The requester's account was blocked. """ MANUAL = 'MANUAL' @@ -67,13 +77,12 @@ class Training(toloka.client.primitives.base.BaseTolokaObject): FOR_UPDATE = 'FOR_UPDATE' class Status(toloka.util._extendable_enum.ExtendableStrEnum): - """Status of the training pool + """The status of a training. Attributes: - OPEN: Training pool is open - CLOSED: Training pool is closed - ARCHIVED: Training pool is archived - LOCKED: Training pool is locked + OPEN: The training is open. + CLOSED: The training is closed. + ARCHIVED: The training is archived. """ OPEN = 'OPEN' diff --git a/src/metrics/metrics.pyi b/src/metrics/metrics.pyi index 28e24d61..368e73b0 100644 --- a/src/metrics/metrics.pyi +++ b/src/metrics/metrics.pyi @@ -6,6 +6,7 @@ __all__ = [ 'NewUserBonuses', 'NewUserSkills', ] +import attr._make import datetime import toloka.async_client.client import toloka.client @@ -87,7 +88,7 @@ class BaseMetric: *, toloka_client: toloka.client.TolokaClient = None, atoloka_client: toloka.async_client.client.AsyncTolokaClient = None, - timeout: datetime.timedelta = ... + timeout: datetime.timedelta = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class BaseMetric. """ @@ -132,7 +133,7 @@ class Balance(BaseMetric): *, toloka_client: toloka.client.TolokaClient = None, atoloka_client: toloka.async_client.client.AsyncTolokaClient = None, - timeout: datetime.timedelta = ... + timeout: datetime.timedelta = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class Balance. """ @@ -178,7 +179,7 @@ class NewUserBonuses(BaseMetric): *, toloka_client: toloka.client.TolokaClient = None, atoloka_client: toloka.async_client.client.AsyncTolokaClient = None, - timeout: datetime.timedelta = ... + timeout: datetime.timedelta = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class NewUserBonuses. """ @@ -238,7 +239,7 @@ class NewUserSkills(BaseMetric): *, toloka_client: toloka.client.TolokaClient = None, atoloka_client: toloka.async_client.client.AsyncTolokaClient = None, - timeout: datetime.timedelta = ... + timeout: datetime.timedelta = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class NewUserSkills. """ @@ -311,7 +312,7 @@ class NewMessageThreads(BaseMetric): *, toloka_client: toloka.client.TolokaClient = None, atoloka_client: toloka.async_client.client.AsyncTolokaClient = None, - timeout: datetime.timedelta = ... + timeout: datetime.timedelta = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class NewMessageThreads. """ diff --git a/src/metrics/pool_metrics.pyi b/src/metrics/pool_metrics.pyi index 2447da76..7c2d1e01 100644 --- a/src/metrics/pool_metrics.pyi +++ b/src/metrics/pool_metrics.pyi @@ -8,6 +8,7 @@ __all__ = [ 'TasksInPool', 'WorkersByFilterOnPool', ] +import attr._make import datetime import toloka.async_client.client import toloka.client @@ -25,7 +26,7 @@ class BasePoolMetric(toloka.metrics.metrics.BaseMetric): *, toloka_client: toloka.client.TolokaClient = None, atoloka_client: toloka.async_client.client.AsyncTolokaClient = None, - timeout: datetime.timedelta = ... + timeout: datetime.timedelta = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class BasePoolMetric. """ @@ -89,7 +90,7 @@ class AssignmentEventsInPool(BasePoolMetric): *, toloka_client: toloka.client.TolokaClient = None, atoloka_client: toloka.async_client.client.AsyncTolokaClient = None, - timeout: datetime.timedelta = ... + timeout: datetime.timedelta = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class AssignmentEventsInPool. """ @@ -142,7 +143,7 @@ class PoolCompletedPercentage(BasePoolMetric): *, toloka_client: toloka.client.TolokaClient = None, atoloka_client: toloka.async_client.client.AsyncTolokaClient = None, - timeout: datetime.timedelta = ... + timeout: datetime.timedelta = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class PoolCompletedPercentage. """ @@ -199,7 +200,7 @@ class AssignmentsInPool(BasePoolMetric): *, toloka_client: toloka.client.TolokaClient = None, atoloka_client: toloka.async_client.client.AsyncTolokaClient = None, - timeout: datetime.timedelta = ... + timeout: datetime.timedelta = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class AssignmentsInPool. """ @@ -246,7 +247,7 @@ class TasksInPool(BasePoolMetric): *, toloka_client: toloka.client.TolokaClient = None, atoloka_client: toloka.async_client.client.AsyncTolokaClient = None, - timeout: datetime.timedelta = ... + timeout: datetime.timedelta = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class TasksInPool. """ @@ -290,7 +291,7 @@ class SpentBudgetOnPool(BasePoolMetric): *, toloka_client: toloka.client.TolokaClient = None, atoloka_client: toloka.async_client.client.AsyncTolokaClient = None, - timeout: datetime.timedelta = ... + timeout: datetime.timedelta = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class SpentBudgetOnPool. """ @@ -336,7 +337,7 @@ class WorkersByFilterOnPool(BasePoolMetric): *, toloka_client: toloka.client.TolokaClient = None, atoloka_client: toloka.async_client.client.AsyncTolokaClient = None, - timeout: datetime.timedelta = ... + timeout: datetime.timedelta = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class WorkersByFilterOnPool. """ @@ -405,7 +406,7 @@ class BansInPool(BasePoolMetric): *, toloka_client: toloka.client.TolokaClient = None, atoloka_client: toloka.async_client.client.AsyncTolokaClient = None, - timeout: datetime.timedelta = ... + timeout: datetime.timedelta = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class BansInPool. """ diff --git a/src/streaming/cursor.pyi b/src/streaming/cursor.pyi index bfac3a0a..8dc607a2 100644 --- a/src/streaming/cursor.pyi +++ b/src/streaming/cursor.pyi @@ -9,6 +9,7 @@ __all__ = [ 'UserRestrictionCursor', 'UserSkillCursor', ] +import attr._make import datetime import toloka.async_client.client import toloka.client @@ -118,7 +119,7 @@ class AssignmentCursor(BaseCursor): self, toloka_client: typing.Union[toloka.client.TolokaClient, toloka.async_client.client.AsyncTolokaClient], event_type: typing.Any, - request: toloka.client.search_requests.AssignmentSearchRequest = ... + request: toloka.client.search_requests.AssignmentSearchRequest = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class AssignmentCursor. """ @@ -195,7 +196,7 @@ class TaskCursor(BaseCursor): def __init__( self, toloka_client: typing.Union[toloka.client.TolokaClient, toloka.async_client.client.AsyncTolokaClient], - request: toloka.client.search_requests.TaskSearchRequest = ... + request: toloka.client.search_requests.TaskSearchRequest = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class TaskCursor. """ @@ -251,7 +252,7 @@ class UserBonusCursor(BaseCursor): def __init__( self, toloka_client: typing.Union[toloka.client.TolokaClient, toloka.async_client.client.AsyncTolokaClient], - request: toloka.client.search_requests.UserBonusSearchRequest = ... + request: toloka.client.search_requests.UserBonusSearchRequest = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class UserBonusCursor. """ @@ -306,7 +307,7 @@ class UserSkillCursor(BaseCursor): self, toloka_client: typing.Union[toloka.client.TolokaClient, toloka.async_client.client.AsyncTolokaClient], event_type: typing.Any, - request: toloka.client.search_requests.UserSkillSearchRequest = ... + request: toloka.client.search_requests.UserSkillSearchRequest = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class UserSkillCursor. """ @@ -364,7 +365,7 @@ class UserRestrictionCursor(BaseCursor): def __init__( self, toloka_client: typing.Union[toloka.client.TolokaClient, toloka.async_client.client.AsyncTolokaClient], - request: toloka.client.search_requests.UserRestrictionSearchRequest = ... + request: toloka.client.search_requests.UserRestrictionSearchRequest = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class UserRestrictionCursor. """ @@ -418,7 +419,7 @@ class MessageThreadCursor(BaseCursor): def __init__( self, toloka_client: typing.Union[toloka.client.TolokaClient, toloka.async_client.client.AsyncTolokaClient], - request: toloka.client.search_requests.MessageThreadSearchRequest = ... + request: toloka.client.search_requests.MessageThreadSearchRequest = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class MessageThreadCursor. """ diff --git a/src/streaming/pipeline.pyi b/src/streaming/pipeline.pyi index 09b493b0..fdbee30e 100644 --- a/src/streaming/pipeline.pyi +++ b/src/streaming/pipeline.pyi @@ -2,6 +2,7 @@ __all__ = [ 'Pipeline', ] import asyncio +import attr._make import datetime import enum import toloka.streaming.observer @@ -150,9 +151,9 @@ class Pipeline: def __init__( self, pipeline_key: str, - workers: typing.Dict[_Worker, None] = ..., - waiting: typing.Dict[_Worker, asyncio.Task] = ..., - pending: typing.Dict[_Worker, datetime.datetime] = ... + workers: typing.Dict[_Worker, None] = attr._make._Nothing.NOTHING, + waiting: typing.Dict[_Worker, asyncio.Task] = attr._make._Nothing.NOTHING, + pending: typing.Dict[_Worker, datetime.datetime] = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class Pipeline.RunState. """ diff --git a/src/streaming/storage.pyi b/src/streaming/storage.pyi index 8a4b12fe..bedbc2e4 100644 --- a/src/streaming/storage.pyi +++ b/src/streaming/storage.pyi @@ -3,6 +3,7 @@ __all__ = [ 'JSONLocalStorage', 'S3Storage', ] +import attr._make import toloka.streaming.locker import typing @@ -99,7 +100,7 @@ class JSONLocalStorage(BaseExternalLockerStorage): self, dirname: str = '/tmp', *, - locker: typing.Optional[toloka.streaming.locker.BaseLocker] = ... + locker: typing.Optional[toloka.streaming.locker.BaseLocker] = attr._make._Nothing.NOTHING ) -> None: """Method generated by attrs for class JSONLocalStorage. """