annofabcli 1.114.5__py3-none-any.whl → 1.114.7__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/annotation/change_annotation_attributes.py +8 -8
- annofabcli/annotation/create_classification_annotation.py +26 -9
- annofabcli/annotation/delete_annotation.py +14 -14
- annofabcli/annotation/import_annotation.py +57 -19
- annofabcli/annotation_zip/list_annotation_3d_bounding_box.py +2 -2
- annofabcli/annotation_zip/list_annotation_bounding_box_2d.py +2 -2
- annofabcli/annotation_zip/list_polygon_annotation.py +2 -2
- annofabcli/annotation_zip/list_polyline_annotation.py +2 -2
- annofabcli/annotation_zip/list_range_annotation.py +2 -2
- annofabcli/annotation_zip/list_single_point_annotation.py +2 -2
- annofabcli/comment/delete_comment.py +2 -2
- annofabcli/comment/put_comment.py +179 -36
- annofabcli/comment/put_comment_simply.py +7 -4
- annofabcli/comment/put_inspection_comment.py +5 -1
- annofabcli/comment/put_onhold_comment.py +5 -1
- annofabcli/filesystem/draw_annotation.py +1 -1
- annofabcli/input_data/list_all_input_data_merged_task.py +3 -3
- annofabcli/instruction/copy_instruction.py +1 -1
- annofabcli/statistics/histogram.py +1 -1
- annofabcli/statistics/list_annotation_count.py +4 -4
- annofabcli/statistics/list_annotation_duration.py +1 -1
- annofabcli/statistics/list_video_duration.py +1 -1
- annofabcli/task/change_operator.py +3 -3
- annofabcli/task/complete_tasks.py +5 -3
- {annofabcli-1.114.5.dist-info → annofabcli-1.114.7.dist-info}/METADATA +1 -1
- {annofabcli-1.114.5.dist-info → annofabcli-1.114.7.dist-info}/RECORD +29 -29
- {annofabcli-1.114.5.dist-info → annofabcli-1.114.7.dist-info}/WHEEL +0 -0
- {annofabcli-1.114.5.dist-info → annofabcli-1.114.7.dist-info}/entry_points.txt +0 -0
- {annofabcli-1.114.5.dist-info → annofabcli-1.114.7.dist-info}/licenses/LICENSE +0 -0
|
@@ -46,7 +46,7 @@ class ChangeAnnotationAttributesMain(CommandLineWithConfirm):
|
|
|
46
46
|
service: annofabapi.Resource,
|
|
47
47
|
*,
|
|
48
48
|
project_id: str,
|
|
49
|
-
|
|
49
|
+
include_complete_task: bool,
|
|
50
50
|
all_yes: bool,
|
|
51
51
|
) -> None:
|
|
52
52
|
self.service = service
|
|
@@ -54,7 +54,7 @@ class ChangeAnnotationAttributesMain(CommandLineWithConfirm):
|
|
|
54
54
|
CommandLineWithConfirm.__init__(self, all_yes)
|
|
55
55
|
|
|
56
56
|
self.project_id = project_id
|
|
57
|
-
self.
|
|
57
|
+
self.include_complete_task = include_complete_task
|
|
58
58
|
|
|
59
59
|
self.dump_annotation_obj = DumpAnnotationMain(service, project_id)
|
|
60
60
|
|
|
@@ -141,9 +141,9 @@ class ChangeAnnotationAttributesMain(CommandLineWithConfirm):
|
|
|
141
141
|
logger.warning(f"task_id='{task_id}': タスクが作業中状態のため、スキップします。")
|
|
142
142
|
return False, 0
|
|
143
143
|
|
|
144
|
-
if not self.
|
|
144
|
+
if not self.include_complete_task: # noqa: SIM102
|
|
145
145
|
if task.status == TaskStatus.COMPLETE:
|
|
146
|
-
logger.warning(f"task_id='{task_id}': タスクが完了状態のため、スキップします。完了状態のタスクのアノテーション属性値を変更するには、 ``--
|
|
146
|
+
logger.warning(f"task_id='{task_id}': タスクが完了状態のため、スキップします。完了状態のタスクのアノテーション属性値を変更するには、 ``--include_complete_task`` を指定してください。")
|
|
147
147
|
return False, 0
|
|
148
148
|
|
|
149
149
|
annotation_list = self.get_annotation_list_for_task(task_id, annotation_query)
|
|
@@ -314,15 +314,15 @@ class ChangeAttributesOfAnnotation(CommandLine):
|
|
|
314
314
|
backup_dir = Path(args.backup)
|
|
315
315
|
|
|
316
316
|
super().validate_project(project_id, [ProjectMemberRole.OWNER, ProjectMemberRole.ACCEPTER])
|
|
317
|
-
if args.
|
|
317
|
+
if args.include_complete_task: # noqa: SIM102
|
|
318
318
|
if not self.facade.contains_any_project_member_role(project_id, [ProjectMemberRole.OWNER]):
|
|
319
319
|
print( # noqa: T201
|
|
320
|
-
f"{self.COMMON_MESSAGE} argument --
|
|
320
|
+
f"{self.COMMON_MESSAGE} argument --include_complete_task : '--include_complete_task' 引数を利用するにはプロジェクトのオーナーロールを持つユーザーで実行する必要があります。",
|
|
321
321
|
file=sys.stderr,
|
|
322
322
|
)
|
|
323
323
|
sys.exit(COMMAND_LINE_ERROR_STATUS_CODE)
|
|
324
324
|
|
|
325
|
-
main_obj = ChangeAnnotationAttributesMain(self.service, project_id=project_id,
|
|
325
|
+
main_obj = ChangeAnnotationAttributesMain(self.service, project_id=project_id, include_complete_task=args.include_complete_task, all_yes=args.yes)
|
|
326
326
|
main_obj.change_annotation_attributes_for_task_list(
|
|
327
327
|
task_id_list,
|
|
328
328
|
annotation_query=annotation_query,
|
|
@@ -362,7 +362,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
362
362
|
)
|
|
363
363
|
|
|
364
364
|
parser.add_argument(
|
|
365
|
-
"--
|
|
365
|
+
"--include_complete_task",
|
|
366
366
|
action="store_true",
|
|
367
367
|
help="完了状態のタスクのアノテーション属性も変更します。ただし、オーナーロールを持つユーザーでしか実行できません。",
|
|
368
368
|
)
|
|
@@ -33,7 +33,8 @@ class CreateClassificationAnnotationMain(CommandLineWithConfirm):
|
|
|
33
33
|
project_id: str,
|
|
34
34
|
all_yes: bool,
|
|
35
35
|
is_change_operator_to_me: bool,
|
|
36
|
-
|
|
36
|
+
include_complete_task: bool,
|
|
37
|
+
include_on_hold_task: bool,
|
|
37
38
|
) -> None:
|
|
38
39
|
self.service = service
|
|
39
40
|
self.facade = AnnofabApiFacade(service)
|
|
@@ -41,7 +42,8 @@ class CreateClassificationAnnotationMain(CommandLineWithConfirm):
|
|
|
41
42
|
|
|
42
43
|
self.project_id = project_id
|
|
43
44
|
self.is_change_operator_to_me = is_change_operator_to_me
|
|
44
|
-
self.
|
|
45
|
+
self.include_complete_task = include_complete_task
|
|
46
|
+
self.include_on_hold_task = include_on_hold_task
|
|
45
47
|
|
|
46
48
|
# アノテーション仕様を取得
|
|
47
49
|
annotation_specs_v3, _ = self.service.api.get_annotation_specs(self.project_id, query_params={"v": "3"})
|
|
@@ -69,10 +71,18 @@ class CreateClassificationAnnotationMain(CommandLineWithConfirm):
|
|
|
69
71
|
logger.info(f"タスク'{task_id}'は作業中状態のため、全体アノテーションの作成をスキップします。")
|
|
70
72
|
return None, False, None
|
|
71
73
|
|
|
72
|
-
if not self.
|
|
74
|
+
if not self.include_complete_task: # noqa: SIM102
|
|
73
75
|
if task["status"] == TaskStatus.COMPLETE.value:
|
|
74
76
|
logger.info(
|
|
75
|
-
f"タスク'{task_id}'
|
|
77
|
+
f"タスク'{task_id}'は完了状態のため、全体アノテーションの作成をスキップします。"
|
|
78
|
+
f"完了状態のタスクに全体アノテーションを作成するには、 ``--include_complete_task`` を指定してください。"
|
|
79
|
+
)
|
|
80
|
+
return None, False, None
|
|
81
|
+
|
|
82
|
+
if not self.include_on_hold_task: # noqa: SIM102
|
|
83
|
+
if task["status"] == TaskStatus.ON_HOLD.value:
|
|
84
|
+
logger.info(
|
|
85
|
+
f"タスク'{task_id}'は保留状態のため、全体アノテーションの作成をスキップします。保留状態のタスクに全体アノテーションを作成するには、 ``--include_on_hold_task`` を指定してください。"
|
|
76
86
|
)
|
|
77
87
|
return None, False, None
|
|
78
88
|
|
|
@@ -324,11 +334,11 @@ class CreateClassificationAnnotation(CommandLine):
|
|
|
324
334
|
|
|
325
335
|
super().validate_project(project_id, [ProjectMemberRole.OWNER, ProjectMemberRole.ACCEPTER])
|
|
326
336
|
|
|
327
|
-
if args.
|
|
337
|
+
if args.include_complete_task: # noqa: SIM102
|
|
328
338
|
if not self.facade.contains_any_project_member_role(project_id, [ProjectMemberRole.OWNER]):
|
|
329
339
|
print( # noqa: T201
|
|
330
|
-
"annofabcli annotation create_classification: error: argument --
|
|
331
|
-
"'--
|
|
340
|
+
"annofabcli annotation create_classification: error: argument --include_complete_task : "
|
|
341
|
+
"'--include_complete_task' 引数を利用するにはプロジェクトのオーナーロールを持つユーザーで実行する必要があります。",
|
|
332
342
|
file=sys.stderr,
|
|
333
343
|
)
|
|
334
344
|
sys.exit(COMMAND_LINE_ERROR_STATUS_CODE)
|
|
@@ -341,7 +351,8 @@ class CreateClassificationAnnotation(CommandLine):
|
|
|
341
351
|
project_id=project_id,
|
|
342
352
|
all_yes=self.all_yes,
|
|
343
353
|
is_change_operator_to_me=args.change_operator_to_me,
|
|
344
|
-
|
|
354
|
+
include_complete_task=args.include_complete_task,
|
|
355
|
+
include_on_hold_task=args.include_on_hold_task,
|
|
345
356
|
)
|
|
346
357
|
|
|
347
358
|
main_obj.main(task_ids, labels, parallelism=args.parallelism)
|
|
@@ -377,11 +388,17 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
377
388
|
)
|
|
378
389
|
|
|
379
390
|
parser.add_argument(
|
|
380
|
-
"--
|
|
391
|
+
"--include_complete_task",
|
|
381
392
|
action="store_true",
|
|
382
393
|
help="完了状態のタスクにも全体アノテーションを作成します。ただし、オーナーロールを持つユーザーでしか実行できません。",
|
|
383
394
|
)
|
|
384
395
|
|
|
396
|
+
parser.add_argument(
|
|
397
|
+
"--include_on_hold_task",
|
|
398
|
+
action="store_true",
|
|
399
|
+
help="保留状態のタスクにも全体アノテーションを作成します。",
|
|
400
|
+
)
|
|
401
|
+
|
|
385
402
|
parser.add_argument(
|
|
386
403
|
"--parallelism",
|
|
387
404
|
type=int,
|
|
@@ -46,7 +46,7 @@ class DeleteAnnotationMain(CommandLineWithConfirm):
|
|
|
46
46
|
"""アノテーション削除処理用のクラス
|
|
47
47
|
|
|
48
48
|
Args:
|
|
49
|
-
|
|
49
|
+
include_complete_task: 完了状態のタスクを削除するかどうか
|
|
50
50
|
"""
|
|
51
51
|
|
|
52
52
|
def __init__(
|
|
@@ -54,12 +54,12 @@ class DeleteAnnotationMain(CommandLineWithConfirm):
|
|
|
54
54
|
service: annofabapi.Resource,
|
|
55
55
|
project_id: str,
|
|
56
56
|
*,
|
|
57
|
-
|
|
57
|
+
include_complete_task: bool,
|
|
58
58
|
all_yes: bool,
|
|
59
59
|
) -> None:
|
|
60
60
|
self.service = service
|
|
61
61
|
self.facade = AnnofabApiFacade(service)
|
|
62
|
-
self.
|
|
62
|
+
self.include_complete_task = include_complete_task
|
|
63
63
|
CommandLineWithConfirm.__init__(self, all_yes)
|
|
64
64
|
self.project_id = project_id
|
|
65
65
|
self.dump_annotation_obj = DumpAnnotationMain(service, project_id)
|
|
@@ -133,9 +133,9 @@ class DeleteAnnotationMain(CommandLineWithConfirm):
|
|
|
133
133
|
logger.info(f"task_id='{task_id}' :: タスクが作業中状態のため、スキップします。")
|
|
134
134
|
return
|
|
135
135
|
|
|
136
|
-
if not self.
|
|
136
|
+
if not self.include_complete_task: # noqa: SIM102
|
|
137
137
|
if task.status == TaskStatus.COMPLETE:
|
|
138
|
-
logger.info(f"task_id='{task_id}' :: タスクが完了状態のため、スキップします。完了状態のタスクのアノテーションを削除するには、`--
|
|
138
|
+
logger.info(f"task_id='{task_id}' :: タスクが完了状態のため、スキップします。完了状態のタスクのアノテーションを削除するには、`--include_complete_task`オプションを指定してください。")
|
|
139
139
|
return
|
|
140
140
|
|
|
141
141
|
annotation_list = self.get_annotation_list_for_task(task_id, annotation_query=annotation_query)
|
|
@@ -182,7 +182,7 @@ class DeleteAnnotationMain(CommandLineWithConfirm):
|
|
|
182
182
|
if task.status == TaskStatus.WORKING:
|
|
183
183
|
continue
|
|
184
184
|
|
|
185
|
-
if not self.
|
|
185
|
+
if not self.include_complete_task and task.status == TaskStatus.COMPLETE:
|
|
186
186
|
continue
|
|
187
187
|
|
|
188
188
|
# アノテーション一覧を取得して、削除対象があるかチェック
|
|
@@ -316,11 +316,11 @@ class DeleteAnnotationMain(CommandLineWithConfirm):
|
|
|
316
316
|
failed_to_delete_annotation_count += annotation_count
|
|
317
317
|
continue
|
|
318
318
|
|
|
319
|
-
if not self.
|
|
319
|
+
if not self.include_complete_task: # noqa: SIM102
|
|
320
320
|
if task["status"] == TaskStatus.COMPLETE.value:
|
|
321
321
|
logger.info(
|
|
322
322
|
f"task_id='{task_id}' :: タスクが完了状態のため、アノテーション {annotation_count} 件の削除をスキップします。"
|
|
323
|
-
f"完了状態のタスクのアノテーションを削除するには、`--
|
|
323
|
+
f"完了状態のタスクのアノテーションを削除するには、`--include_complete_task`オプションを指定してください。"
|
|
324
324
|
)
|
|
325
325
|
failed_to_delete_annotation_count += annotation_count
|
|
326
326
|
continue
|
|
@@ -376,14 +376,14 @@ class DeleteAnnotation(CommandLine):
|
|
|
376
376
|
else:
|
|
377
377
|
backup_dir = Path(args.backup)
|
|
378
378
|
|
|
379
|
-
if args.
|
|
380
|
-
# --
|
|
381
|
-
# 完了状態のタスクを削除するには、オーナーロールである必要があるため、`args.
|
|
379
|
+
if args.include_complete_task:
|
|
380
|
+
# --include_complete_taskオプションが指定されている場合は、完了状態のタスクも削除する
|
|
381
|
+
# 完了状態のタスクを削除するには、オーナーロールである必要があるため、`args.include_complete_task`で条件を分岐する
|
|
382
382
|
super().validate_project(project_id, [ProjectMemberRole.OWNER])
|
|
383
383
|
else:
|
|
384
384
|
super().validate_project(project_id, [ProjectMemberRole.OWNER, ProjectMemberRole.ACCEPTER])
|
|
385
385
|
|
|
386
|
-
main_obj = DeleteAnnotationMain(self.service, project_id, all_yes=args.yes,
|
|
386
|
+
main_obj = DeleteAnnotationMain(self.service, project_id, all_yes=args.yes, include_complete_task=args.include_complete_task)
|
|
387
387
|
|
|
388
388
|
if args.json is not None:
|
|
389
389
|
dict_annotation_list = get_json_from_args(args.json)
|
|
@@ -479,7 +479,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
479
479
|
)
|
|
480
480
|
|
|
481
481
|
parser.add_argument(
|
|
482
|
-
"--
|
|
482
|
+
"--include_complete_task",
|
|
483
483
|
action="store_true",
|
|
484
484
|
help="指定した場合は、完了状態のタスクのアノテーションも削除します。ただし、完了状態のタスクを削除するには、オーナーロールを持つユーザーが実行する必要があります。",
|
|
485
485
|
)
|
|
@@ -499,7 +499,7 @@ def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse
|
|
|
499
499
|
"タスク配下のアノテーションを削除します。ただし、作業中状態のタスクのアノテーションは削除できません。"
|
|
500
500
|
"間違えてアノテーションを削除したときに復元できるようにするため、 ``--backup`` でバックアップ用のディレクトリを指定することを推奨します。"
|
|
501
501
|
)
|
|
502
|
-
epilog = "オーナーまたはチェッカーロールを持つユーザで実行してください。ただし``--
|
|
502
|
+
epilog = "オーナーまたはチェッカーロールを持つユーザで実行してください。ただし``--include_complete_task``オプションを指定した場合は、オーナーロールを持つユーザで実行してください。"
|
|
503
503
|
|
|
504
504
|
parser = annofabcli.common.cli.add_parser(subparsers, subcommand_name, subcommand_help, description, epilog=epilog)
|
|
505
505
|
parse_args(parser)
|
|
@@ -410,9 +410,11 @@ class ImportAnnotationMain(CommandLineWithConfirm):
|
|
|
410
410
|
*,
|
|
411
411
|
project_id: str,
|
|
412
412
|
all_yes: bool,
|
|
413
|
-
|
|
413
|
+
change_operator_to_me: bool,
|
|
414
414
|
is_merge: bool,
|
|
415
415
|
is_overwrite: bool,
|
|
416
|
+
include_complete_task: bool,
|
|
417
|
+
include_on_hold_task: bool,
|
|
416
418
|
converter: AnnotationConverter,
|
|
417
419
|
) -> None:
|
|
418
420
|
self.service = service
|
|
@@ -420,9 +422,11 @@ class ImportAnnotationMain(CommandLineWithConfirm):
|
|
|
420
422
|
CommandLineWithConfirm.__init__(self, all_yes)
|
|
421
423
|
|
|
422
424
|
self.project_id = project_id
|
|
423
|
-
self.
|
|
425
|
+
self.change_operator_to_me = change_operator_to_me
|
|
424
426
|
self.is_merge = is_merge
|
|
425
427
|
self.is_overwrite = is_overwrite
|
|
428
|
+
self.include_complete_task = include_complete_task
|
|
429
|
+
self.include_on_hold_task = include_on_hold_task
|
|
426
430
|
self.converter = converter
|
|
427
431
|
|
|
428
432
|
def put_annotation_for_input_data(self, parser: SimpleAnnotationParser) -> int:
|
|
@@ -487,7 +491,7 @@ class ImportAnnotationMain(CommandLineWithConfirm):
|
|
|
487
491
|
|
|
488
492
|
return success_input_data_count, success_annotation_count
|
|
489
493
|
|
|
490
|
-
def execute_task(self, task_parser: SimpleAnnotationParserByTask, task_index: int | None = None) -> bool:
|
|
494
|
+
def execute_task(self, task_parser: SimpleAnnotationParserByTask, task_index: int | None = None) -> bool: # noqa: PLR0911
|
|
491
495
|
"""
|
|
492
496
|
1個のタスクに対してアノテーションを登録する。
|
|
493
497
|
|
|
@@ -499,26 +503,39 @@ class ImportAnnotationMain(CommandLineWithConfirm):
|
|
|
499
503
|
|
|
500
504
|
"""
|
|
501
505
|
task_id = task_parser.task_id
|
|
502
|
-
|
|
503
|
-
return False
|
|
504
|
-
|
|
505
|
-
logger_prefix = f"{task_index + 1!s} 件目: " if task_index is not None else ""
|
|
506
|
-
logger.info(f"{logger_prefix}task_id='{task_id}' に対して処理します。")
|
|
506
|
+
logger_prefix = f"{task_index + 1!s} 件目 :: task_id='{task_id}' :: " if task_index is not None else ""
|
|
507
507
|
|
|
508
508
|
task = self.service.wrapper.get_task_or_none(self.project_id, task_id)
|
|
509
509
|
if task is None:
|
|
510
|
-
logger.warning(f"
|
|
510
|
+
logger.warning(f"{logger_prefix}タスクは存在しません。")
|
|
511
|
+
return False
|
|
512
|
+
|
|
513
|
+
logger.debug(f"{logger_prefix}phase='{task['phase']}', status='{task['status']}'")
|
|
514
|
+
if task["status"] == TaskStatus.WORKING.value:
|
|
515
|
+
logger.info(f"{logger_prefix}タスクは作業中のため、処理をスキップします。 :: status={task['status']}")
|
|
516
|
+
return False
|
|
517
|
+
|
|
518
|
+
if not self.include_complete_task and task["status"] == TaskStatus.COMPLETE.value:
|
|
519
|
+
logger.info(f"{logger_prefix}タスクは完了状態のため、処理をスキップします。完了状態のタスクを処理する場合は、 '--include_complete_task'を指定してください。 :: status={task['status']}")
|
|
511
520
|
return False
|
|
512
521
|
|
|
513
|
-
if task["status"]
|
|
514
|
-
logger.info(
|
|
522
|
+
if not self.include_on_hold_task and task["status"] == TaskStatus.ON_HOLD.value:
|
|
523
|
+
logger.info(
|
|
524
|
+
f"{logger_prefix}タスクは保留中状態のため、処理をスキップします。保留中状態のタスクにアノテーションをインポートする場合は、 "
|
|
525
|
+
f"'--include_on_hold_task'を指定してください。 :: status={task['status']}"
|
|
526
|
+
)
|
|
515
527
|
return False
|
|
516
528
|
|
|
529
|
+
if not self.confirm_processing(f"task_id='{task_id}'のタスク(phase={task['phase']}, status={task['status']})にアノテーションをインポートしますか?"):
|
|
530
|
+
return False
|
|
531
|
+
|
|
532
|
+
logger.info(f"{logger_prefix}タスクにアノテーションをインポートします。")
|
|
533
|
+
|
|
517
534
|
old_account_id: str | None = None
|
|
518
535
|
changed_operator = False
|
|
519
|
-
if self.
|
|
536
|
+
if self.change_operator_to_me:
|
|
520
537
|
if not can_put_annotation(task, self.service.api.account_id):
|
|
521
|
-
logger.debug(f"
|
|
538
|
+
logger.debug(f"{logger_prefix}担当者を自分自身に変更します。")
|
|
522
539
|
old_account_id = task["account_id"]
|
|
523
540
|
task = self.service.wrapper.change_task_operator(
|
|
524
541
|
self.project_id,
|
|
@@ -532,7 +549,7 @@ class ImportAnnotationMain(CommandLineWithConfirm):
|
|
|
532
549
|
if not can_put_annotation(task, self.service.api.account_id):
|
|
533
550
|
logger.debug(
|
|
534
551
|
f"タスク'{task_id}'は、過去に誰かに割り当てられたタスクで、現在の担当者が自分自身でないため、アノテーションのインポートをスキップします。"
|
|
535
|
-
f"担当者を自分自身に変更してアノテーションを登録する場合は `--
|
|
552
|
+
f"担当者を自分自身に変更してアノテーションを登録する場合は `--change_operator_to_me` を指定してください。"
|
|
536
553
|
)
|
|
537
554
|
return False
|
|
538
555
|
|
|
@@ -678,7 +695,9 @@ class ImportAnnotation(CommandLine):
|
|
|
678
695
|
all_yes=self.all_yes,
|
|
679
696
|
is_merge=args.merge,
|
|
680
697
|
is_overwrite=args.overwrite,
|
|
681
|
-
|
|
698
|
+
change_operator_to_me=args.change_operator_to_me,
|
|
699
|
+
include_complete_task=args.include_complete_task,
|
|
700
|
+
include_on_hold_task=args.include_on_hold_task,
|
|
682
701
|
converter=converter,
|
|
683
702
|
)
|
|
684
703
|
|
|
@@ -700,7 +719,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
700
719
|
"--annotation",
|
|
701
720
|
type=Path,
|
|
702
721
|
required=True,
|
|
703
|
-
help="Simpleアノテーションと同じフォルダ構成のzipファイル or
|
|
722
|
+
help="Simpleアノテーションと同じフォルダ構成のzipファイル or ディレクトリのパスを指定してください。",
|
|
704
723
|
)
|
|
705
724
|
|
|
706
725
|
argument_parser.add_task_id(required=False)
|
|
@@ -722,9 +741,23 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
722
741
|
)
|
|
723
742
|
|
|
724
743
|
parser.add_argument(
|
|
725
|
-
"--
|
|
744
|
+
"--change_operator_to_me",
|
|
726
745
|
action="store_true",
|
|
727
|
-
help="
|
|
746
|
+
help="タスクの担当者を自分自身に変更しないとアノテーションをインポートできない場合(担当者が自分自身でない AND 担当者が割れ当てられたことがあるタスク)は、タスクの担当者を自分自身に変更します。アノテーションをインポートが完了したら、担当者を元に戻します。" # noqa: E501
|
|
747
|
+
"未指定の場合は、そのようなタスクのアノテーションインポートはスキップされます。",
|
|
748
|
+
)
|
|
749
|
+
|
|
750
|
+
parser.add_argument(
|
|
751
|
+
"--include_complete_task",
|
|
752
|
+
action="store_true",
|
|
753
|
+
help="完了状態のタスクに対してもアノテーションをインポートします。未指定の場合は、完了状態のタスクはスキップされます。",
|
|
754
|
+
)
|
|
755
|
+
|
|
756
|
+
parser.add_argument(
|
|
757
|
+
"--include_on_hold_task",
|
|
758
|
+
action="store_true",
|
|
759
|
+
help="保留中状態のタスクに対してもアノテーションをインポートします。ただし、アノテーションインポート後は保留中状態でなくなる可能性があります。"
|
|
760
|
+
"未指定の場合は、保留中状態のタスクはスキップされます。",
|
|
728
761
|
)
|
|
729
762
|
|
|
730
763
|
parser.add_argument(
|
|
@@ -749,7 +782,12 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
749
782
|
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
750
783
|
subcommand_name = "import"
|
|
751
784
|
subcommand_help = "アノテーションをインポートします。"
|
|
752
|
-
description =
|
|
785
|
+
description = (
|
|
786
|
+
"アノテーションをインポートします。アノテーションのフォーマットは、Simpleアノテーションと同じフォルダ構成のzipファイルまたはディレクトリです。"
|
|
787
|
+
"ただし、作業中状態のタスクはインポートできません。"
|
|
788
|
+
"``--include_complete_task`` を指定すれば、完了状態のタスクにもインポートできます。"
|
|
789
|
+
"``--include_on_hold_task`` を指定すれば、保留中状態のタスクにもインポートできます。"
|
|
790
|
+
)
|
|
753
791
|
epilog = "オーナロールを持つユーザで実行してください。"
|
|
754
792
|
|
|
755
793
|
parser = annofabcli.common.cli.add_parser(subparsers, subcommand_name, subcommand_help, description, epilog=epilog)
|
|
@@ -32,9 +32,9 @@ logger = logging.getLogger(__name__)
|
|
|
32
32
|
class Annotation3DBoundingBoxInfo(DataClassJsonMixin):
|
|
33
33
|
project_id: str
|
|
34
34
|
task_id: str
|
|
35
|
-
task_status: str
|
|
36
35
|
task_phase: str
|
|
37
36
|
task_phase_stage: int
|
|
37
|
+
task_status: str
|
|
38
38
|
|
|
39
39
|
input_data_id: str
|
|
40
40
|
input_data_name: str
|
|
@@ -162,9 +162,9 @@ def create_df(
|
|
|
162
162
|
base_columns = [
|
|
163
163
|
"project_id",
|
|
164
164
|
"task_id",
|
|
165
|
-
"task_status",
|
|
166
165
|
"task_phase",
|
|
167
166
|
"task_phase_stage",
|
|
167
|
+
"task_status",
|
|
168
168
|
"input_data_id",
|
|
169
169
|
"input_data_name",
|
|
170
170
|
"updated_datetime",
|
|
@@ -32,9 +32,9 @@ logger = logging.getLogger(__name__)
|
|
|
32
32
|
class AnnotationBoundingBoxInfo(DataClassJsonMixin):
|
|
33
33
|
project_id: str
|
|
34
34
|
task_id: str
|
|
35
|
-
task_status: str
|
|
36
35
|
task_phase: str
|
|
37
36
|
task_phase_stage: int
|
|
37
|
+
task_status: str
|
|
38
38
|
|
|
39
39
|
input_data_id: str
|
|
40
40
|
input_data_name: str
|
|
@@ -128,9 +128,9 @@ def create_df(
|
|
|
128
128
|
base_columns = [
|
|
129
129
|
"project_id",
|
|
130
130
|
"task_id",
|
|
131
|
-
"task_status",
|
|
132
131
|
"task_phase",
|
|
133
132
|
"task_phase_stage",
|
|
133
|
+
"task_status",
|
|
134
134
|
"input_data_id",
|
|
135
135
|
"input_data_name",
|
|
136
136
|
"updated_datetime",
|
|
@@ -36,9 +36,9 @@ class AnnotationPolygonInfo(BaseModel):
|
|
|
36
36
|
|
|
37
37
|
project_id: str
|
|
38
38
|
task_id: str
|
|
39
|
-
task_status: str
|
|
40
39
|
task_phase: str
|
|
41
40
|
task_phase_stage: int
|
|
41
|
+
task_status: str
|
|
42
42
|
|
|
43
43
|
input_data_id: str
|
|
44
44
|
input_data_name: str
|
|
@@ -183,9 +183,9 @@ def create_df(
|
|
|
183
183
|
base_columns = [
|
|
184
184
|
"project_id",
|
|
185
185
|
"task_id",
|
|
186
|
-
"task_status",
|
|
187
186
|
"task_phase",
|
|
188
187
|
"task_phase_stage",
|
|
188
|
+
"task_status",
|
|
189
189
|
"input_data_id",
|
|
190
190
|
"input_data_name",
|
|
191
191
|
"updated_datetime",
|
|
@@ -35,9 +35,9 @@ class AnnotationPolylineInfo(BaseModel):
|
|
|
35
35
|
|
|
36
36
|
project_id: str
|
|
37
37
|
task_id: str
|
|
38
|
-
task_status: str
|
|
39
38
|
task_phase: str
|
|
40
39
|
task_phase_stage: int
|
|
40
|
+
task_status: str
|
|
41
41
|
|
|
42
42
|
input_data_id: str
|
|
43
43
|
input_data_name: str
|
|
@@ -191,9 +191,9 @@ def create_df(
|
|
|
191
191
|
base_columns = [
|
|
192
192
|
"project_id",
|
|
193
193
|
"task_id",
|
|
194
|
-
"task_status",
|
|
195
194
|
"task_phase",
|
|
196
195
|
"task_phase_stage",
|
|
196
|
+
"task_status",
|
|
197
197
|
"input_data_id",
|
|
198
198
|
"input_data_name",
|
|
199
199
|
"updated_datetime",
|
|
@@ -32,9 +32,9 @@ logger = logging.getLogger(__name__)
|
|
|
32
32
|
class RangeAnnotationInfo(DataClassJsonMixin):
|
|
33
33
|
project_id: str
|
|
34
34
|
task_id: str
|
|
35
|
-
task_status: str
|
|
36
35
|
task_phase: str
|
|
37
36
|
task_phase_stage: int
|
|
37
|
+
task_status: str
|
|
38
38
|
|
|
39
39
|
input_data_id: str
|
|
40
40
|
input_data_name: str
|
|
@@ -118,9 +118,9 @@ def create_df(
|
|
|
118
118
|
base_columns = [
|
|
119
119
|
"project_id",
|
|
120
120
|
"task_id",
|
|
121
|
-
"task_status",
|
|
122
121
|
"task_phase",
|
|
123
122
|
"task_phase_stage",
|
|
123
|
+
"task_status",
|
|
124
124
|
"input_data_id",
|
|
125
125
|
"input_data_name",
|
|
126
126
|
"updated_datetime",
|
|
@@ -30,9 +30,9 @@ logger = logging.getLogger(__name__)
|
|
|
30
30
|
class AnnotationSinglePointInfo(DataClassJsonMixin):
|
|
31
31
|
project_id: str
|
|
32
32
|
task_id: str
|
|
33
|
-
task_status: str
|
|
34
33
|
task_phase: str
|
|
35
34
|
task_phase_stage: int
|
|
35
|
+
task_status: str
|
|
36
36
|
|
|
37
37
|
input_data_id: str
|
|
38
38
|
input_data_name: str
|
|
@@ -108,9 +108,9 @@ def create_df(
|
|
|
108
108
|
base_columns = [
|
|
109
109
|
"project_id",
|
|
110
110
|
"task_id",
|
|
111
|
-
"task_status",
|
|
112
111
|
"task_phase",
|
|
113
112
|
"task_phase_stage",
|
|
113
|
+
"task_status",
|
|
114
114
|
"input_data_id",
|
|
115
115
|
"input_data_name",
|
|
116
116
|
"updated_datetime",
|
|
@@ -95,8 +95,8 @@ class DeleteCommentMain(CommandLineWithConfirm):
|
|
|
95
95
|
task: dict[str, Any],
|
|
96
96
|
) -> bool:
|
|
97
97
|
task_id = task["task_id"]
|
|
98
|
-
if task["status"] not in [TaskStatus.NOT_STARTED.value, TaskStatus.
|
|
99
|
-
logger.warning(f"task_id='{task_id}' :
|
|
98
|
+
if task["status"] not in [TaskStatus.NOT_STARTED.value, TaskStatus.BREAK.value]:
|
|
99
|
+
logger.warning(f"task_id='{task_id}' : タスクの状態が未着手,休憩中 以外の状態なので、コメントを削除できません。(task_status='{task['status']}')")
|
|
100
100
|
return False
|
|
101
101
|
return True
|
|
102
102
|
|