Source code for annofabapi.pydantic_models.project_configuration_put

"""


No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
"""

from __future__ import annotations

import json
import pprint
import re  # noqa: F401
from typing import Any, ClassVar, Dict, List, Set

from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
from typing_extensions import Annotated, Self

from annofabapi.pydantic_models.assignee_rule_of_resubmitted_task import AssigneeRuleOfResubmittedTask
from annofabapi.pydantic_models.task_assignment_property import TaskAssignmentProperty
from annofabapi.pydantic_models.task_assignment_type import TaskAssignmentType


[docs] class ProjectConfigurationPut(BaseModel): """ プロジェクトの設定情報 """ number_of_inspections: Annotated[int, Field(strict=True, ge=0)] | None = Field( default=0, description="検査回数。 * 0回:教師付け -> 受入 * 1回:教師付け -> 検査 -> 受入 * n回(n >= 2):教師付け -> 検査1 -> ... -> 検査n -> 受入 ", ) assignee_rule_of_resubmitted_task: AssigneeRuleOfResubmittedTask | None = AssigneeRuleOfResubmittedTask.NO_ASSIGNEE task_assignment_type: TaskAssignmentType | None = TaskAssignmentType.RANDOM task_assignment_property: TaskAssignmentProperty | None = None max_tasks_per_member: Annotated[int, Field(le=100, strict=True, ge=1)] | None = Field( default=10, description="保留中のタスクを除き、1人(オーナー以外)に割り当てられるタスク数の上限。 " ) max_tasks_per_member_including_hold: Annotated[int, Field(le=100, strict=True, ge=1)] | None = Field( default=20, description="保留中のタスクを含めて、1人(オーナー以外)に割り当てられるタスク数上限の保留分。 割り当て時の上限チェックは、max_tasks_per_memberとこの数字の合計で行われます。 例えばmax_tasks_per_memberが10、max_tasks_per_member_including_holdが20の場合、保留中を含むタスク数の割り当て上限は30になります。 ", ) input_data_set_id_list: List[StrictStr] | None = Field( default=None, description="システム内部用のプロパティ。 [putProject](#operation/putProject) APIでプロジェクトを更新する際は、[getProject](#operation/getProject) APIで取得した値を指定してください。 ", ) input_data_max_long_side_length: Annotated[int, Field(strict=True, ge=0)] | None = Field( default=None, description="入力データ画像の長辺の最大値(未指定時は4096px)。 画像をアップロードすると、長辺がこの値になるように画像が自動で圧縮されます。 アノテーションの座標は、もとの解像度の画像でつけたものに復元されます。 大きな数値を設定すると入力データ画像のサイズが大きくなり、生産性低下やブラウザで画像を表示できない懸念があります。注意して設定してください。 ", ) sampling_inspection_rate: Annotated[int, Field(le=100, strict=True, ge=0)] | None = Field( default=None, description="抜取検査率[%]。未指定の場合は100%として扱う。" ) sampling_acceptance_rate: Annotated[int, Field(le=100, strict=True, ge=0)] | None = Field( default=None, description="抜取受入率[%]。未指定の場合は100%として扱う。" ) private_storage_aws_iam_role_arn: StrictStr | None = Field( default=None, description="AWS IAMロール。S3プライベートストレージの認可で使います。 [S3プライベートストレージの認可の設定についてはこちら](/docs/faq/#m0b240)をご覧ください。 ", ) use_s3_transfer_acceleration: StrictBool | None = Field( default=False, description="S3プライベートストレージにアクセスする際に、AWS S3 Transfer Accelerationを使用するかどうか。trueの場合に使用します。 private_storage_aws_iam_role_arnの設定がなされていない場合、この値は無視されます。 ", ) plugin_id: StrictStr | None = Field(default=None, description="プラグインID。[値の制約についてはこちら。](#section/API-Convention/APIID) ") custom_task_assignment_plugin_id: StrictStr | None = Field( default=None, description="プラグインID。[値の制約についてはこちら。](#section/API-Convention/APIID) " ) custom_specs_plugin_id: StrictStr | None = Field( default=None, description="プラグインID。[値の制約についてはこちら。](#section/API-Convention/APIID) " ) extended_specs_plugin_id: StrictStr | None = Field( default=None, description="プラグインID。[値の制約についてはこちら。](#section/API-Convention/APIID) " ) editor_version: StrictStr | None = Field( default=None, description="標準アノテーションエディタのバージョン。 * `stable` * 安定版。通常はこちらを利用してください。 * `preview` * 最新版。新機能やUI変更の先行リリース版。 プロジェクト更新時に未指定の場合は `stable` が指定されたものとみなします。 ", ) use_beginner_navigation: StrictBool | None = Field( default=False, description="true の場合、プロジェクトの画面でナビゲーションUIを表示します(ログインユーザーがプロジェクトオーナーの場合のみ)。 ", ) __properties: ClassVar[List[str]] = [ "number_of_inspections", "assignee_rule_of_resubmitted_task", "task_assignment_type", "task_assignment_property", "max_tasks_per_member", "max_tasks_per_member_including_hold", "input_data_set_id_list", "input_data_max_long_side_length", "sampling_inspection_rate", "sampling_acceptance_rate", "private_storage_aws_iam_role_arn", "use_s3_transfer_acceleration", "plugin_id", "custom_task_assignment_plugin_id", "custom_specs_plugin_id", "extended_specs_plugin_id", "editor_version", "use_beginner_navigation", ] model_config = ConfigDict( populate_by_name=True, validate_assignment=True, protected_namespaces=(), )
[docs] def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True))
[docs] def to_json(self) -> str: """Returns the JSON representation of the model using alias""" # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict())
[docs] @classmethod def from_json(cls, json_str: str) -> Self | None: """Create an instance of ProjectConfigurationPut from a JSON string""" return cls.from_dict(json.loads(json_str))
[docs] def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's `self.model_dump(by_alias=True)`: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. """ excluded_fields: Set[str] = set([]) _dict = self.model_dump( by_alias=True, exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of task_assignment_property if self.task_assignment_property: _dict["task_assignment_property"] = self.task_assignment_property.to_dict() return _dict
[docs] @classmethod def from_dict(cls, obj: Dict[str, Any] | None) -> Self | None: """Create an instance of ProjectConfigurationPut from a dict""" if obj is None: return None if not isinstance(obj, dict): return cls.model_validate(obj) _obj = cls.model_validate( { "number_of_inspections": obj.get("number_of_inspections") if obj.get("number_of_inspections") is not None else 0, "assignee_rule_of_resubmitted_task": obj.get("assignee_rule_of_resubmitted_task") if obj.get("assignee_rule_of_resubmitted_task") is not None else AssigneeRuleOfResubmittedTask.NO_ASSIGNEE, "task_assignment_type": obj.get("task_assignment_type") if obj.get("task_assignment_type") is not None else TaskAssignmentType.RANDOM, "task_assignment_property": TaskAssignmentProperty.from_dict(obj["task_assignment_property"]) if obj.get("task_assignment_property") is not None else None, "max_tasks_per_member": obj.get("max_tasks_per_member") if obj.get("max_tasks_per_member") is not None else 10, "max_tasks_per_member_including_hold": obj.get("max_tasks_per_member_including_hold") if obj.get("max_tasks_per_member_including_hold") is not None else 20, "input_data_set_id_list": obj.get("input_data_set_id_list"), "input_data_max_long_side_length": obj.get("input_data_max_long_side_length"), "sampling_inspection_rate": obj.get("sampling_inspection_rate"), "sampling_acceptance_rate": obj.get("sampling_acceptance_rate"), "private_storage_aws_iam_role_arn": obj.get("private_storage_aws_iam_role_arn"), "use_s3_transfer_acceleration": obj.get("use_s3_transfer_acceleration") if obj.get("use_s3_transfer_acceleration") is not None else False, "plugin_id": obj.get("plugin_id"), "custom_task_assignment_plugin_id": obj.get("custom_task_assignment_plugin_id"), "custom_specs_plugin_id": obj.get("custom_specs_plugin_id"), "extended_specs_plugin_id": obj.get("extended_specs_plugin_id"), "editor_version": obj.get("editor_version"), "use_beginner_navigation": obj.get("use_beginner_navigation") if obj.get("use_beginner_navigation") is not None else False, } ) return _obj