Skip to content

Commit 837f8f5

Browse files
committed
Rename AvailableTask to Task
1 parent 4105b3c commit 837f8f5

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

doccano_client/client.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
from doccano_client.models.comment import Comment
77
from doccano_client.models.data_download import Option as DataExportOption
8-
from doccano_client.models.data_upload import AvailableTask
98
from doccano_client.models.data_upload import Option as DataImportOption
9+
from doccano_client.models.data_upload import Task
1010
from doccano_client.models.example import Example
1111
from doccano_client.models.label import (
1212
BoundingBox,
@@ -708,17 +708,20 @@ def upload(
708708
self,
709709
project_id: int,
710710
file_paths: List[str],
711-
task: AvailableTask,
711+
task: Task,
712712
format: str,
713713
column_data: str = "text",
714714
column_label: str = "label",
715715
) -> TaskStatus:
716-
"""Upload a file.
716+
"""Upload a file. `task` is one of the
717+
`DocumentClassification`, `SequenceLabeling`, `Seq2seq`, `Speech2text`,
718+
`ImageClassification`, `BoundingBox`, `Segmentation`, `ImageCaptioning`,
719+
, `IntentDetectionAndSlotFilling`, and `RelationExtraction`.
717720
718721
Args:
719722
project_id (int): The id of the project.
720723
file_paths (List[str]): The list of the file paths.
721-
task (AvailableTask): The task of the upload.
724+
task (Task): The task of the upload.
722725
format (str): The format of the upload.
723726
column_data (str): The column name of the data.
724727
column_label (str): The column name of the label.

doccano_client/models/data_upload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Option(BaseModel):
1313
properties: Dict[str, Any]
1414

1515

16-
class AvailableTask(str, Enum):
16+
class Task(str, Enum):
1717
DOCUMENT_CLASSIFICATION = "DocumentClassification"
1818
SEQUENCE_LABELING = "SequenceLabeling"
1919
SEQ2SEQ = "Seq2seq"

doccano_client/repositories/data_upload.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from requests_toolbelt import MultipartEncoder
77

8-
from doccano_client.models.data_upload import AvailableTask, Option
8+
from doccano_client.models.data_upload import Option, Task
99
from doccano_client.repositories.base import BaseRepository
1010

1111

@@ -56,13 +56,13 @@ def delete(self, upload_id: str):
5656
headers = {"Content-Type": "text/plain", "Accept": "*/*"}
5757
self._client.delete(resource, data=upload_id, headers=headers)
5858

59-
def ingest(self, project_id: int, upload_ids: List[str], task: AvailableTask, format: str, **kwargs) -> str:
59+
def ingest(self, project_id: int, upload_ids: List[str], task: Task, format: str, **kwargs) -> str:
6060
"""Ingest the uploaded files into the project
6161
6262
Args:
6363
project_id (int): The id of the project
6464
upload_ids (List[str]): The ids of the uploaded files
65-
task (AvailableTask): The project's task name
65+
task (Task): The project's task name
6666
format (str): The format of the uploaded files
6767
**kwargs: Additional keyword arguments like column_data and column_label
6868

doccano_client/usecase/data_upload.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import List
22

3-
from doccano_client.models.data_upload import AvailableTask, Option
3+
from doccano_client.models.data_upload import Option, Task
44
from doccano_client.models.task_status import TaskStatus
55
from doccano_client.repositories.data_upload import DataUploadRepository
66
from doccano_client.repositories.task_status import TaskStatusRepository
@@ -26,7 +26,7 @@ def upload(
2626
self,
2727
project_id: int,
2828
file_paths: List[str],
29-
task: AvailableTask,
29+
task: Task,
3030
format: str,
3131
column_data: str = "text",
3232
column_label: str = "label",
@@ -36,7 +36,7 @@ def upload(
3636
Args:
3737
project_id (int): The id of the project
3838
file_paths (List[str]): The list of the file paths
39-
task (AvailableTask): The task of the upload
39+
task (Task): The task of the upload
4040
format (str): The format of the upload
4141
column_data (str): The column name of the data
4242
column_label (str): The column name of the label

0 commit comments

Comments
 (0)