annofabcli 1.111.2__py3-none-any.whl → 1.113.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- annofabcli/__main__.py +1 -2
- annofabcli/annotation/annotation_query.py +10 -10
- annofabcli/annotation/change_annotation_attributes.py +10 -10
- annofabcli/annotation/change_annotation_attributes_per_annotation.py +4 -5
- annofabcli/annotation/change_annotation_properties.py +14 -14
- annofabcli/annotation/copy_annotation.py +6 -6
- annofabcli/annotation/create_classification_annotation.py +7 -7
- annofabcli/annotation/delete_annotation.py +9 -9
- annofabcli/annotation/download_annotation_zip.py +1 -3
- annofabcli/annotation/dump_annotation.py +8 -8
- annofabcli/annotation/import_annotation.py +13 -13
- annofabcli/annotation/list_annotation.py +9 -9
- annofabcli/annotation/list_annotation_count.py +2 -3
- annofabcli/annotation/merge_segmentation.py +6 -6
- annofabcli/annotation/remove_segmentation_overlap.py +5 -5
- annofabcli/annotation/restore_annotation.py +7 -7
- annofabcli/annotation/subcommand_annotation.py +1 -2
- annofabcli/annotation_specs/add_attribute_restriction.py +4 -5
- annofabcli/annotation_specs/attribute_restriction.py +8 -8
- annofabcli/annotation_specs/export_annotation_specs.py +4 -5
- annofabcli/annotation_specs/get_annotation_specs_with_attribute_id_replaced.py +3 -4
- annofabcli/annotation_specs/get_annotation_specs_with_choice_id_replaced.py +3 -4
- annofabcli/annotation_specs/get_annotation_specs_with_label_id_replaced.py +3 -4
- annofabcli/annotation_specs/list_annotation_specs_attribute.py +9 -10
- annofabcli/annotation_specs/list_annotation_specs_choice.py +9 -10
- annofabcli/annotation_specs/list_annotation_specs_history.py +3 -3
- annofabcli/annotation_specs/list_annotation_specs_label.py +8 -9
- annofabcli/annotation_specs/list_annotation_specs_label_attribute.py +10 -11
- annofabcli/annotation_specs/list_attribute_restriction.py +2 -4
- annofabcli/annotation_specs/list_label_color.py +2 -3
- annofabcli/annotation_specs/put_label_color.py +3 -4
- annofabcli/annotation_specs/subcommand_annotation_specs.py +1 -3
- annofabcli/annotation_zip/list_annotation_3d_bounding_box.py +365 -0
- annofabcli/annotation_zip/list_annotation_bounding_box_2d.py +37 -38
- annofabcli/annotation_zip/list_polygon_annotation.py +390 -0
- annofabcli/annotation_zip/list_polyline_annotation.py +402 -0
- annofabcli/annotation_zip/list_range_annotation.py +25 -15
- annofabcli/annotation_zip/list_single_point_annotation.py +25 -34
- annofabcli/annotation_zip/subcommand_annotation_zip.py +7 -2
- annofabcli/annotation_zip/validate_annotation.py +8 -7
- annofabcli/comment/delete_comment.py +4 -6
- annofabcli/comment/download_comment_json.py +4 -6
- annofabcli/comment/list_all_comment.py +5 -6
- annofabcli/comment/list_comment.py +3 -4
- annofabcli/comment/put_comment.py +9 -10
- annofabcli/comment/put_comment_simply.py +5 -6
- annofabcli/comment/put_inspection_comment.py +1 -3
- annofabcli/comment/put_inspection_comment_simply.py +1 -3
- annofabcli/comment/put_onhold_comment.py +1 -3
- annofabcli/comment/put_onhold_comment_simply.py +1 -3
- annofabcli/comment/subcommand_comment.py +1 -3
- annofabcli/common/bokeh.py +4 -4
- annofabcli/common/cli.py +18 -17
- annofabcli/common/download.py +28 -29
- annofabcli/common/facade.py +37 -38
- annofabcli/common/image.py +14 -14
- annofabcli/common/utils.py +8 -8
- annofabcli/common/visualize.py +13 -13
- annofabcli/experimental/list_out_of_range_annotation_for_movie.py +3 -4
- annofabcli/experimental/subcommand_experimental.py +1 -3
- annofabcli/filesystem/draw_annotation.py +27 -27
- annofabcli/filesystem/filter_annotation.py +9 -10
- annofabcli/filesystem/mask_user_info.py +15 -15
- annofabcli/filesystem/merge_annotation.py +9 -9
- annofabcli/filesystem/subcommand_filesystem.py +1 -3
- annofabcli/input_data/copy_input_data.py +8 -9
- annofabcli/input_data/delete_input_data.py +3 -3
- annofabcli/input_data/delete_metadata_key_of_input_data.py +3 -5
- annofabcli/input_data/download_input_data_json.py +4 -6
- annofabcli/input_data/list_all_input_data.py +9 -9
- annofabcli/input_data/list_all_input_data_merged_task.py +5 -5
- annofabcli/input_data/list_input_data.py +5 -5
- annofabcli/input_data/put_input_data.py +6 -6
- annofabcli/input_data/put_input_data_with_zip.py +3 -4
- annofabcli/input_data/subcommand_input_data.py +1 -3
- annofabcli/input_data/update_input_data.py +6 -8
- annofabcli/input_data/update_metadata_of_input_data.py +3 -5
- annofabcli/instruction/copy_instruction.py +5 -6
- annofabcli/instruction/download_instruction.py +5 -6
- annofabcli/instruction/list_instruction_history.py +3 -3
- annofabcli/instruction/subcommand_instruction.py +1 -3
- annofabcli/instruction/upload_instruction.py +3 -4
- annofabcli/job/delete_job.py +2 -3
- annofabcli/job/list_job.py +5 -5
- annofabcli/job/list_last_job.py +4 -4
- annofabcli/job/subcommand_job.py +1 -3
- annofabcli/job/wait_job.py +4 -5
- annofabcli/my_account/get_my_account.py +2 -3
- annofabcli/my_account/subcommand_my_account.py +1 -3
- annofabcli/organization/list_organization.py +2 -3
- annofabcli/organization/subcommand_organization.py +1 -3
- annofabcli/organization_member/change_organization_member.py +3 -4
- annofabcli/organization_member/delete_organization_member.py +3 -4
- annofabcli/organization_member/invite_organization_member.py +1 -3
- annofabcli/organization_member/list_organization_member.py +3 -3
- annofabcli/organization_member/subcommand_organization_member.py +1 -3
- annofabcli/project/change_organization_of_project.py +4 -4
- annofabcli/project/change_project_status.py +4 -4
- annofabcli/project/copy_project.py +5 -5
- annofabcli/project/create_project.py +8 -8
- annofabcli/project/diff_projects.py +4 -5
- annofabcli/project/list_project.py +5 -5
- annofabcli/project/put_project.py +2 -3
- annofabcli/project/subcommand_project.py +1 -2
- annofabcli/project/update_configuration.py +4 -4
- annofabcli/project/update_project.py +6 -8
- annofabcli/project_member/change_project_members.py +8 -8
- annofabcli/project_member/copy_project_members.py +4 -4
- annofabcli/project_member/drop_project_members.py +2 -3
- annofabcli/project_member/invite_project_members.py +1 -3
- annofabcli/project_member/list_users.py +2 -3
- annofabcli/project_member/put_project_members.py +6 -6
- annofabcli/project_member/subcommand_project_member.py +1 -3
- annofabcli/stat_visualization/mask_visualization_dir.py +8 -9
- annofabcli/stat_visualization/merge_visualization_dir.py +6 -7
- annofabcli/stat_visualization/subcommand_stat_visualization.py +1 -2
- annofabcli/stat_visualization/summarize_whole_performance_csv.py +1 -2
- annofabcli/stat_visualization/write_graph.py +2 -3
- annofabcli/stat_visualization/write_performance_rating_csv.py +20 -27
- annofabcli/statistics/histogram.py +5 -6
- annofabcli/statistics/linegraph.py +13 -14
- annofabcli/statistics/list_annotation_area.py +38 -13
- annofabcli/statistics/list_annotation_attribute.py +9 -10
- annofabcli/statistics/list_annotation_attribute_filled_count.py +30 -31
- annofabcli/statistics/list_annotation_count.py +57 -58
- annofabcli/statistics/list_annotation_duration.py +33 -34
- annofabcli/statistics/list_video_duration.py +4 -5
- annofabcli/statistics/list_worktime.py +4 -4
- annofabcli/statistics/scatter.py +9 -8
- annofabcli/statistics/subcommand_statistics.py +1 -4
- annofabcli/statistics/summarize_task_count.py +4 -6
- annofabcli/statistics/summarize_task_count_by_task_id_group.py +2 -4
- annofabcli/statistics/summarize_task_count_by_user.py +1 -3
- annofabcli/statistics/visualization/dataframe/annotation_count.py +5 -4
- annofabcli/statistics/visualization/dataframe/annotation_duration.py +2 -3
- annofabcli/statistics/visualization/dataframe/cumulative_productivity.py +15 -17
- annofabcli/statistics/visualization/dataframe/productivity_per_date.py +17 -19
- annofabcli/statistics/visualization/dataframe/project_performance.py +3 -12
- annofabcli/statistics/visualization/dataframe/task.py +11 -12
- annofabcli/statistics/visualization/dataframe/task_worktime_by_phase_user.py +9 -10
- annofabcli/statistics/visualization/dataframe/user_performance.py +21 -19
- annofabcli/statistics/visualization/dataframe/whole_performance.py +3 -4
- annofabcli/statistics/visualization/dataframe/whole_productivity_per_date.py +12 -14
- annofabcli/statistics/visualization/dataframe/worktime_per_date.py +11 -13
- annofabcli/statistics/visualization/filtering_query.py +7 -7
- annofabcli/statistics/visualization/project_dir.py +27 -14
- annofabcli/statistics/visualize_annotation_count.py +22 -23
- annofabcli/statistics/visualize_annotation_duration.py +21 -22
- annofabcli/statistics/visualize_statistics.py +36 -33
- annofabcli/statistics/visualize_video_duration.py +18 -20
- annofabcli/supplementary/delete_supplementary_data.py +5 -5
- annofabcli/supplementary/list_supplementary_data.py +4 -4
- annofabcli/supplementary/put_supplementary_data.py +9 -9
- annofabcli/supplementary/subcommand_supplementary.py +1 -3
- annofabcli/task/cancel_acceptance.py +16 -17
- annofabcli/task/change_operator.py +10 -12
- annofabcli/task/change_status_to_break.py +7 -9
- annofabcli/task/change_status_to_on_hold.py +10 -12
- annofabcli/task/complete_tasks.py +17 -18
- annofabcli/task/copy_tasks.py +3 -5
- annofabcli/task/delete_metadata_key_of_task.py +4 -6
- annofabcli/task/delete_tasks.py +7 -7
- annofabcli/task/download_task_json.py +4 -6
- annofabcli/task/list_all_tasks.py +8 -8
- annofabcli/task/list_all_tasks_added_task_history.py +14 -13
- annofabcli/task/list_tasks.py +7 -7
- annofabcli/task/list_tasks_added_task_history.py +10 -10
- annofabcli/task/put_tasks.py +5 -6
- annofabcli/task/put_tasks_by_count.py +2 -3
- annofabcli/task/reject_tasks.py +18 -20
- annofabcli/task/subcommand_task.py +1 -3
- annofabcli/task/update_metadata_of_task.py +5 -6
- annofabcli/task_history/download_task_history_json.py +4 -6
- annofabcli/task_history/list_all_task_history.py +6 -7
- annofabcli/task_history/list_task_history.py +4 -5
- annofabcli/task_history/subcommand_task_history.py +1 -3
- annofabcli/task_history_event/download_task_history_event_json.py +4 -6
- annofabcli/task_history_event/list_all_task_history_event.py +7 -7
- annofabcli/task_history_event/list_worktime.py +17 -16
- annofabcli/task_history_event/subcommand_task_history_event.py +1 -2
- {annofabcli-1.111.2.dist-info → annofabcli-1.113.0.dist-info}/METADATA +9 -15
- annofabcli-1.113.0.dist-info/RECORD +231 -0
- {annofabcli-1.111.2.dist-info → annofabcli-1.113.0.dist-info}/WHEEL +1 -1
- annofabcli-1.111.2.dist-info/RECORD +0 -228
- {annofabcli-1.111.2.dist-info → annofabcli-1.113.0.dist-info}/entry_points.txt +0 -0
- {annofabcli-1.111.2.dist-info → annofabcli-1.113.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -3,13 +3,13 @@ from __future__ import annotations
|
|
|
3
3
|
import argparse
|
|
4
4
|
import logging
|
|
5
5
|
import sys
|
|
6
|
-
from typing import Any
|
|
6
|
+
from typing import Any
|
|
7
7
|
|
|
8
8
|
import annofabapi
|
|
9
9
|
import pandas
|
|
10
10
|
from annofabapi.models import SingleAnnotation
|
|
11
11
|
|
|
12
|
-
import annofabcli
|
|
12
|
+
import annofabcli.common.cli
|
|
13
13
|
from annofabcli.annotation.annotation_query import AnnotationQueryForAPI, AnnotationQueryForCLI
|
|
14
14
|
from annofabcli.common.cli import (
|
|
15
15
|
COMMAND_LINE_ERROR_STATUS_CODE,
|
|
@@ -52,10 +52,10 @@ class ListAnnotationMain:
|
|
|
52
52
|
def get_annotation_list(
|
|
53
53
|
self,
|
|
54
54
|
project_id: str,
|
|
55
|
-
annotation_query:
|
|
55
|
+
annotation_query: AnnotationQueryForAPI | None,
|
|
56
56
|
*,
|
|
57
|
-
task_id:
|
|
58
|
-
input_data_id:
|
|
57
|
+
task_id: str | None = None,
|
|
58
|
+
input_data_id: str | None = None,
|
|
59
59
|
) -> list[SingleAnnotation]:
|
|
60
60
|
dict_query = {}
|
|
61
61
|
if annotation_query is not None:
|
|
@@ -73,10 +73,10 @@ class ListAnnotationMain:
|
|
|
73
73
|
def get_all_annotation_list(
|
|
74
74
|
self,
|
|
75
75
|
project_id: str,
|
|
76
|
-
annotation_query:
|
|
76
|
+
annotation_query: AnnotationQueryForAPI | None,
|
|
77
77
|
*,
|
|
78
|
-
task_id_list:
|
|
79
|
-
input_data_id_list:
|
|
78
|
+
task_id_list: list[str] | None,
|
|
79
|
+
input_data_id_list: list[str] | None,
|
|
80
80
|
) -> list[SingleAnnotation]:
|
|
81
81
|
assert task_id_list is None or input_data_id_list is None, "task_id_listとinput_data_listのどちらかはNoneにしてください。"
|
|
82
82
|
|
|
@@ -252,7 +252,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
252
252
|
parser.set_defaults(subcommand_func=main)
|
|
253
253
|
|
|
254
254
|
|
|
255
|
-
def add_parser(subparsers:
|
|
255
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
256
256
|
subcommand_name = "list"
|
|
257
257
|
subcommand_help = "アノテーションの一覧を出力します。"
|
|
258
258
|
description = "アノテーションの一覧を出力します。"
|
|
@@ -4,13 +4,12 @@ import argparse
|
|
|
4
4
|
import logging
|
|
5
5
|
import sys
|
|
6
6
|
from enum import Enum
|
|
7
|
-
from typing import Optional
|
|
8
7
|
|
|
9
8
|
import annofabapi
|
|
10
9
|
import pandas
|
|
11
10
|
from annofabapi.models import SingleAnnotation
|
|
12
11
|
|
|
13
|
-
import annofabcli
|
|
12
|
+
import annofabcli.common.cli
|
|
14
13
|
from annofabcli.annotation.annotation_query import AnnotationQueryForCLI
|
|
15
14
|
from annofabcli.annotation.list_annotation import ListAnnotationMain
|
|
16
15
|
from annofabcli.common.cli import (
|
|
@@ -162,7 +161,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
162
161
|
parser.set_defaults(subcommand_func=main)
|
|
163
162
|
|
|
164
163
|
|
|
165
|
-
def add_parser(subparsers:
|
|
164
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
166
165
|
subcommand_name = "list_count"
|
|
167
166
|
subcommand_help = "task_idまたはinput_data_idで集約したアノテーションの個数を出力します。"
|
|
168
167
|
description = "task_idまたはinput_data_idで集約したアノテーションの個数を出力します。"
|
|
@@ -8,7 +8,7 @@ import sys
|
|
|
8
8
|
import tempfile
|
|
9
9
|
from collections.abc import Collection
|
|
10
10
|
from pathlib import Path
|
|
11
|
-
from typing import Any
|
|
11
|
+
from typing import Any
|
|
12
12
|
|
|
13
13
|
import annofabapi
|
|
14
14
|
import numpy
|
|
@@ -19,7 +19,7 @@ from annofabapi.segmentation import read_binary_image, write_binary_image
|
|
|
19
19
|
from annofabapi.util.annotation_specs import AnnotationSpecsAccessor
|
|
20
20
|
from annofabapi.utils import can_put_annotation
|
|
21
21
|
|
|
22
|
-
import annofabcli
|
|
22
|
+
import annofabcli.common.cli
|
|
23
23
|
from annofabcli.common.cli import (
|
|
24
24
|
COMMAND_LINE_ERROR_STATUS_CODE,
|
|
25
25
|
PARALLELISM_CHOICES,
|
|
@@ -84,7 +84,7 @@ class MergeSegmentationMain(CommandLineWithConfirm):
|
|
|
84
84
|
tuple[1]: 削除対象の塗りつぶしアノテーションのannotation_idのlist
|
|
85
85
|
"""
|
|
86
86
|
|
|
87
|
-
def func(label_id: str) -> tuple[
|
|
87
|
+
def func(label_id: str) -> tuple[str | None, list[str]]:
|
|
88
88
|
updated_annotation_id = None
|
|
89
89
|
deleted_annotation_id_list = []
|
|
90
90
|
binary_image_array_list = []
|
|
@@ -181,7 +181,7 @@ class MergeSegmentationMain(CommandLineWithConfirm):
|
|
|
181
181
|
)
|
|
182
182
|
return True
|
|
183
183
|
|
|
184
|
-
def merge_segmentation_annotation_for_task(self, task_id: str, *, task_index:
|
|
184
|
+
def merge_segmentation_annotation_for_task(self, task_id: str, *, task_index: int | None = None) -> int:
|
|
185
185
|
"""
|
|
186
186
|
1個のタスクに対して、label_idに対応する複数の塗りつぶしアノテーションを1つにまとめます。
|
|
187
187
|
|
|
@@ -256,7 +256,7 @@ class MergeSegmentationMain(CommandLineWithConfirm):
|
|
|
256
256
|
def main(
|
|
257
257
|
self,
|
|
258
258
|
task_ids: Collection[str],
|
|
259
|
-
parallelism:
|
|
259
|
+
parallelism: int | None = None,
|
|
260
260
|
) -> None:
|
|
261
261
|
logger.info(f"{len(task_ids)} 件のタスクに対して、複数の塗りつぶしアノテーションを1個にまとめます。")
|
|
262
262
|
success_input_data_count = 0
|
|
@@ -371,7 +371,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
371
371
|
parser.set_defaults(subcommand_func=main)
|
|
372
372
|
|
|
373
373
|
|
|
374
|
-
def add_parser(subparsers:
|
|
374
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
375
375
|
subcommand_name = "merge_segmentation"
|
|
376
376
|
subcommand_help = "複数の塗りつぶしアノテーションを1つにまとめます。"
|
|
377
377
|
description = (
|
|
@@ -8,7 +8,7 @@ import sys
|
|
|
8
8
|
import tempfile
|
|
9
9
|
from collections.abc import Collection
|
|
10
10
|
from pathlib import Path
|
|
11
|
-
from typing import Any
|
|
11
|
+
from typing import Any
|
|
12
12
|
|
|
13
13
|
import annofabapi
|
|
14
14
|
import numpy
|
|
@@ -17,7 +17,7 @@ from annofabapi.pydantic_models.task_status import TaskStatus
|
|
|
17
17
|
from annofabapi.segmentation import read_binary_image, write_binary_image
|
|
18
18
|
from annofabapi.utils import can_put_annotation
|
|
19
19
|
|
|
20
|
-
import annofabcli
|
|
20
|
+
import annofabcli.common.cli
|
|
21
21
|
from annofabcli.common.cli import (
|
|
22
22
|
COMMAND_LINE_ERROR_STATUS_CODE,
|
|
23
23
|
PARALLELISM_CHOICES,
|
|
@@ -160,7 +160,7 @@ class RemoveSegmentationOverlapMain(CommandLineWithConfirm):
|
|
|
160
160
|
logger.debug(f"{log_message_prefix}{len(updated_annotation_id_list)} 件の塗りつぶしアノテーションを更新しました。 :: task_id='{task_id}', input_data_id='{input_data_id}'")
|
|
161
161
|
return True
|
|
162
162
|
|
|
163
|
-
def update_segmentation_annotation_for_task(self, task_id: str, *, task_index:
|
|
163
|
+
def update_segmentation_annotation_for_task(self, task_id: str, *, task_index: int | None = None) -> int:
|
|
164
164
|
"""
|
|
165
165
|
1個のタスクに対して、塗りつぶしアノテーションの重なりを除去します。
|
|
166
166
|
|
|
@@ -235,7 +235,7 @@ class RemoveSegmentationOverlapMain(CommandLineWithConfirm):
|
|
|
235
235
|
def main(
|
|
236
236
|
self,
|
|
237
237
|
task_ids: Collection[str],
|
|
238
|
-
parallelism:
|
|
238
|
+
parallelism: int | None = None,
|
|
239
239
|
) -> None:
|
|
240
240
|
logger.info(f"{len(task_ids)} 件のタスクの塗りつぶしアノテーションの重なりを除去します。")
|
|
241
241
|
success_input_data_count = 0
|
|
@@ -317,7 +317,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
317
317
|
parser.set_defaults(subcommand_func=main)
|
|
318
318
|
|
|
319
319
|
|
|
320
|
-
def add_parser(subparsers:
|
|
320
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
321
321
|
subcommand_name = "remove_segmentation_overlap"
|
|
322
322
|
subcommand_help = "塗りつぶしアノテーションの重なりを除去します。"
|
|
323
323
|
description = "塗りつぶしアノテーションの重なりを除去します。Annofabでインスタンスセグメンテーションは重ねることができてしまいます。この重なりをなくしたいときに有用です。"
|
|
@@ -7,7 +7,7 @@ import multiprocessing
|
|
|
7
7
|
import sys
|
|
8
8
|
from collections.abc import Iterator
|
|
9
9
|
from pathlib import Path
|
|
10
|
-
from typing import Any
|
|
10
|
+
from typing import Any
|
|
11
11
|
|
|
12
12
|
import annofabapi
|
|
13
13
|
from annofabapi.dataclass.annotation import AnnotationDetailV1, AnnotationV1
|
|
@@ -19,7 +19,7 @@ from annofabapi.parser import (
|
|
|
19
19
|
)
|
|
20
20
|
from annofabapi.utils import can_put_annotation
|
|
21
21
|
|
|
22
|
-
import annofabcli
|
|
22
|
+
import annofabcli.common.cli
|
|
23
23
|
from annofabcli.common.cli import (
|
|
24
24
|
COMMAND_LINE_ERROR_STATUS_CODE,
|
|
25
25
|
PARALLELISM_CHOICES,
|
|
@@ -164,7 +164,7 @@ class RestoreAnnotationMain(CommandLineWithConfirm):
|
|
|
164
164
|
|
|
165
165
|
return success_count
|
|
166
166
|
|
|
167
|
-
def execute_task(self, task_parser: SimpleAnnotationParserByTask, task_index:
|
|
167
|
+
def execute_task(self, task_parser: SimpleAnnotationParserByTask, task_index: int | None = None) -> bool:
|
|
168
168
|
"""
|
|
169
169
|
1個のタスクに対してアノテーションを登録する。
|
|
170
170
|
|
|
@@ -193,7 +193,7 @@ class RestoreAnnotationMain(CommandLineWithConfirm):
|
|
|
193
193
|
logger.info(f"タスク'{task_id}'は作業中または受入完了状態のため、アノテーションのリストアをスキップします。 status={task['status']}")
|
|
194
194
|
return False
|
|
195
195
|
|
|
196
|
-
old_account_id:
|
|
196
|
+
old_account_id: str | None = None
|
|
197
197
|
changed_operator = False
|
|
198
198
|
if self.is_force:
|
|
199
199
|
if not can_put_annotation(task, self.service.api.account_id):
|
|
@@ -243,8 +243,8 @@ class RestoreAnnotationMain(CommandLineWithConfirm):
|
|
|
243
243
|
def main( # noqa: ANN201
|
|
244
244
|
self,
|
|
245
245
|
annotation_dir: Path,
|
|
246
|
-
target_task_ids:
|
|
247
|
-
parallelism:
|
|
246
|
+
target_task_ids: set[str] | None = None,
|
|
247
|
+
parallelism: int | None = None,
|
|
248
248
|
):
|
|
249
249
|
"""`annotation_dir`にあるファイルからアノテーションをリストアします。
|
|
250
250
|
|
|
@@ -363,7 +363,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
363
363
|
parser.set_defaults(subcommand_func=main)
|
|
364
364
|
|
|
365
365
|
|
|
366
|
-
def add_parser(subparsers:
|
|
366
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
367
367
|
subcommand_name = "restore"
|
|
368
368
|
subcommand_help = "'annotation dump'コマンドの出力結果から、アノテーション情報をリストアします。"
|
|
369
369
|
description = "'annotation dump'コマンドの出力結果から、アノテーション情報をリストアします。ただし、作業中/完了状態のタスクはリストアできません。"
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import argparse
|
|
2
|
-
from typing import Optional
|
|
3
2
|
|
|
4
3
|
import annofabcli.annotation.change_annotation_attributes
|
|
5
4
|
import annofabcli.annotation.change_annotation_attributes_per_annotation
|
|
@@ -38,7 +37,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
38
37
|
annofabcli.annotation.restore_annotation.add_parser(subparsers)
|
|
39
38
|
|
|
40
39
|
|
|
41
|
-
def add_parser(subparsers:
|
|
40
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
42
41
|
subcommand_name = "annotation"
|
|
43
42
|
subcommand_help = "アノテーション関係のサブコマンド"
|
|
44
43
|
description = "アノテーション関係のサブコマンド"
|
|
@@ -5,11 +5,10 @@ import copy
|
|
|
5
5
|
import json
|
|
6
6
|
import logging
|
|
7
7
|
import sys
|
|
8
|
-
from typing import Any
|
|
8
|
+
from typing import Any
|
|
9
9
|
|
|
10
10
|
import annofabapi
|
|
11
11
|
|
|
12
|
-
import annofabcli
|
|
13
12
|
import annofabcli.common.cli
|
|
14
13
|
from annofabcli.annotation_specs.attribute_restriction import AttributeRestrictionMessage, OutputFormat
|
|
15
14
|
from annofabcli.common.cli import (
|
|
@@ -43,7 +42,7 @@ class AddAttributeRestrictionMain(CommandLineWithConfirm):
|
|
|
43
42
|
CommandLineWithConfirm.__init__(self, all_yes)
|
|
44
43
|
self.project_id = project_id
|
|
45
44
|
|
|
46
|
-
def add_restrictions(self, restrictions: list[dict[str, Any]], comment:
|
|
45
|
+
def add_restrictions(self, restrictions: list[dict[str, Any]], comment: str | None = None) -> bool:
|
|
47
46
|
old_annotation_specs, _ = self.service.api.get_annotation_specs(self.project_id, query_params={"v": "3"})
|
|
48
47
|
old_restrictions = old_annotation_specs["restrictions"]
|
|
49
48
|
|
|
@@ -95,7 +94,7 @@ class AddAttributeRestrictionMain(CommandLineWithConfirm):
|
|
|
95
94
|
class AddAttributeRestriction(CommandLine):
|
|
96
95
|
COMMON_MESSAGE = "annofabcli annotation_specs add_restriction: error:"
|
|
97
96
|
|
|
98
|
-
def get_history_id_from_before_index(self, project_id: str, before: int) ->
|
|
97
|
+
def get_history_id_from_before_index(self, project_id: str, before: int) -> str | None:
|
|
99
98
|
histories, _ = self.service.api.get_annotation_specs_histories(project_id)
|
|
100
99
|
if before + 1 > len(histories):
|
|
101
100
|
logger.warning(f"アノテーション仕様の履歴は{len(histories)}個のため、最新より{before}個前のアノテーション仕様は見つかりませんでした。")
|
|
@@ -142,7 +141,7 @@ def main(args: argparse.Namespace) -> None:
|
|
|
142
141
|
AddAttributeRestriction(service, facade, args).main()
|
|
143
142
|
|
|
144
143
|
|
|
145
|
-
def add_parser(subparsers:
|
|
144
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
146
145
|
subcommand_name = "add_attribute_restriction"
|
|
147
146
|
|
|
148
147
|
subcommand_help = "アノテーション仕様に属性の制約を追加します。"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from collections.abc import Collection
|
|
3
3
|
from enum import Enum
|
|
4
|
-
from typing import Any
|
|
4
|
+
from typing import Any
|
|
5
5
|
|
|
6
6
|
from more_itertools import first_true
|
|
7
7
|
|
|
@@ -69,7 +69,7 @@ class AttributeRestrictionMessage:
|
|
|
69
69
|
|
|
70
70
|
return ", ".join(label_message_list)
|
|
71
71
|
|
|
72
|
-
def get_object_for_equals_or_notequals(self, value: str, attribute:
|
|
72
|
+
def get_object_for_equals_or_notequals(self, value: str, attribute: dict[str, Any] | None) -> str:
|
|
73
73
|
"""制約条件が `Equals` or `NotEquals`のときの目的語を生成する。
|
|
74
74
|
属性の種類がドロップダウンかセレクトボックスのときは、選択肢の名前を返す。
|
|
75
75
|
|
|
@@ -173,7 +173,7 @@ class AttributeRestrictionMessage:
|
|
|
173
173
|
tmp = f"{tmp} {str_object}"
|
|
174
174
|
return tmp
|
|
175
175
|
|
|
176
|
-
def get_attribute_from_name(self, attribute_name: str) ->
|
|
176
|
+
def get_attribute_from_name(self, attribute_name: str) -> dict[str, Any] | None:
|
|
177
177
|
tmp = [attribute for attribute in self.attribute_dict.values() if AnnofabApiFacade.get_additional_data_definition_name_en(attribute) == attribute_name]
|
|
178
178
|
if len(tmp) == 1:
|
|
179
179
|
return tmp[0]
|
|
@@ -184,7 +184,7 @@ class AttributeRestrictionMessage:
|
|
|
184
184
|
logger.warning(f"属性名(英語)が'{attribute_name}'の属性は複数存在します。")
|
|
185
185
|
return None
|
|
186
186
|
|
|
187
|
-
def get_label_from_name(self, label_name: str) ->
|
|
187
|
+
def get_label_from_name(self, label_name: str) -> dict[str, Any] | None:
|
|
188
188
|
tmp = [label for label in self.label_dict.values() if AnnofabApiFacade.get_label_name_en(label) == label_name]
|
|
189
189
|
if len(tmp) == 1:
|
|
190
190
|
return tmp[0]
|
|
@@ -197,8 +197,8 @@ class AttributeRestrictionMessage:
|
|
|
197
197
|
|
|
198
198
|
def get_target_attribute_ids(
|
|
199
199
|
self,
|
|
200
|
-
target_attribute_names:
|
|
201
|
-
target_label_names:
|
|
200
|
+
target_attribute_names: Collection[str] | None = None,
|
|
201
|
+
target_label_names: Collection[str] | None = None,
|
|
202
202
|
) -> set[str]:
|
|
203
203
|
result: set[str] = set()
|
|
204
204
|
|
|
@@ -219,8 +219,8 @@ class AttributeRestrictionMessage:
|
|
|
219
219
|
self,
|
|
220
220
|
restrictions: list[dict[str, Any]],
|
|
221
221
|
*,
|
|
222
|
-
target_attribute_names:
|
|
223
|
-
target_label_names:
|
|
222
|
+
target_attribute_names: Collection[str] | None = None,
|
|
223
|
+
target_label_names: Collection[str] | None = None,
|
|
224
224
|
) -> list[str]:
|
|
225
225
|
"""
|
|
226
226
|
複数の属性制約から自然言語で記載されたメッセージのlistを返します。
|
|
@@ -3,9 +3,8 @@ from __future__ import annotations
|
|
|
3
3
|
import argparse
|
|
4
4
|
import logging
|
|
5
5
|
import sys
|
|
6
|
-
from typing import Any
|
|
6
|
+
from typing import Any
|
|
7
7
|
|
|
8
|
-
import annofabcli
|
|
9
8
|
import annofabcli.common.cli
|
|
10
9
|
from annofabcli.common.cli import (
|
|
11
10
|
COMMAND_LINE_ERROR_STATUS_CODE,
|
|
@@ -23,7 +22,7 @@ logger = logging.getLogger(__name__)
|
|
|
23
22
|
class ExportAnnotationSpecs(CommandLine):
|
|
24
23
|
COMMON_MESSAGE = "annofabcli annotation_specs export: error:"
|
|
25
24
|
|
|
26
|
-
def get_history_id_from_before_index(self, project_id: str, before: int) ->
|
|
25
|
+
def get_history_id_from_before_index(self, project_id: str, before: int) -> str | None:
|
|
27
26
|
histories, _ = self.service.api.get_annotation_specs_histories(project_id)
|
|
28
27
|
sorted_histories = sorted(histories, key=lambda x: x["updated_datetime"], reverse=True)
|
|
29
28
|
|
|
@@ -34,7 +33,7 @@ class ExportAnnotationSpecs(CommandLine):
|
|
|
34
33
|
history = sorted_histories[before]
|
|
35
34
|
return history["history_id"]
|
|
36
35
|
|
|
37
|
-
def get_exported_annotation_specs(self, project_id: str, history_id:
|
|
36
|
+
def get_exported_annotation_specs(self, project_id: str, history_id: str | None) -> dict[str, Any]:
|
|
38
37
|
query_params = {"v": "3"}
|
|
39
38
|
if history_id is not None:
|
|
40
39
|
query_params["history_id"] = history_id
|
|
@@ -113,7 +112,7 @@ def main(args: argparse.Namespace) -> None:
|
|
|
113
112
|
ExportAnnotationSpecs(service, facade, args).main()
|
|
114
113
|
|
|
115
114
|
|
|
116
|
-
def add_parser(subparsers:
|
|
115
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
117
116
|
subcommand_name = "export"
|
|
118
117
|
|
|
119
118
|
subcommand_help = "アノテーション仕様の情報をエクスポートします。"
|
|
@@ -4,11 +4,10 @@ import argparse
|
|
|
4
4
|
import logging
|
|
5
5
|
import re
|
|
6
6
|
from collections.abc import Collection
|
|
7
|
-
from typing import Any
|
|
7
|
+
from typing import Any
|
|
8
8
|
|
|
9
9
|
import more_itertools
|
|
10
10
|
|
|
11
|
-
import annofabcli
|
|
12
11
|
import annofabcli.common.cli
|
|
13
12
|
from annofabcli.common.cli import (
|
|
14
13
|
ArgumentParser,
|
|
@@ -78,7 +77,7 @@ class ReplacingAttributeId(CommandLineWithConfirm):
|
|
|
78
77
|
"""
|
|
79
78
|
return re.fullmatch("[A-Za-z0-9_.\\-]+", str_id) is not None
|
|
80
79
|
|
|
81
|
-
def main(self, annotation_specs: dict[str, Any], *, target_attribute_names:
|
|
80
|
+
def main(self, annotation_specs: dict[str, Any], *, target_attribute_names: Collection[str] | None = None) -> None:
|
|
82
81
|
"""
|
|
83
82
|
アノテーション仕様内の属性IDを英語名に変更します。
|
|
84
83
|
|
|
@@ -166,7 +165,7 @@ def main(args: argparse.Namespace) -> None:
|
|
|
166
165
|
GetAnnotationSpecsWithAttributeIdReplaced(service, facade, args).main()
|
|
167
166
|
|
|
168
167
|
|
|
169
|
-
def add_parser(subparsers:
|
|
168
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
170
169
|
subcommand_name = "get_with_attribute_id_replaced_english_name"
|
|
171
170
|
|
|
172
171
|
subcommand_help = "属性IDをUUIDから英語名に置換したアノテーション仕様のJSONを出力します。"
|
|
@@ -4,11 +4,10 @@ import argparse
|
|
|
4
4
|
import logging
|
|
5
5
|
import re
|
|
6
6
|
from collections.abc import Collection
|
|
7
|
-
from typing import Any
|
|
7
|
+
from typing import Any
|
|
8
8
|
|
|
9
9
|
import more_itertools
|
|
10
10
|
|
|
11
|
-
import annofabcli
|
|
12
11
|
import annofabcli.common.cli
|
|
13
12
|
from annofabcli.common.cli import (
|
|
14
13
|
ArgumentParser,
|
|
@@ -36,7 +35,7 @@ class ReplacingChoiceId(CommandLineWithConfirm):
|
|
|
36
35
|
"""
|
|
37
36
|
return re.fullmatch("[A-Za-z0-9_.\\-]+", str_id) is not None
|
|
38
37
|
|
|
39
|
-
def main(self, annotation_specs: dict[str, Any], *, target_attribute_names:
|
|
38
|
+
def main(self, annotation_specs: dict[str, Any], *, target_attribute_names: Collection[str] | None = None) -> None:
|
|
40
39
|
"""
|
|
41
40
|
アノテーション仕様内の選択肢IDを英語名に変更します。
|
|
42
41
|
|
|
@@ -140,7 +139,7 @@ def main(args: argparse.Namespace) -> None:
|
|
|
140
139
|
GetAnnotationSpecsWithAttributeIdReplaced(service, facade, args).main()
|
|
141
140
|
|
|
142
141
|
|
|
143
|
-
def add_parser(subparsers:
|
|
142
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
144
143
|
subcommand_name = "get_with_choice_id_replaced_english_name"
|
|
145
144
|
|
|
146
145
|
subcommand_help = "選択肢IDをUUIDから英語名に置換したアノテーション仕様のJSONを出力します。"
|
|
@@ -4,11 +4,10 @@ import argparse
|
|
|
4
4
|
import logging
|
|
5
5
|
import re
|
|
6
6
|
from collections.abc import Collection
|
|
7
|
-
from typing import Any
|
|
7
|
+
from typing import Any
|
|
8
8
|
|
|
9
9
|
import more_itertools
|
|
10
10
|
|
|
11
|
-
import annofabcli
|
|
12
11
|
import annofabcli.common.cli
|
|
13
12
|
from annofabcli.common.cli import (
|
|
14
13
|
ArgumentParser,
|
|
@@ -64,7 +63,7 @@ class ReplacingLabelId(CommandLineWithConfirm):
|
|
|
64
63
|
"""
|
|
65
64
|
return re.fullmatch("[A-Za-z0-9_.\\-]+", str_id) is not None
|
|
66
65
|
|
|
67
|
-
def main(self, annotation_specs: dict[str, Any], *, target_label_names:
|
|
66
|
+
def main(self, annotation_specs: dict[str, Any], *, target_label_names: Collection[str] | None = None) -> None:
|
|
68
67
|
"""
|
|
69
68
|
アノテーション仕様内のlabel_idをラベル英語名に変更します。
|
|
70
69
|
|
|
@@ -151,7 +150,7 @@ def main(args: argparse.Namespace) -> None:
|
|
|
151
150
|
GetAnnotationSpecsWithLabelIdReplaced(service, facade, args).main()
|
|
152
151
|
|
|
153
152
|
|
|
154
|
-
def add_parser(subparsers:
|
|
153
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
155
154
|
subcommand_name = "get_with_label_id_replaced_english_name"
|
|
156
155
|
|
|
157
156
|
subcommand_help = "label_idをUUIDから英語名に置換したアノテーション仕様のJSONを出力します。"
|
|
@@ -7,14 +7,13 @@ import sys
|
|
|
7
7
|
from collections import defaultdict
|
|
8
8
|
from dataclasses import dataclass
|
|
9
9
|
from pathlib import Path
|
|
10
|
-
from typing import Any
|
|
10
|
+
from typing import Any
|
|
11
11
|
|
|
12
12
|
import pandas
|
|
13
13
|
from annofabapi.models import Lang
|
|
14
14
|
from annofabapi.util.annotation_specs import get_message_with_lang
|
|
15
15
|
from dataclasses_json import DataClassJsonMixin
|
|
16
16
|
|
|
17
|
-
import annofabcli
|
|
18
17
|
import annofabcli.common.cli
|
|
19
18
|
from annofabcli.common.annofab.annotation_specs import keybind_to_text
|
|
20
19
|
from annofabcli.common.cli import (
|
|
@@ -44,12 +43,12 @@ class FlattenAttribute(DataClassJsonMixin):
|
|
|
44
43
|
APIレスポンスの ``additional_data_definition_id`` に相当します。
|
|
45
44
|
``additional_data_definition_id`` という名前がアノテーションJSONの `attributes` と対応していることが分かりにくかったので、`attribute_id`という名前に変えました。
|
|
46
45
|
"""
|
|
47
|
-
attribute_name_en:
|
|
48
|
-
attribute_name_ja:
|
|
49
|
-
attribute_name_vi:
|
|
46
|
+
attribute_name_en: str | None
|
|
47
|
+
attribute_name_ja: str | None
|
|
48
|
+
attribute_name_vi: str | None
|
|
50
49
|
attribute_type: str
|
|
51
50
|
"""属性の種類"""
|
|
52
|
-
default:
|
|
51
|
+
default: str | bool | int | None
|
|
53
52
|
"""デフォルト値"""
|
|
54
53
|
read_only: bool
|
|
55
54
|
"""読み込み専用の属性か否か"""
|
|
@@ -62,7 +61,7 @@ class FlattenAttribute(DataClassJsonMixin):
|
|
|
62
61
|
"""制約の個数"""
|
|
63
62
|
reference_label_count: int
|
|
64
63
|
"""参照されているラベルの個数"""
|
|
65
|
-
keybind:
|
|
64
|
+
keybind: str | None
|
|
66
65
|
|
|
67
66
|
|
|
68
67
|
def create_relationship_between_attribute_and_label(labels_v3: list[dict[str, Any]]) -> dict[str, set[str]]:
|
|
@@ -125,7 +124,7 @@ def create_flatten_attribute_list_from_additionals(additionals_v3: list[dict[str
|
|
|
125
124
|
class PrintAnnotationSpecsAttribute(CommandLine):
|
|
126
125
|
COMMON_MESSAGE = "annofabcli annotation_specs list_attribute: error:"
|
|
127
126
|
|
|
128
|
-
def print_annotation_specs_attribute(self, annotation_specs_v3: dict[str, Any], output_format: FormatArgument, output:
|
|
127
|
+
def print_annotation_specs_attribute(self, annotation_specs_v3: dict[str, Any], output_format: FormatArgument, output: str | None = None) -> None:
|
|
129
128
|
attribute_list = create_flatten_attribute_list_from_additionals(annotation_specs_v3["additionals"], annotation_specs_v3["labels"], annotation_specs_v3["restrictions"])
|
|
130
129
|
logger.info(f"{len(attribute_list)} 件の属性情報を出力します。")
|
|
131
130
|
if output_format == FormatArgument.CSV:
|
|
@@ -149,7 +148,7 @@ class PrintAnnotationSpecsAttribute(CommandLine):
|
|
|
149
148
|
elif output_format in [FormatArgument.JSON, FormatArgument.PRETTY_JSON]:
|
|
150
149
|
print_according_to_format([e.to_dict() for e in attribute_list], format=output_format, output=output)
|
|
151
150
|
|
|
152
|
-
def get_history_id_from_before_index(self, project_id: str, before: int) ->
|
|
151
|
+
def get_history_id_from_before_index(self, project_id: str, before: int) -> str | None:
|
|
153
152
|
histories, _ = self.service.api.get_annotation_specs_histories(project_id)
|
|
154
153
|
if before + 1 > len(histories):
|
|
155
154
|
logger.warning(f"アノテーション仕様の履歴は{len(histories)}個のため、最新より{before}個前のアノテーション仕様は見つかりませんでした。")
|
|
@@ -236,7 +235,7 @@ def main(args: argparse.Namespace) -> None:
|
|
|
236
235
|
PrintAnnotationSpecsAttribute(service, facade, args).main()
|
|
237
236
|
|
|
238
237
|
|
|
239
|
-
def add_parser(subparsers:
|
|
238
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
240
239
|
subcommand_name = "list_attribute"
|
|
241
240
|
|
|
242
241
|
subcommand_help = "アノテーション仕様の属性情報を出力します。"
|
|
@@ -6,14 +6,13 @@ import logging
|
|
|
6
6
|
import sys
|
|
7
7
|
from dataclasses import dataclass
|
|
8
8
|
from pathlib import Path
|
|
9
|
-
from typing import Any
|
|
9
|
+
from typing import Any
|
|
10
10
|
|
|
11
11
|
import pandas
|
|
12
12
|
from annofabapi.models import Lang
|
|
13
13
|
from annofabapi.util.annotation_specs import get_english_message, get_message_with_lang
|
|
14
14
|
from dataclasses_json import DataClassJsonMixin
|
|
15
15
|
|
|
16
|
-
import annofabcli
|
|
17
16
|
import annofabcli.common.cli
|
|
18
17
|
from annofabcli.common.annofab.annotation_specs import keybind_to_text
|
|
19
18
|
from annofabcli.common.cli import (
|
|
@@ -41,7 +40,7 @@ class FlattenChoice(DataClassJsonMixin):
|
|
|
41
40
|
どの属性に属しているか分かるようにするため追加した。
|
|
42
41
|
"""
|
|
43
42
|
|
|
44
|
-
attribute_name_en:
|
|
43
|
+
attribute_name_en: str | None
|
|
45
44
|
"""
|
|
46
45
|
属性名(英語)
|
|
47
46
|
どの属性に属しているか分かるようにするため追加した。
|
|
@@ -50,12 +49,12 @@ class FlattenChoice(DataClassJsonMixin):
|
|
|
50
49
|
attribute_type: str
|
|
51
50
|
"""属性の種類"""
|
|
52
51
|
choice_id: str
|
|
53
|
-
choice_name_en:
|
|
54
|
-
choice_name_ja:
|
|
55
|
-
choice_name_vi:
|
|
52
|
+
choice_name_en: str | None
|
|
53
|
+
choice_name_ja: str | None
|
|
54
|
+
choice_name_vi: str | None
|
|
56
55
|
is_default: bool
|
|
57
56
|
"""初期値として設定されているかどうか"""
|
|
58
|
-
keybind:
|
|
57
|
+
keybind: str | None
|
|
59
58
|
"""キーバインド"""
|
|
60
59
|
|
|
61
60
|
|
|
@@ -105,7 +104,7 @@ def create_flatten_choice_list_from_additionals(additionals_v3: list[dict[str, A
|
|
|
105
104
|
class PrintAnnotationSpecsAttribute(CommandLine):
|
|
106
105
|
COMMON_MESSAGE = "annofabcli annotation_specs list_choice: error:"
|
|
107
106
|
|
|
108
|
-
def print_annotation_specs_choice(self, annotation_specs_v3: dict[str, Any], output_format: FormatArgument, output:
|
|
107
|
+
def print_annotation_specs_choice(self, annotation_specs_v3: dict[str, Any], output_format: FormatArgument, output: str | None = None) -> None:
|
|
109
108
|
choice_list = create_flatten_choice_list_from_additionals(annotation_specs_v3["additionals"])
|
|
110
109
|
logger.info(f"{len(choice_list)} 件の選択肢情報を出力します。")
|
|
111
110
|
|
|
@@ -127,7 +126,7 @@ class PrintAnnotationSpecsAttribute(CommandLine):
|
|
|
127
126
|
elif output_format in [FormatArgument.JSON, FormatArgument.PRETTY_JSON]:
|
|
128
127
|
print_according_to_format([e.to_dict() for e in choice_list], format=output_format, output=output)
|
|
129
128
|
|
|
130
|
-
def get_history_id_from_before_index(self, project_id: str, before: int) ->
|
|
129
|
+
def get_history_id_from_before_index(self, project_id: str, before: int) -> str | None:
|
|
131
130
|
histories, _ = self.service.api.get_annotation_specs_histories(project_id)
|
|
132
131
|
if before + 1 > len(histories):
|
|
133
132
|
logger.warning(f"アノテーション仕様の履歴は{len(histories)}個のため、最新より{before}個前のアノテーション仕様は見つかりませんでした。")
|
|
@@ -216,7 +215,7 @@ def main(args: argparse.Namespace) -> None:
|
|
|
216
215
|
PrintAnnotationSpecsAttribute(service, facade, args).main()
|
|
217
216
|
|
|
218
217
|
|
|
219
|
-
def add_parser(subparsers:
|
|
218
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
220
219
|
subcommand_name = "list_choice"
|
|
221
220
|
|
|
222
221
|
subcommand_help = "アノテーション仕様のドロップダウンまたはラジオボタン属性の選択肢情報を出力します。"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
import logging
|
|
3
|
-
from typing import Any
|
|
3
|
+
from typing import Any
|
|
4
4
|
|
|
5
5
|
import annofabapi
|
|
6
6
|
|
|
7
|
-
import annofabcli
|
|
7
|
+
import annofabcli.common.cli
|
|
8
8
|
from annofabcli.common.cli import ArgumentParser, CommandLine, build_annofabapi_resource_and_login
|
|
9
9
|
from annofabcli.common.enums import FormatArgument
|
|
10
10
|
from annofabcli.common.facade import AnnofabApiFacade
|
|
@@ -54,7 +54,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
54
54
|
parser.set_defaults(subcommand_func=main)
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
def add_parser(subparsers:
|
|
57
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
58
58
|
subcommand_name = "list_history"
|
|
59
59
|
subcommand_help = "アノテーション仕様の変更履歴を表示する。"
|
|
60
60
|
description = "アノテーション仕様の変更履歴を表示する。"
|