Skip to content

Commit

Permalink
Merge branch 'main' into 1.2.2_release
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdrydew authored Oct 26, 2023
2 parents 188464e + fc4dc9d commit 2ae135c
Show file tree
Hide file tree
Showing 16 changed files with 618 additions and 70 deletions.
29 changes: 25 additions & 4 deletions docs/en/_includes/toloka-kit-reference-toc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ items:
items:
- name: archive_app_project
href: ../toloka-kit/reference/toloka.client.TolokaClient.archive_app_project.md
- name: unarchive_app_project
href: ../toloka-kit/reference/toloka.client.TolokaClient.unarchive_app_project.md
- name: create_app_batch
href: ../toloka-kit/reference/toloka.client.TolokaClient.create_app_batch.md
- name: patch_app_batch
Expand Down Expand Up @@ -66,8 +68,12 @@ items:
href: ../toloka-kit/reference/toloka.client.TolokaClient.stop_app_batch.md
- name: resume_app_batch
href: ../toloka-kit/reference/toloka.client.TolokaClient.resume_app_batch.md
- name: unarchive_app_project
href: ../toloka-kit/reference/toloka.client.TolokaClient.unarchive_app_project.md
- name: archive_app_batch
href: ../toloka-kit/reference/toloka.client.TolokaClient.archive_app_batch.md
- name: unarchive_app_batch
href: ../toloka-kit/reference/toloka.client.TolokaClient.unarchive_app_batch.md
- name: start_sync_batch_processing
href: ../toloka-kit/reference/toloka.client.TolokaClient.start_sync_batch_processing.md
- name: assignments
items:
- name: accept_assignment
Expand Down Expand Up @@ -408,6 +414,8 @@ items:
- name: _AppError
href: ../toloka-kit/reference/toloka.client.app._AppError.md
hidden: true
- name: BaseApp
href: ../toloka-kit/reference/toloka.client.app.BaseApp.md
- name: App
href: ../toloka-kit/reference/toloka.client.app.App.md
- name: AppLightestResult
Expand All @@ -418,8 +426,13 @@ items:
- name: AppBatch.Status
href: ../toloka-kit/reference/toloka.client.app.AppBatch.Status.md
hidden: true
- name: AppBatch.PriorityOrder
href: ../toloka-kit/reference/toloka.client.app.AppBatch.PriorityOrder.md
hidden: true
- name: AppBatchCreateRequest
href: ../toloka-kit/reference/toloka.client.app.AppBatchCreateRequest.md
- name: SyncBatchCreateRequest
href: ../toloka-kit/reference/toloka.client.app.SyncBatchCreateRequest.md
- name: AppItemImport
href: ../toloka-kit/reference/toloka.client.app.AppItemImport.md
hidden: true
Expand All @@ -428,6 +441,8 @@ items:
- name: AppItem.Status
href: ../toloka-kit/reference/toloka.client.app.AppItem.Status.md
hidden: true
- name: AppItemCreateRequest
href: ../toloka-kit/reference/toloka.client.app.AppItemCreateRequest.md
- name: AppItemsCreateRequest
href: ../toloka-kit/reference/toloka.client.app.AppItemsCreateRequest.md
- name: AppProject
Expand Down Expand Up @@ -1999,6 +2014,8 @@ items:
items:
- name: archive_app_project
href: ../toloka-kit/reference/toloka.async_client.client.AsyncTolokaClient.archive_app_project.md
- name: unarchive_app_project
href: ../toloka-kit/reference/toloka.async_client.client.AsyncTolokaClient.unarchive_app_project.md
- name: create_app_batch
href: ../toloka-kit/reference/toloka.async_client.client.AsyncTolokaClient.create_app_batch.md
- name: patch_app_batch
Expand Down Expand Up @@ -2039,8 +2056,12 @@ items:
href: ../toloka-kit/reference/toloka.async_client.client.AsyncTolokaClient.stop_app_batch.md
- name: resume_app_batch
href: ../toloka-kit/reference/toloka.async_client.client.AsyncTolokaClient.resume_app_batch.md
- name: unarchive_app_project
href: ../toloka-kit/reference/toloka.async_client.client.AsyncTolokaClient.unarchive_app_project.md
- name: archive_app_batch
href: ../toloka-kit/reference/toloka.async_client.client.AsyncTolokaClient.archive_app_batch.md
- name: unarchive_app_batch
href: ../toloka-kit/reference/toloka.async_client.client.AsyncTolokaClient.unarchive_app_batch.md
- name: start_sync_batch_processing
href: ../toloka-kit/reference/toloka.async_client.client.AsyncTolokaClient.start_sync_batch_processing.md
- name: assignments
items:
- name: accept_assignment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import inspect
from typing import Any

import attr
from stubmaker.builder.common import BaseDefinition, Node
Expand Down Expand Up @@ -29,4 +30,8 @@ def get_literal(self, node):
if node.obj is attr.NOTHING:
node.obj = ...

# stubmaker does not support forward references properly
if isinstance(node.obj, str) and node.obj == 'typing.ClassVar[Retry]':
node.obj = Any

return super().get_literal(node)
2 changes: 2 additions & 0 deletions misc/stubmaker/src/tk_stubgen/viewers/stub_viewer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
__all__ = [
'TolokaKitStubViewer',
]

from stubmaker.builder.literals import TypeHintLiteral
from stubmaker.viewers.common import add_inherited_singledispatchmethod
from stubmaker.viewers.stub_viewer import StubViewer
from stubmaker.viewers.util import indent
Expand Down
94 changes: 84 additions & 10 deletions src/async_client/client.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5359,7 +5359,7 @@ class AsyncTolokaClient:
self,
request: toloka.client.search_requests.AppSearchRequest,
batch_size: typing.Optional[int] = None
) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.app.App, None]:
) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.app.BaseApp, 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.
Expand Down Expand Up @@ -5392,7 +5392,7 @@ class AsyncTolokaClient:
id_gt: 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]:
) -> toloka.util.async_utils.AsyncGenAdapter[toloka.client.app.BaseApp, 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.
Expand Down Expand Up @@ -5607,7 +5607,9 @@ class AsyncTolokaClient:
async def create_app_item(
self,
app_project_id: str,
app_item: toloka.client.app.AppItem
app_item: toloka.client.app.AppItem,
*,
force_new_original: typing.Optional[bool] = None
) -> toloka.client.app.AppItem:
"""Creates an App task item in Toloka.
Expand All @@ -5630,6 +5632,8 @@ class AsyncTolokaClient:
Args:
app_project_id: The ID of the App project to create the item in.
app_item: The task item with parameters.
force_new_original: Whether to enable or disable the deduplication for the item in the request.
When set to true, the item will be re-labeled regardless of whether pre-labeled duplicates exist. Default is `False`.
Returns:
AppItem: Created App task item with updated parameters.
Expand All @@ -5642,7 +5646,8 @@ class AsyncTolokaClient:
app_project_id: str,
*,
batch_id: typing.Optional[str] = None,
input_data: typing.Optional[typing.Dict[str, typing.Any]] = None
input_data: typing.Optional[typing.Dict[str, typing.Any]] = None,
force_new_original: typing.Optional[bool] = None
) -> toloka.client.app.AppItem:
"""Creates an App task item in Toloka.
Expand All @@ -5665,6 +5670,8 @@ class AsyncTolokaClient:
Args:
app_project_id: The ID of the App project to create the item in.
app_item: The task item with parameters.
force_new_original: Whether to enable or disable the deduplication for the item in the request.
When set to true, the item will be re-labeled regardless of whether pre-labeled duplicates exist. Default is `False`.
Returns:
AppItem: Created App task item with updated parameters.
Expand Down Expand Up @@ -5707,7 +5714,9 @@ class AsyncTolokaClient:
app_project_id: str,
*,
batch_id: typing.Optional[str] = None,
items: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None
items: typing.List[typing.Dict[str, typing.Any]],
force_new_original: typing.Optional[bool] = None,
ignore_errors: typing.Optional[bool] = None
) -> typing.List[str]:
"""Creates task items in an App project in Toloka and adds them to an existing batch.
Expand Down Expand Up @@ -5955,7 +5964,10 @@ class AsyncTolokaClient:
app_project_id: str,
*,
name: typing.Optional[str] = None,
items: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None
items: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None,
priority_order: typing.Optional[toloka.client.app.AppBatch.PriorityOrder] = None,
force_new_original: typing.Optional[bool] = None,
ignore_errors: typing.Optional[bool] = None
) -> toloka.client.app.AppBatch:
"""Creates a batch with task items in an App project in Toloka.
Expand Down Expand Up @@ -6041,7 +6053,8 @@ class AsyncTolokaClient:
app_project_id: str,
batch_id: str,
*,
name: typing.Optional[str] = None
name: typing.Optional[str] = None,
priority_order: typing.Optional[toloka.client.app.AppBatch.PriorityOrder] = None
) -> toloka.client.app.AppBatch:
"""Updates an App batch.
Expand All @@ -6065,11 +6078,55 @@ class AsyncTolokaClient:
"""
...

async def archive_app_batch(
self,
app_project_id: str,
batch_id: str
) -> None:
"""Archives the batch with the ID specified in the request to hide its data.
You can archive the batches which are not currently being processed (are not in the `PROCESSING` status). You
must stop the batches before archiving them. The batch gets the `ARCHIVE` status.
Example:
>>> toloka_client.archive_app_batch(
>>> app_project_id='Q2d15QBjpwWuDz8Z321g',
>>> batch_id='4Va2BBWKL88S4QyAgVje'
>>> )
...
Args:
app_project_id: The ID of the project with which the batch is associated.
batch_id: The ID of the batch you want to archive.
"""
...

async def unarchive_app_batch(
self,
app_project_id: str,
batch_id: str
) -> None:
"""Changes the batch status to the last one it had before archiving. After the operation, you can process the
batch again.
Example:
>>> toloka_client.unarchive_app_batch(
>>> app_project_id='Q2d15QBjpwWuDz8Z321g',
>>> batch_id='4Va2BBWKL88S4QyAgVje'
>>> )
...
Args:
app_project_id: The ID of the project with which the batch is associated.
batch_id: The ID of the batch you want to unarchive.
"""
...

async def start_app_batch(
self,
app_project_id: str,
batch_id: str
):
) -> None:
"""Launches annotation of a batch of task items in an App project.
Example:
Expand All @@ -6085,11 +6142,28 @@ class AsyncTolokaClient:
"""
...

async def start_sync_batch_processing(
self,
app_project_id: str,
request: toloka.client.app.SyncBatchCreateRequest
) -> toloka.client.app.AppBatch:
"""Starts processing the batch with the ID specified in the request.
This batch processing is applicable for solutions which use synchronous protocols only.
Args:
app_project_id: The ID of the project with which the batch is associated.
Returns:
AppBatch: The response to the request to start sync batch processing.
"""
...

async def stop_app_batch(
self,
app_project_id: str,
batch_id: str
):
) -> None:
"""Stops annotation of a batch of task items in an App project.
Processing can be stopped only for the batch with the `PROCESSING` status.
Expand All @@ -6111,7 +6185,7 @@ class AsyncTolokaClient:
self,
app_project_id: str,
batch_id: str
):
) -> None:
"""Resumes annotation of a batch of task items in an App project.
Processing can be resumed only for the batch with the `STOPPING` or `STOPPED` status.
Expand Down
Loading

0 comments on commit 2ae135c

Please sign in to comment.