Skip to content

AnnoFab v0.61.2にバージョンアップ #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Sep 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion annofabapi/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.15.3'
__version__ = '0.16.0'
2 changes: 0 additions & 2 deletions annofabapi/api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import functools
import json
import logging
import warnings
from typing import Any, Callable, Dict, List, Optional, Tuple, Union # pylint: disable=unused-import

import backoff
Expand Down Expand Up @@ -192,7 +191,6 @@ def _get_signed_cookie(self, project_id):
Tuple[Content, Reponse)

"""
warnings.warn("deprecated", DeprecationWarning)
url_path = f'/private/projects/{project_id}/sign-headers'
http_method = 'GET'
keyword_params: Dict[str, Any] = {}
Expand Down
6 changes: 4 additions & 2 deletions annofabapi/dataclass/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

from dataclasses_json import dataclass_json

from annofabapi.models import JobStatus, JobType


@dataclass_json
@dataclass
Expand All @@ -24,13 +26,13 @@ class JobInfo:
project_id: Optional[str]
"""プロジェクトID。[値の制約についてはこちら。](#section/API-Convention/APIID) """

job_type: Optional[str]
job_type: Optional[JobType]
""""""

job_id: Optional[str]
""""""

job_status: Optional[str]
job_status: Optional[JobStatus]
""""""

job_execution: Optional[Dict[str, Any]]
Expand Down
4 changes: 3 additions & 1 deletion annofabapi/dataclass/supplementary.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

from dataclasses_json import dataclass_json

from annofabapi.models import SupplementaryDataType


@dataclass_json
@dataclass
Expand Down Expand Up @@ -42,7 +44,7 @@ class SupplementaryData:
etag: Optional[str]
""""""

supplementary_data_type: str
supplementary_data_type: SupplementaryDataType
""""""

supplementary_data_number: int
Expand Down
8 changes: 5 additions & 3 deletions annofabapi/dataclass/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

from dataclasses_json import dataclass_json

from annofabapi.models import WebhookEventType, WebhookHttpMethod, WebhookStatus


@dataclass_json
@dataclass
Expand All @@ -35,16 +37,16 @@ class Webhook:
project_id: Optional[str]
"""プロジェクトID。[値の制約についてはこちら。](#section/API-Convention/APIID) """

event_type: Optional[str]
event_type: Optional[WebhookEventType]
""""""

webhook_id: Optional[str]
"""WebhookID。[値の制約についてはこちら。](#section/API-Convention/APIID) """

webhook_status: Optional[str]
webhook_status: Optional[WebhookStatus]
""""""

method: Optional[str]
method: Optional[WebhookHttpMethod]
""""""

headers: Optional[List[WebhookHeader]]
Expand Down
7 changes: 4 additions & 3 deletions annofabapi/generated_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ def get_annotation_list(
query_params (Dict[str, Any]): Query Parameters
page (int): 検索結果のうち、取得したいページの番号(1始まり)
limit (int): 1ページあたりの取得するデータ件数
aggregate_by_task_and_input (bool): trueを指定した場合に「タスクIDと入力IDの組」ごとに検索結果を集計するようにする。
query (AnnotationQuery): 絞り込み条件。[AnnotationQuery](#/components/schemas/AnnotationQuery)** をURIエンコードしたもの。
sort (str): ソート順の指定。 使用可能キーはtask_id, input_data_id, detail.annotation_id, detail.account_id, detail.label_id, detail.data_holding_type, detail.created_datetime, detail.updated_datetimeのいずれかです。降順指定時は先頭に-(ハイフン)を付与します。 複数指定時は,(カンマ)区切りで列挙します。複数キーを列挙した場合は、先頭から優先順位を割り振られます。

Expand Down Expand Up @@ -721,8 +722,8 @@ def get_input_data_list(
input_data_name (str): 入力データ名での部分一致検索で使用。1文字以上あれば使用します。
input_data_path (str): 入力データパスでの部分一致検索で使用。1文字以上あれば使用します。
task_id (str): 入力データが紐づくタスクIDの部分一致検索で使用。1文字以上あれば使用します。条件に合致した先頭100件のタスクに使われている入力データを検索します。
_from (str): 更新日時での範囲検索で使用
to (str): 更新日時での範囲検索で使用
_from (str): 更新日時での範囲検索で使用(ISO 8601 拡張形式)
to (str): 更新日時での範囲検索で使用(ISO 8601 拡張形式)
page (int): 検索結果のうち、取得したいページの番号(1始まり)
limit (int): 1ページあたりの取得するデータ件数

Expand Down Expand Up @@ -1079,7 +1080,7 @@ def get_project_job(
Args:
project_id (str): プロジェクトID (required)
query_params (Dict[str, Any]): Query Parameters
type (str): 取得するジョブ種別 (required)
type (JobType): 取得するジョブ種別 (required)
page (int): 検索結果のうち、取得したいページの番号(1始まり) 現在は未実装のパラメータです。(今後対応予定)
limit (int): 1ページあたりの取得するデータ件数。 未指定時は1件のみ取得。
exclusive_start_created_datetime (str): 取得するデータの直前の作成日時
Expand Down
113 changes: 91 additions & 22 deletions annofabapi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,15 +276,15 @@ class AccountAuthority(Enum):

class AdditionalDataDefinitionType(Enum):
"""
* `flag` - 真偽値 * `integer` - 整数値 * `comment` - 自由記述 * `choice` - 選択肢(ラジオボタン式) * `select` - 選択肢(ドロップダウン式) * `tracking` - 自由記述 (トラッキングID自動挿入) * `link` - アノテーションリンク
* `flag` - 真偽値 * `integer` - 整数値 * `text` - 自由記述(1行) * `comment` - 自由記述(複数行) * `choice` - 選択肢(ラジオボタン式) * `select` - 選択肢(ドロップダウン式) * `tracking` - 自由記述 (トラッキングID自動挿入) * `link` - アノテーションリンク
"""

FLAG = "flag"
INTEGER = "integer"
TEXT = "text"
COMMENT = "comment"
CHOICE = "choice"
SELECT = "select"
TEXT = "text"
TRACKING = "tracking"
LINK = "link"

Expand All @@ -295,14 +295,6 @@ class AdditionalDataDefinitionType(Enum):

Kyes of Dict

* type: str
他と区別するために `CountResult` を指定します
* name: str

* field: str

* items: List[Count]


"""

Expand Down Expand Up @@ -1115,7 +1107,7 @@ class AssigneeRuleOfResubmittedTask(Enum):

FullAnnotationData = Dict[str, Any]
"""

アノテーションのデータが格納されます。 * `FullAnnotationDataClassification`: 入力データ全体に対するアノテーションデータです。 * `FullAnnotationDataSegmentation`: ピクセルレベルでの塗りつぶし(ラスター)のアノテーションデータです。 * `FullAnnotationDataSegmentationV2`: 塗りつぶしv2ののアノテーションデータです。塗りつぶしv2はSemantic Segmentationに特化しています。 * `FullAnnotationDataBoundingBox`: 矩形のアノテーションデータです。 * `FullAnnotationDataPoints`: ポリゴン(閉じた頂点集合)のアノテーションデータです。 * `FullAnnotationDataSegmentation`: 点のアノテーションデータです。 * `FullAnnotationDataRange`: 動画区間のアノテーションデータです。

Kyes of Dict

Expand Down Expand Up @@ -1537,7 +1529,7 @@ class InputDataOrder(Enum):

* input_data_id: str
入力データID。[値の制約についてはこちら。](#section/API-Convention/APIID)
* inspection_summary: str
* inspection_summary: InspectionSummary

* annotation_summaries: List[ValidationError]

Expand Down Expand Up @@ -1715,6 +1707,19 @@ class InspectionStatus(Enum):
NO_COMMENT_INSPECTION = "no_comment_inspection"


class InspectionSummary(Enum):
"""
- `no_inspection` - 入力データに検査コメントが付けられていない。 - `no_comment_inspection` - 入力データに空の検査コメントが付けられている。 - `new_reply_to_unprocessed` - 現在進行中の検査・受入フェーズで未処理の検査コメントに対して新たに返信が付けられている。 - `new_unprocessed_inspection` - 現在進行中の検査・受入フェーズでつけられた検査コメントのうち、未処理のものが1つ以上ある。 - `unprocessed` - 過去の検査・受入フェーズでつけられた検査コメントのうち、未処理のものが1つ以上ある。 - `complete` - 入力データにつけられた検査コメントで未処理のものがない。
"""

NO_INSPECTION = "no_inspection"
NO_COMMENT_INSPECTION = "no_comment_inspection"
NEW_REPLY_TO_UNPROCESSED = "new_reply_to_unprocessed"
NEW_UNPROCESSED_INSPECTION = "new_unprocessed_inspection"
UNPROCESSED = "unprocessed"
COMPLETE = "complete"


InstructionHistory = Dict[str, Any]
"""

Expand Down Expand Up @@ -1843,11 +1848,11 @@ class InspectionStatus(Enum):

* project_id: str
プロジェクトID。[値の制約についてはこちら。](#section/API-Convention/APIID)
* job_type: str
* job_type: JobType

* job_id: str

* job_status: str
* job_status: JobStatus

* job_execution: __DictStrKeyAnyValue__
ジョブの内部情報
Expand All @@ -1860,6 +1865,28 @@ class InspectionStatus(Enum):

"""


class JobStatus(Enum):
"""
"""

PROGRESS = "progress"
SUCCEEDED = "succeeded"
FAILED = "failed"


class JobType(Enum):
"""
* `copy-project` - プロジェクトのコピー。[initiateProjectCopy](#operation/initiateProjectCopy) APIを実行したときに登録されるジョブ。 * `gen-inputs` - zipファイルから入力データの作成。[putInputData](#operation/putInputData) APIを実行して、zipファイルから入力データを作成したときに登録されるジョブ。 * `gen-tasks` - タスクの一括作成。[initiateTasksGeneration](#operation/initiateTasksGeneration) APIを実行したときに登録されるジョブ。 * `gen-annotation` - アノテーションZIPの更新。[postAnnotationArchiveUpdate](#operation/postAnnotationArchiveUpdate) APIを実行したときに登録されるジョブ。 * `invoke-hook` - Webhookの起動。
"""

COPY_PROJECT = "copy-project"
GEN_INPUTS = "gen-inputs"
GEN_TASKS = "gen-tasks"
GEN_ANNOTATION = "gen-annotation"
INVOKE_HOOK = "invoke-hook"


Keybind = Dict[str, Any]
"""

Expand Down Expand Up @@ -1954,9 +1981,9 @@ class InspectionStatus(Enum):

* label_id: str

* completed_labels: int
* completed: int
ラベルごとの受入が完了したアノテーション数
* wip_labels: int
* wip: int
ラベルごとの受入が完了していないアノテーション数

"""
Expand Down Expand Up @@ -2704,7 +2731,7 @@ class ProjectStatus(Enum):
このフィールドはAF内部での利用のみを想定しており、依存しないでください。
* etag: str

* supplementary_data_type: str
* supplementary_data_type: SupplementaryDataType

* supplementary_data_number: int
表示順を表す数値(昇順)。同じ入力データに対して複数の補助情報で表示順が重複する場合、順序不定になります。
Expand All @@ -2723,7 +2750,7 @@ class ProjectStatus(Enum):
表示用の名前
* supplementary_data_path: str
AnnoFabに登録する補助情報の実体が保存されたパスです。 対応スキーマ:s3, https * [一時データ保存先取得API](#operation/createTempPath)を使ってAFにアップロードしたファイルパスの場合 * `s3://ANNOFAB-BUCKET/PATH/TO/INPUT_DATA` * 補助情報作成/更新API成功時、アップロードしたファイルが一時データ保存先からコピーされます。 * APIのレスポンスからアップロードしたファイルのコピー先パス(s3スキーマ)を取得できます。 * すでにAFに登録されている補助情報のパスの場合 * `s3://ANNOFAB-SUPPLEMENTARY-BUCKET/PATH/TO/INPUT_DATA` * ファイルはコピーされません。 * [プライベートストレージ](/docs/faq/#prst9c)のパスの場合 * `https://YOUR-DOMAIN/PATH/TO/INPUT_DATA` * `s3://YOUR-BUCKET-FOR-PRIVATE-STORAGE/PATH/TO/INPUT_DATA` * S3プライベートストレージのパスを登録する場合、[事前に認可の設定が必要](/docs/faq/#m0b240)です。 * AFにファイルはコピーされません。
* supplementary_data_type: str
* supplementary_data_type: SupplementaryDataType

* supplementary_data_number: int
表示順を表す数値(昇順)。同じ入力データに対して複数の補助情報で表示順が重複する場合、順序不定になります。
Expand All @@ -2732,6 +2759,15 @@ class ProjectStatus(Enum):

"""


class SupplementaryDataType(Enum):
"""
"""

IMAGE = "image"
TEXT = "text"


Task = Dict[str, Any]
"""

Expand Down Expand Up @@ -2774,7 +2810,7 @@ class ProjectStatus(Enum):
Kyes of Dict

* task_generate_rule: OneOfTaskGenerateRuleByCountTaskGenerateRuleByDirectoryTaskGenerateRuleByInputDataCsv
* `TaskGenerateRuleByCount`: 1つのタスクに割りあてる入力データの個数を指定してタスクを生成します。 * `TaskGenerateRuleByDirectory`: 入力データ名をファイルパスに見立て、ディレクトリ単位でタスクを生成します。
* `TaskGenerateRuleByCount`: 1つのタスクに割りあてる入力データの個数を指定してタスクを生成します。 * `TaskGenerateRuleByDirectory`: 入力データ名をファイルパスに見立て、ディレクトリ単位でタスクを生成します。 * `TaskGenerateRuleByInputDataCsv`: 各タスクへの入力データへの割当を記入したCSVへのS3上のパスを指定してタスクを生成します。
* project_last_updated_datetime: str
プロジェクトの最終更新日時。タスク生成の排他制御に使用。

Expand Down Expand Up @@ -3123,13 +3159,13 @@ class TaskStatus(Enum):

* project_id: str
プロジェクトID。[値の制約についてはこちら。](#section/API-Convention/APIID)
* event_type: str
* event_type: WebhookEventType

* webhook_id: str
WebhookID。[値の制約についてはこちら。](#section/API-Convention/APIID)
* webhook_status: str
* webhook_status: WebhookStatus

* method: str
* method: WebhookHttpMethod

* headers: List[WebhookHeader]

Expand All @@ -3144,6 +3180,18 @@ class TaskStatus(Enum):

"""


class WebhookEventType(Enum):
"""
* `task-completed` - タスク受入完了 * `annotation-archive-updated` - アノテーションZIP作成完了 * `input-data-zip-registered` - 入力データZIP登録完了 * `project-copy-completed` - プロジェクトコピー完了
"""

TASK_COMPLETED = "task-completed"
ANNOTATION_ARCHIVE_UPDATED = "annotation-archive-updated"
INPUT_DATA_ZIP_REGISTERED = "input-data-zip-registered"
PROJECT_COPY_COMPLETED = "project-copy-completed"


WebhookHeader = Dict[str, Any]
"""

Expand All @@ -3157,6 +3205,27 @@ class TaskStatus(Enum):

"""


class WebhookHttpMethod(Enum):
"""
"""

POST = "POST"
PUT = "PUT"
DELETE = "DELETE"
PATCH = "PATCH"
GET = "GET"
HEAD = "HEAD"


class WebhookStatus(Enum):
"""
"""

ACTIVE = "active"
INACTIVE = "inactive"


WebhookTestRequest = Dict[str, Any]
"""

Expand Down
Loading