annofabcli 1.111.1__py3-none-any.whl → 1.112.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 +9 -9
- annofabcli/annotation/change_annotation_attributes_per_annotation.py +3 -4
- annofabcli/annotation/change_annotation_properties.py +13 -13
- annofabcli/annotation/copy_annotation.py +5 -5
- annofabcli/annotation/create_classification_annotation.py +6 -6
- annofabcli/annotation/delete_annotation.py +8 -8
- annofabcli/annotation/download_annotation_zip.py +1 -3
- annofabcli/annotation/dump_annotation.py +7 -7
- annofabcli/annotation/import_annotation.py +12 -12
- annofabcli/annotation/list_annotation.py +8 -8
- annofabcli/annotation/list_annotation_count.py +1 -2
- annofabcli/annotation/merge_segmentation.py +5 -5
- annofabcli/annotation/remove_segmentation_overlap.py +4 -4
- annofabcli/annotation/restore_annotation.py +6 -6
- 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 +2 -2
- 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 +11 -12
- annofabcli/annotation_zip/list_range_annotation.py +24 -14
- annofabcli/annotation_zip/list_single_point_annotation.py +11 -12
- annofabcli/annotation_zip/subcommand_annotation_zip.py +3 -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 +17 -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 +26 -26
- annofabcli/filesystem/filter_annotation.py +9 -10
- annofabcli/filesystem/mask_user_info.py +14 -14
- annofabcli/filesystem/merge_annotation.py +8 -8
- annofabcli/filesystem/subcommand_filesystem.py +1 -3
- annofabcli/input_data/copy_input_data.py +8 -9
- annofabcli/input_data/delete_input_data.py +2 -2
- 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 +8 -8
- annofabcli/input_data/list_all_input_data_merged_task.py +4 -4
- annofabcli/input_data/list_input_data.py +4 -4
- annofabcli/input_data/put_input_data.py +5 -5
- annofabcli/input_data/put_input_data_with_zip.py +2 -3
- 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 +4 -5
- annofabcli/instruction/download_instruction.py +4 -5
- annofabcli/instruction/list_instruction_history.py +2 -2
- annofabcli/instruction/subcommand_instruction.py +1 -3
- annofabcli/instruction/upload_instruction.py +2 -3
- annofabcli/job/delete_job.py +1 -2
- annofabcli/job/list_job.py +4 -4
- annofabcli/job/list_last_job.py +3 -3
- annofabcli/job/subcommand_job.py +1 -3
- annofabcli/job/wait_job.py +4 -5
- annofabcli/my_account/get_my_account.py +1 -2
- annofabcli/my_account/subcommand_my_account.py +1 -3
- annofabcli/organization/list_organization.py +1 -2
- 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 +2 -2
- annofabcli/organization_member/subcommand_organization_member.py +1 -3
- annofabcli/project/change_organization_of_project.py +3 -3
- annofabcli/project/change_project_status.py +3 -3
- annofabcli/project/copy_project.py +4 -4
- annofabcli/project/create_project.py +7 -7
- annofabcli/project/diff_projects.py +4 -5
- annofabcli/project/list_project.py +4 -4
- annofabcli/project/put_project.py +1 -2
- annofabcli/project/subcommand_project.py +1 -2
- annofabcli/project/update_configuration.py +3 -3
- annofabcli/project/update_project.py +6 -8
- annofabcli/project_member/change_project_members.py +7 -7
- annofabcli/project_member/copy_project_members.py +3 -3
- annofabcli/project_member/drop_project_members.py +1 -2
- annofabcli/project_member/invite_project_members.py +1 -3
- annofabcli/project_member/list_users.py +1 -2
- annofabcli/project_member/put_project_members.py +5 -5
- 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 +3 -3
- 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 +6 -7
- 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/visualization/visualization_source_files.py +49 -0
- annofabcli/statistics/visualize_annotation_count.py +22 -23
- annofabcli/statistics/visualize_annotation_duration.py +21 -22
- annofabcli/statistics/visualize_statistics.py +126 -69
- annofabcli/statistics/visualize_video_duration.py +18 -20
- annofabcli/supplementary/delete_supplementary_data.py +4 -4
- annofabcli/supplementary/list_supplementary_data.py +3 -3
- annofabcli/supplementary/put_supplementary_data.py +8 -8
- 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 +6 -6
- annofabcli/task/download_task_json.py +4 -6
- annofabcli/task/list_all_tasks.py +7 -7
- annofabcli/task/list_all_tasks_added_task_history.py +12 -12
- annofabcli/task/list_tasks.py +6 -6
- annofabcli/task/list_tasks_added_task_history.py +9 -9
- annofabcli/task/put_tasks.py +4 -5
- annofabcli/task/put_tasks_by_count.py +1 -2
- 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 +5 -6
- annofabcli/task_history/list_task_history.py +3 -4
- 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 +6 -6
- annofabcli/task_history_event/list_worktime.py +15 -15
- annofabcli/task_history_event/subcommand_task_history_event.py +1 -2
- {annofabcli-1.111.1.dist-info → annofabcli-1.112.0.dist-info}/METADATA +9 -15
- annofabcli-1.112.0.dist-info/RECORD +229 -0
- {annofabcli-1.111.1.dist-info → annofabcli-1.112.0.dist-info}/WHEEL +1 -1
- annofabcli-1.111.1.dist-info/RECORD +0 -228
- {annofabcli-1.111.1.dist-info → annofabcli-1.112.0.dist-info}/entry_points.txt +0 -0
- {annofabcli-1.111.1.dist-info → annofabcli-1.112.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -6,7 +6,7 @@ import logging
|
|
|
6
6
|
import sys
|
|
7
7
|
import tempfile
|
|
8
8
|
from pathlib import Path
|
|
9
|
-
from typing import Any
|
|
9
|
+
from typing import Any
|
|
10
10
|
|
|
11
11
|
import annofabapi
|
|
12
12
|
from annofabapi.models import ProjectMemberRole, TaskHistory
|
|
@@ -59,7 +59,7 @@ class ListAllTasksAddedTaskHistoryMain:
|
|
|
59
59
|
|
|
60
60
|
return task_list
|
|
61
61
|
|
|
62
|
-
def load_task_list(self, task_json_path:
|
|
62
|
+
def load_task_list(self, task_json_path: Path | None) -> list[dict[str, Any]]:
|
|
63
63
|
if task_json_path is not None:
|
|
64
64
|
with task_json_path.open(encoding="utf-8") as f:
|
|
65
65
|
return json.load(f)
|
|
@@ -72,7 +72,7 @@ class ListAllTasksAddedTaskHistoryMain:
|
|
|
72
72
|
with task_json_path.open(encoding="utf-8") as f:
|
|
73
73
|
return json.load(f)
|
|
74
74
|
|
|
75
|
-
def load_task_history_dict(self, task_history_json_path:
|
|
75
|
+
def load_task_history_dict(self, task_history_json_path: Path | None) -> TaskHistoryDict:
|
|
76
76
|
if task_history_json_path is not None:
|
|
77
77
|
with task_history_json_path.open(encoding="utf-8") as f:
|
|
78
78
|
return json.load(f)
|
|
@@ -88,8 +88,8 @@ class ListAllTasksAddedTaskHistoryMain:
|
|
|
88
88
|
@staticmethod
|
|
89
89
|
def match_task_with_conditions(
|
|
90
90
|
task: dict[str, Any],
|
|
91
|
-
task_id_set:
|
|
92
|
-
task_query:
|
|
91
|
+
task_id_set: set[str] | None = None,
|
|
92
|
+
task_query: TaskQuery | None = None,
|
|
93
93
|
) -> bool:
|
|
94
94
|
result = True
|
|
95
95
|
|
|
@@ -102,8 +102,8 @@ class ListAllTasksAddedTaskHistoryMain:
|
|
|
102
102
|
def filter_task_list(
|
|
103
103
|
self,
|
|
104
104
|
task_list: list[dict[str, Any]],
|
|
105
|
-
task_id_list:
|
|
106
|
-
task_query:
|
|
105
|
+
task_id_list: list[str] | None = None,
|
|
106
|
+
task_query: TaskQuery | None = None,
|
|
107
107
|
) -> list[dict[str, Any]]:
|
|
108
108
|
if task_query is not None:
|
|
109
109
|
task_query = self.facade.set_account_id_of_task_query(self.project_id, task_query)
|
|
@@ -115,10 +115,10 @@ class ListAllTasksAddedTaskHistoryMain:
|
|
|
115
115
|
|
|
116
116
|
def get_task_list_added_task_history( # noqa: ANN201
|
|
117
117
|
self,
|
|
118
|
-
task_json_path:
|
|
119
|
-
task_history_json_path:
|
|
120
|
-
task_id_list:
|
|
121
|
-
task_query:
|
|
118
|
+
task_json_path: Path | None,
|
|
119
|
+
task_history_json_path: Path | None,
|
|
120
|
+
task_id_list: list[str] | None,
|
|
121
|
+
task_query: TaskQuery | None,
|
|
122
122
|
):
|
|
123
123
|
"""
|
|
124
124
|
タスク履歴情報を加えたタスク一覧を取得する。
|
|
@@ -209,7 +209,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
209
209
|
parser.set_defaults(subcommand_func=main)
|
|
210
210
|
|
|
211
211
|
|
|
212
|
-
def add_parser(subparsers:
|
|
212
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
213
213
|
subcommand_name = "list_all_added_task_history"
|
|
214
214
|
subcommand_help = "タスク履歴に関する情報を加えたタスク一覧のすべてを出力します。"
|
|
215
215
|
description = "タスク履歴に関する情報(フェーズごとの作業時間、担当者、開始日時)を加えたタスク一覧のすべてを出力します。"
|
annofabcli/task/list_tasks.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
|
import pandas
|
|
@@ -79,7 +79,7 @@ class ListTasksMain:
|
|
|
79
79
|
|
|
80
80
|
return task_query
|
|
81
81
|
|
|
82
|
-
def get_task_list_with_api(self, project_id: str, task_query:
|
|
82
|
+
def get_task_list_with_api(self, project_id: str, task_query: dict[str, Any] | None = None, user_id_list: list[str] | None = None) -> list[Task]:
|
|
83
83
|
"""
|
|
84
84
|
タスク一覧を取得する。
|
|
85
85
|
|
|
@@ -118,9 +118,9 @@ class ListTasksMain:
|
|
|
118
118
|
self,
|
|
119
119
|
project_id: str,
|
|
120
120
|
*,
|
|
121
|
-
task_id_list:
|
|
122
|
-
task_query:
|
|
123
|
-
user_id_list:
|
|
121
|
+
task_id_list: list[str] | None = None,
|
|
122
|
+
task_query: dict[str, Any] | None = None,
|
|
123
|
+
user_id_list: list[str] | None = None,
|
|
124
124
|
) -> list[Task]:
|
|
125
125
|
"""
|
|
126
126
|
|
|
@@ -253,7 +253,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
253
253
|
parser.set_defaults(subcommand_func=main)
|
|
254
254
|
|
|
255
255
|
|
|
256
|
-
def add_parser(subparsers:
|
|
256
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
257
257
|
subcommand_name = "list"
|
|
258
258
|
subcommand_help = "タスク一覧を出力します。"
|
|
259
259
|
description = "タスク一覧を出力します。"
|
|
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import argparse
|
|
4
4
|
import logging
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from typing import Any
|
|
6
|
+
from typing import Any
|
|
7
7
|
|
|
8
8
|
import annofabapi
|
|
9
9
|
import more_itertools
|
|
@@ -89,7 +89,7 @@ def get_post_rejection_acceptance_worktime_hour(task_histories: list[TaskHistory
|
|
|
89
89
|
)
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
def get_completed_datetime(task: dict[str, Any], task_histories: list[TaskHistory]) ->
|
|
92
|
+
def get_completed_datetime(task: dict[str, Any], task_histories: list[TaskHistory]) -> str | None:
|
|
93
93
|
"""受入完了状態になった日時を取得する。
|
|
94
94
|
|
|
95
95
|
Args:
|
|
@@ -106,7 +106,7 @@ def get_completed_datetime(task: dict[str, Any], task_histories: list[TaskHistor
|
|
|
106
106
|
return None
|
|
107
107
|
|
|
108
108
|
|
|
109
|
-
def get_first_acceptance_completed_datetime(task_histories: list[TaskHistory]) ->
|
|
109
|
+
def get_first_acceptance_completed_datetime(task_histories: list[TaskHistory]) -> str | None:
|
|
110
110
|
"""はじめて受入完了状態になった日時を取得する。
|
|
111
111
|
|
|
112
112
|
Args:
|
|
@@ -135,7 +135,7 @@ def get_first_acceptance_completed_datetime(task_histories: list[TaskHistory]) -
|
|
|
135
135
|
return None
|
|
136
136
|
|
|
137
137
|
|
|
138
|
-
def get_first_acceptance_reached_datetime(task_histories: list[TaskHistory]) ->
|
|
138
|
+
def get_first_acceptance_reached_datetime(task_histories: list[TaskHistory]) -> str | None:
|
|
139
139
|
"""
|
|
140
140
|
はじめて受入フェーズに到達した日時を取得する。
|
|
141
141
|
受入フェーズを着手した日時とは異なる。
|
|
@@ -155,7 +155,7 @@ def get_first_acceptance_reached_datetime(task_histories: list[TaskHistory]) ->
|
|
|
155
155
|
return None
|
|
156
156
|
|
|
157
157
|
|
|
158
|
-
def get_first_inspection_reached_datetime(task_histories: list[TaskHistory]) ->
|
|
158
|
+
def get_first_inspection_reached_datetime(task_histories: list[TaskHistory]) -> str | None:
|
|
159
159
|
"""
|
|
160
160
|
はじめて検査フェーズに到達した日時を取得する。
|
|
161
161
|
検査フェーズを着手した日時とは異なる。
|
|
@@ -213,7 +213,7 @@ def calculate_total_worktime_in_phase(task_histories: list[TaskHistory], phase:
|
|
|
213
213
|
return sum(isoduration_to_hour(history["accumulated_labor_time_milliseconds"]) for history in task_histories if history["phase"] == phase.value)
|
|
214
214
|
|
|
215
215
|
|
|
216
|
-
def get_first_task_history(task_histories: list[TaskHistory], phase: TaskPhase) ->
|
|
216
|
+
def get_first_task_history(task_histories: list[TaskHistory], phase: TaskPhase) -> TaskHistory | None:
|
|
217
217
|
"""
|
|
218
218
|
指定したフェーズの最初に作業したタスク履歴を取得します。
|
|
219
219
|
取得したタスク履歴には、account_idはnot Noneで、作業時間は0より大きいです。
|
|
@@ -263,7 +263,7 @@ class AddingAdditionalInfoToTask:
|
|
|
263
263
|
self.project_id = project_id
|
|
264
264
|
self.visualize = AddProps(self.service, project_id)
|
|
265
265
|
|
|
266
|
-
def _add_task_history_info(self, task: Task, task_history:
|
|
266
|
+
def _add_task_history_info(self, task: Task, task_history: TaskHistory | None, column_prefix: str) -> Task:
|
|
267
267
|
"""
|
|
268
268
|
1個のタスク履歴情報を、タスクに設定する。
|
|
269
269
|
|
|
@@ -375,7 +375,7 @@ class ListTasksAddedTaskHistoryMain:
|
|
|
375
375
|
self.service = service
|
|
376
376
|
self.project_id = project_id
|
|
377
377
|
|
|
378
|
-
def main(self, *, task_query:
|
|
378
|
+
def main(self, *, task_query: dict[str, Any] | None, task_id_list: list[str] | None) -> list[dict[str, Any]]:
|
|
379
379
|
list_task_obj = ListTasksMain(self.service, self.project_id)
|
|
380
380
|
task_list = list_task_obj.get_task_list(self.project_id, task_id_list=task_id_list, task_query=task_query)
|
|
381
381
|
|
|
@@ -526,7 +526,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
526
526
|
parser.set_defaults(subcommand_func=main)
|
|
527
527
|
|
|
528
528
|
|
|
529
|
-
def add_parser(subparsers:
|
|
529
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
530
530
|
subcommand_name = "list_added_task_history"
|
|
531
531
|
subcommand_help = "タスク履歴に関する情報を加えたタスク一覧を出力します。"
|
|
532
532
|
description = "タスク履歴に関する情報(フェーズごとの作業時間、担当者、開始日時)を加えたタスク一覧を出力します。"
|
annofabcli/task/put_tasks.py
CHANGED
|
@@ -8,7 +8,6 @@ import tempfile
|
|
|
8
8
|
from collections import defaultdict
|
|
9
9
|
from enum import Enum
|
|
10
10
|
from pathlib import Path
|
|
11
|
-
from typing import Optional
|
|
12
11
|
|
|
13
12
|
import annofabapi
|
|
14
13
|
import pandas
|
|
@@ -54,7 +53,7 @@ def get_task_relation_dict(csv_file: Path) -> TaskInputRelation:
|
|
|
54
53
|
# `dtype=str`を指定した理由:指定しないと、IDが`001`のときに`1`に変換されてしまうため
|
|
55
54
|
df = pandas.read_csv(str(csv_file), header=None, usecols=(0, 1), names=("task_id", "input_data_id"), dtype=str)
|
|
56
55
|
result: TaskInputRelation = defaultdict(list)
|
|
57
|
-
for task_id, input_data_id in zip(df["task_id"], df["input_data_id"]):
|
|
56
|
+
for task_id, input_data_id in zip(df["task_id"], df["input_data_id"], strict=False):
|
|
58
57
|
result[task_id].append(input_data_id)
|
|
59
58
|
return result
|
|
60
59
|
|
|
@@ -88,7 +87,7 @@ class PuttingTaskMain:
|
|
|
88
87
|
service: annofabapi.Resource,
|
|
89
88
|
project_id: str,
|
|
90
89
|
*,
|
|
91
|
-
parallelism:
|
|
90
|
+
parallelism: int | None,
|
|
92
91
|
should_wait: bool = False,
|
|
93
92
|
) -> None:
|
|
94
93
|
self.service = service
|
|
@@ -156,7 +155,7 @@ class PuttingTaskMain:
|
|
|
156
155
|
|
|
157
156
|
def generate_task(
|
|
158
157
|
self,
|
|
159
|
-
api:
|
|
158
|
+
api: ApiWithCreatingTask | None,
|
|
160
159
|
task_relation_dict: TaskInputRelation,
|
|
161
160
|
) -> None:
|
|
162
161
|
"""
|
|
@@ -305,7 +304,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
305
304
|
parser.set_defaults(subcommand_func=main)
|
|
306
305
|
|
|
307
306
|
|
|
308
|
-
def add_parser(subparsers:
|
|
307
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
309
308
|
subcommand_name = "put"
|
|
310
309
|
subcommand_help = "タスクを作成します。"
|
|
311
310
|
description = "タスクを作成します。"
|
|
@@ -3,7 +3,6 @@ from __future__ import annotations
|
|
|
3
3
|
import argparse
|
|
4
4
|
import logging
|
|
5
5
|
from enum import Enum
|
|
6
|
-
from typing import Optional
|
|
7
6
|
|
|
8
7
|
import annofabapi
|
|
9
8
|
from annofabapi.models import JobStatus, ProjectJobType, ProjectMemberRole
|
|
@@ -141,7 +140,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
141
140
|
parser.set_defaults(subcommand_func=main)
|
|
142
141
|
|
|
143
142
|
|
|
144
|
-
def add_parser(subparsers:
|
|
143
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
145
144
|
subcommand_name = "put_by_count"
|
|
146
145
|
subcommand_help = "タスクに割り当てる入力データの個数を指定して、タスクを作成します。"
|
|
147
146
|
epilog = "オーナロールを持つユーザで実行してください。"
|
annofabcli/task/reject_tasks.py
CHANGED
|
@@ -6,16 +6,14 @@ import multiprocessing
|
|
|
6
6
|
import sys
|
|
7
7
|
import uuid
|
|
8
8
|
from functools import partial
|
|
9
|
-
from typing import Any
|
|
9
|
+
from typing import Any
|
|
10
10
|
|
|
11
11
|
import annofabapi
|
|
12
|
-
import annofabapi.utils
|
|
13
12
|
import requests
|
|
14
13
|
from annofabapi.dataclass.task import Task
|
|
15
14
|
from annofabapi.models import InputDataType, ProjectMemberRole, TaskPhase, TaskStatus
|
|
16
15
|
from annofabapi.plugin import EditorPluginId
|
|
17
16
|
|
|
18
|
-
import annofabcli
|
|
19
17
|
import annofabcli.common.cli
|
|
20
18
|
from annofabcli.common.cli import (
|
|
21
19
|
COMMAND_LINE_ERROR_STATUS_CODE,
|
|
@@ -32,7 +30,7 @@ logger = logging.getLogger(__name__)
|
|
|
32
30
|
|
|
33
31
|
|
|
34
32
|
class RejectTasksMain(CommandLineWithConfirm):
|
|
35
|
-
def __init__(self, service: annofabapi.Resource, *, comment_data:
|
|
33
|
+
def __init__(self, service: annofabapi.Resource, *, comment_data: dict[str, Any] | None, all_yes: bool = False) -> None:
|
|
36
34
|
self.service = service
|
|
37
35
|
self.facade = AnnofabApiFacade(service)
|
|
38
36
|
self.comment_data = comment_data
|
|
@@ -70,7 +68,7 @@ class RejectTasksMain(CommandLineWithConfirm):
|
|
|
70
68
|
|
|
71
69
|
self.service.api.batch_update_comments(project_id, task["task_id"], first_input_data_id, request_body=req_inspection)
|
|
72
70
|
|
|
73
|
-
def confirm_reject_task(self, task_id: str, assign_last_annotator: bool, assigned_annotator_user_id:
|
|
71
|
+
def confirm_reject_task(self, task_id: str, assign_last_annotator: bool, assigned_annotator_user_id: str | None) -> bool: # noqa: FBT001
|
|
74
72
|
confirm_message = f"task_id='{task_id}' のタスクを差し戻しますか?"
|
|
75
73
|
if assign_last_annotator:
|
|
76
74
|
confirm_message += "最後の教師付フェーズの担当者を割り当てます。"
|
|
@@ -114,9 +112,9 @@ class RejectTasksMain(CommandLineWithConfirm):
|
|
|
114
112
|
task: dict[str, Any],
|
|
115
113
|
*,
|
|
116
114
|
assign_last_annotator: bool,
|
|
117
|
-
assigned_annotator_user_id:
|
|
115
|
+
assigned_annotator_user_id: str | None,
|
|
118
116
|
cancel_acceptance: bool = False,
|
|
119
|
-
task_query:
|
|
117
|
+
task_query: TaskQuery | None = None,
|
|
120
118
|
) -> bool:
|
|
121
119
|
"""
|
|
122
120
|
以下の状態を見て、差し戻し可能かどうかを判断します。
|
|
@@ -151,12 +149,12 @@ class RejectTasksMain(CommandLineWithConfirm):
|
|
|
151
149
|
project_id: str,
|
|
152
150
|
task_id: str,
|
|
153
151
|
*,
|
|
154
|
-
inspection_comment:
|
|
152
|
+
inspection_comment: str | None = None,
|
|
155
153
|
assign_last_annotator: bool = True,
|
|
156
|
-
assigned_annotator_user_id:
|
|
154
|
+
assigned_annotator_user_id: str | None = None,
|
|
157
155
|
cancel_acceptance: bool = False,
|
|
158
|
-
task_query:
|
|
159
|
-
task_index:
|
|
156
|
+
task_query: TaskQuery | None = None,
|
|
157
|
+
task_index: int | None = None,
|
|
160
158
|
) -> bool:
|
|
161
159
|
"""
|
|
162
160
|
タスクを差し戻します。
|
|
@@ -235,11 +233,11 @@ class RejectTasksMain(CommandLineWithConfirm):
|
|
|
235
233
|
self,
|
|
236
234
|
tpl: tuple[int, str],
|
|
237
235
|
project_id: str,
|
|
238
|
-
inspection_comment:
|
|
236
|
+
inspection_comment: str | None = None,
|
|
239
237
|
assign_last_annotator: bool = True, # noqa: FBT001, FBT002
|
|
240
|
-
assigned_annotator_user_id:
|
|
238
|
+
assigned_annotator_user_id: str | None = None,
|
|
241
239
|
cancel_acceptance: bool = False, # noqa: FBT001, FBT002
|
|
242
|
-
task_query:
|
|
240
|
+
task_query: TaskQuery | None = None,
|
|
243
241
|
) -> bool:
|
|
244
242
|
task_index, task_id = tpl
|
|
245
243
|
try:
|
|
@@ -261,12 +259,12 @@ class RejectTasksMain(CommandLineWithConfirm):
|
|
|
261
259
|
self,
|
|
262
260
|
project_id: str,
|
|
263
261
|
task_id_list: list[str],
|
|
264
|
-
inspection_comment:
|
|
262
|
+
inspection_comment: str | None = None,
|
|
265
263
|
assign_last_annotator: bool = True, # noqa: FBT001, FBT002
|
|
266
|
-
assigned_annotator_user_id:
|
|
264
|
+
assigned_annotator_user_id: str | None = None,
|
|
267
265
|
cancel_acceptance: bool = False, # noqa: FBT001, FBT002
|
|
268
|
-
task_query:
|
|
269
|
-
parallelism:
|
|
266
|
+
task_query: TaskQuery | None = None,
|
|
267
|
+
parallelism: int | None = None,
|
|
270
268
|
) -> None:
|
|
271
269
|
if task_query is not None:
|
|
272
270
|
task_query = self.facade.set_account_id_of_task_query(project_id, task_query)
|
|
@@ -339,7 +337,7 @@ class RejectTasks(CommandLine):
|
|
|
339
337
|
super().validate_project(args.project_id, [ProjectMemberRole.OWNER])
|
|
340
338
|
|
|
341
339
|
dict_task_query = annofabcli.common.cli.get_json_from_args(args.task_query)
|
|
342
|
-
task_query:
|
|
340
|
+
task_query: TaskQuery | None = TaskQuery.from_dict(dict_task_query) if dict_task_query is not None else None
|
|
343
341
|
|
|
344
342
|
comment_data = annofabcli.common.cli.get_json_from_args(args.comment_data)
|
|
345
343
|
custom_project_type = CustomProjectType(args.custom_project_type) if args.custom_project_type is not None else None
|
|
@@ -447,7 +445,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
447
445
|
parser.set_defaults(subcommand_func=main)
|
|
448
446
|
|
|
449
447
|
|
|
450
|
-
def add_parser(subparsers:
|
|
448
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
451
449
|
subcommand_name = "reject"
|
|
452
450
|
subcommand_help = "タスクを差し戻します。"
|
|
453
451
|
description = "タスクを差し戻します。差し戻す際、検査コメントを付与することもできます。作業中状態のタスクに対しては差し戻せません。"
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import argparse
|
|
2
|
-
from typing import Optional
|
|
3
2
|
|
|
4
|
-
import annofabcli
|
|
5
3
|
import annofabcli.common.cli
|
|
6
4
|
import annofabcli.task.cancel_acceptance
|
|
7
5
|
import annofabcli.task.change_operator
|
|
@@ -45,7 +43,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
45
43
|
annofabcli.task.update_metadata_of_task.add_parser(subparsers)
|
|
46
44
|
|
|
47
45
|
|
|
48
|
-
def add_parser(subparsers:
|
|
46
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
49
47
|
subcommand_name = "task"
|
|
50
48
|
subcommand_help = "タスク関係のサブコマンド"
|
|
51
49
|
description = "タスク関係のサブコマンド"
|
|
@@ -8,12 +8,11 @@ import multiprocessing
|
|
|
8
8
|
import sys
|
|
9
9
|
from dataclasses import dataclass
|
|
10
10
|
from functools import partial
|
|
11
|
-
from typing import Any
|
|
11
|
+
from typing import Any
|
|
12
12
|
|
|
13
13
|
import annofabapi
|
|
14
14
|
from annofabapi.models import ProjectMemberRole
|
|
15
15
|
|
|
16
|
-
import annofabcli
|
|
17
16
|
import annofabcli.common.cli
|
|
18
17
|
from annofabcli.common.cli import (
|
|
19
18
|
COMMAND_LINE_ERROR_STATUS_CODE,
|
|
@@ -27,7 +26,7 @@ from annofabcli.common.facade import AnnofabApiFacade
|
|
|
27
26
|
|
|
28
27
|
logger = logging.getLogger(__name__)
|
|
29
28
|
|
|
30
|
-
Metadata = dict[str,
|
|
29
|
+
Metadata = dict[str, str | bool | int]
|
|
31
30
|
|
|
32
31
|
|
|
33
32
|
@dataclass(frozen=True)
|
|
@@ -42,7 +41,7 @@ class UpdateMetadataOfTaskMain(CommandLineWithConfirm):
|
|
|
42
41
|
service: annofabapi.Resource,
|
|
43
42
|
*,
|
|
44
43
|
is_overwrite_metadata: bool,
|
|
45
|
-
parallelism:
|
|
44
|
+
parallelism: int | None = None,
|
|
46
45
|
all_yes: bool = False,
|
|
47
46
|
) -> None:
|
|
48
47
|
self.service = service
|
|
@@ -61,7 +60,7 @@ class UpdateMetadataOfTaskMain(CommandLineWithConfirm):
|
|
|
61
60
|
project_id: str,
|
|
62
61
|
task_id: str,
|
|
63
62
|
metadata: dict[str, Any],
|
|
64
|
-
task_index:
|
|
63
|
+
task_index: int | None = None,
|
|
65
64
|
) -> bool:
|
|
66
65
|
logging_prefix = f"{task_index + 1} 件目" if task_index is not None else ""
|
|
67
66
|
task = self.service.wrapper.get_task_or_none(project_id, task_id)
|
|
@@ -272,7 +271,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
272
271
|
parser.set_defaults(subcommand_func=main)
|
|
273
272
|
|
|
274
273
|
|
|
275
|
-
def add_parser(subparsers:
|
|
274
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
276
275
|
subcommand_name = "update_metadata"
|
|
277
276
|
subcommand_help = "タスクのメタデータを更新します。"
|
|
278
277
|
description = "タスクのメタデータを上書きして更新します。"
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
import logging
|
|
3
3
|
from pathlib import Path
|
|
4
|
-
from typing import Optional
|
|
5
4
|
|
|
6
5
|
from annofabapi.models import ProjectMemberRole
|
|
7
6
|
|
|
8
|
-
import annofabcli
|
|
9
7
|
import annofabcli.common.cli
|
|
10
8
|
from annofabcli.common.cli import CommandLine, build_annofabapi_resource_and_login
|
|
11
9
|
from annofabcli.common.download import DownloadingFile
|
|
@@ -15,17 +13,17 @@ logger = logging.getLogger(__name__)
|
|
|
15
13
|
|
|
16
14
|
|
|
17
15
|
class DownloadingTaskHistory(CommandLine):
|
|
18
|
-
def download_task_history_json(self, project_id: str, output_file: Path)
|
|
16
|
+
def download_task_history_json(self, project_id: str, output_file: Path) -> None:
|
|
19
17
|
super().validate_project(project_id, [ProjectMemberRole.OWNER, ProjectMemberRole.TRAINING_DATA_USER])
|
|
20
18
|
project_title = self.facade.get_project_title(project_id)
|
|
21
|
-
logger.info(f"{project_title}
|
|
19
|
+
logger.info(f"project_id='{project_id}'のタスク履歴全件ファイルをダウンロードします。 :: project_title='{project_title}'")
|
|
22
20
|
|
|
23
21
|
obj = DownloadingFile(self.service)
|
|
24
22
|
obj.download_task_history_json(
|
|
25
23
|
project_id,
|
|
26
24
|
str(output_file),
|
|
27
25
|
)
|
|
28
|
-
logger.info(f"
|
|
26
|
+
logger.info(f"project_id='{project_id}'のタスク履歴全件ファイルをダウンロードしました。 :: output='{output_file}', project_title='{project_title}'")
|
|
29
27
|
|
|
30
28
|
def main(self) -> None:
|
|
31
29
|
args = self.args
|
|
@@ -50,7 +48,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
50
48
|
parser.set_defaults(subcommand_func=main)
|
|
51
49
|
|
|
52
50
|
|
|
53
|
-
def add_parser(subparsers:
|
|
51
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
54
52
|
subcommand_name = "download"
|
|
55
53
|
subcommand_help = "タスク履歴全件ファイルをダウンロードします。"
|
|
56
54
|
epilog = "オーナロールまたはアノテーションユーザロールを持つユーザで実行してください。"
|
|
@@ -3,7 +3,6 @@ import json
|
|
|
3
3
|
import logging
|
|
4
4
|
import tempfile
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from typing import Optional
|
|
7
6
|
|
|
8
7
|
import annofabapi
|
|
9
8
|
from annofabapi.models import TaskHistory
|
|
@@ -27,7 +26,7 @@ class ListTaskHistoryWithJsonMain:
|
|
|
27
26
|
self.facade = AnnofabApiFacade(service)
|
|
28
27
|
|
|
29
28
|
@staticmethod
|
|
30
|
-
def filter_task_history_dict(task_history_dict: TaskHistoryDict, task_id_list:
|
|
29
|
+
def filter_task_history_dict(task_history_dict: TaskHistoryDict, task_id_list: list[str] | None = None) -> TaskHistoryDict:
|
|
31
30
|
if task_id_list is None:
|
|
32
31
|
return task_history_dict
|
|
33
32
|
|
|
@@ -40,7 +39,7 @@ class ListTaskHistoryWithJsonMain:
|
|
|
40
39
|
filtered_task_history_dict[task_id] = task_history_list
|
|
41
40
|
return filtered_task_history_dict
|
|
42
41
|
|
|
43
|
-
def get_task_history_dict(self, project_id: str, task_history_json:
|
|
42
|
+
def get_task_history_dict(self, project_id: str, task_history_json: Path | None = None, task_id_list: list[str] | None = None) -> TaskHistoryDict:
|
|
44
43
|
"""出力対象のタスク履歴情報を取得する"""
|
|
45
44
|
if task_history_json is None:
|
|
46
45
|
downloading_obj = DownloadingFile(self.service)
|
|
@@ -78,8 +77,8 @@ class ListTaskHistoryWithJson(CommandLine):
|
|
|
78
77
|
def print_task_history_list( # noqa: ANN201
|
|
79
78
|
self,
|
|
80
79
|
project_id: str,
|
|
81
|
-
task_history_json:
|
|
82
|
-
task_id_list:
|
|
80
|
+
task_history_json: Path | None,
|
|
81
|
+
task_id_list: list[str] | None,
|
|
83
82
|
arg_format: FormatArgument,
|
|
84
83
|
):
|
|
85
84
|
"""
|
|
@@ -151,7 +150,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
151
150
|
parser.set_defaults(subcommand_func=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 = "list_all"
|
|
156
155
|
subcommand_help = "すべてのタスク履歴の一覧を出力します。"
|
|
157
156
|
description = (
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
import logging
|
|
3
|
-
from typing import Optional
|
|
4
3
|
|
|
5
4
|
import annofabapi
|
|
6
5
|
from annofabapi.models import TaskHistory
|
|
@@ -53,7 +52,7 @@ class ListTaskHistoryMain:
|
|
|
53
52
|
all_task_list = self.service.wrapper.get_all_tasks(project_id)
|
|
54
53
|
return [e["task_id"] for e in all_task_list]
|
|
55
54
|
|
|
56
|
-
def get_task_history_dict_for_output(self, project_id: str, task_id_list:
|
|
55
|
+
def get_task_history_dict_for_output(self, project_id: str, task_id_list: list[str] | None = None) -> TaskHistoryDict:
|
|
57
56
|
"""出力対象のタスク履歴情報を取得する"""
|
|
58
57
|
if task_id_list is None:
|
|
59
58
|
task_id_list = self.get_all_task_id_list(project_id)
|
|
@@ -78,7 +77,7 @@ class ListTaskHistory(CommandLine):
|
|
|
78
77
|
def print_task_history_list(
|
|
79
78
|
self,
|
|
80
79
|
project_id: str,
|
|
81
|
-
task_id_list:
|
|
80
|
+
task_id_list: list[str] | None,
|
|
82
81
|
arg_format: FormatArgument,
|
|
83
82
|
) -> None:
|
|
84
83
|
"""
|
|
@@ -143,7 +142,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
143
142
|
parser.set_defaults(subcommand_func=main)
|
|
144
143
|
|
|
145
144
|
|
|
146
|
-
def add_parser(subparsers:
|
|
145
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
147
146
|
subcommand_name = "list"
|
|
148
147
|
subcommand_help = "タスク履歴の一覧を出力します。"
|
|
149
148
|
description = "タスク履歴の一覧を出力します。"
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import argparse
|
|
2
|
-
from typing import Optional
|
|
3
2
|
|
|
4
|
-
import annofabcli
|
|
5
3
|
import annofabcli.common.cli
|
|
6
4
|
import annofabcli.task_history.download_task_history_json
|
|
7
5
|
import annofabcli.task_history.list_all_task_history
|
|
@@ -17,7 +15,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
17
15
|
annofabcli.task_history.list_all_task_history.add_parser(subparsers)
|
|
18
16
|
|
|
19
17
|
|
|
20
|
-
def add_parser(subparsers:
|
|
18
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
21
19
|
subcommand_name = "task_history"
|
|
22
20
|
subcommand_help = "タスク履歴関係のサブコマンド"
|
|
23
21
|
description = "タスク履歴関係のサブコマンド"
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
import logging
|
|
3
3
|
from pathlib import Path
|
|
4
|
-
from typing import Optional
|
|
5
4
|
|
|
6
5
|
from annofabapi.models import ProjectMemberRole
|
|
7
6
|
|
|
8
|
-
import annofabcli
|
|
9
7
|
import annofabcli.common.cli
|
|
10
8
|
from annofabcli.common.cli import CommandLine, build_annofabapi_resource_and_login
|
|
11
9
|
from annofabcli.common.download import DownloadingFile
|
|
@@ -15,17 +13,17 @@ logger = logging.getLogger(__name__)
|
|
|
15
13
|
|
|
16
14
|
|
|
17
15
|
class DownloadingTaskHistoryEvent(CommandLine):
|
|
18
|
-
def download_task_history_event_json(self, project_id: str, output_file: Path)
|
|
16
|
+
def download_task_history_event_json(self, project_id: str, output_file: Path) -> None:
|
|
19
17
|
super().validate_project(project_id, [ProjectMemberRole.OWNER, ProjectMemberRole.TRAINING_DATA_USER])
|
|
20
18
|
project_title = self.facade.get_project_title(project_id)
|
|
21
|
-
logger.info(f"{project_title}
|
|
19
|
+
logger.info(f"project_id='{project_id}'のタスク履歴イベント全件ファイルをダウンロードします。 :: project_title='{project_title}'")
|
|
22
20
|
|
|
23
21
|
obj = DownloadingFile(self.service)
|
|
24
22
|
obj.download_task_history_event_json(
|
|
25
23
|
project_id,
|
|
26
24
|
str(output_file),
|
|
27
25
|
)
|
|
28
|
-
logger.info(f"
|
|
26
|
+
logger.info(f"project_id='{project_id}'のタスク履歴イベント全件ファイルをダウンロードしました。 :: output='{output_file}', project_title='{project_title}'")
|
|
29
27
|
|
|
30
28
|
def main(self) -> None:
|
|
31
29
|
args = self.args
|
|
@@ -50,7 +48,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
50
48
|
parser.set_defaults(subcommand_func=main)
|
|
51
49
|
|
|
52
50
|
|
|
53
|
-
def add_parser(subparsers:
|
|
51
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
54
52
|
subcommand_name = "download"
|
|
55
53
|
subcommand_help = "タスク履歴イベント全件ファイルをダウンロードします。"
|
|
56
54
|
epilog = "オーナロールまたはアノテーションユーザロールを持つユーザで実行してください。"
|
|
@@ -5,7 +5,7 @@ import json
|
|
|
5
5
|
import logging
|
|
6
6
|
import tempfile
|
|
7
7
|
from pathlib import Path
|
|
8
|
-
from typing import Any
|
|
8
|
+
from typing import Any
|
|
9
9
|
|
|
10
10
|
import annofabapi
|
|
11
11
|
import pandas
|
|
@@ -31,7 +31,7 @@ class ListTaskHistoryEventWithJsonMain:
|
|
|
31
31
|
self.service = service
|
|
32
32
|
|
|
33
33
|
@staticmethod
|
|
34
|
-
def filter_task_history_event(task_history_event_list: list[TaskHistoryEvent], task_id_list:
|
|
34
|
+
def filter_task_history_event(task_history_event_list: list[TaskHistoryEvent], task_id_list: list[str] | None = None) -> list[TaskHistoryEvent]:
|
|
35
35
|
if task_id_list is not None:
|
|
36
36
|
result = []
|
|
37
37
|
task_id_set = set(task_id_list)
|
|
@@ -43,7 +43,7 @@ class ListTaskHistoryEventWithJsonMain:
|
|
|
43
43
|
|
|
44
44
|
return task_history_event_list
|
|
45
45
|
|
|
46
|
-
def get_task_history_event_list(self, project_id: str, task_history_event_json:
|
|
46
|
+
def get_task_history_event_list(self, project_id: str, task_history_event_json: Path | None = None, task_id_list: list[str] | None = None) -> list[dict[str, Any]]:
|
|
47
47
|
if task_history_event_json is None:
|
|
48
48
|
downloading_obj = DownloadingFile(self.service)
|
|
49
49
|
# `NamedTemporaryFile`を使わない理由: Windowsで`PermissionError`が発生するため
|
|
@@ -72,8 +72,8 @@ class ListTaskHistoryEventWithJson(CommandLine):
|
|
|
72
72
|
def print_task_history_event_list(
|
|
73
73
|
self,
|
|
74
74
|
project_id: str,
|
|
75
|
-
task_history_event_json:
|
|
76
|
-
task_id_list:
|
|
75
|
+
task_history_event_json: Path | None,
|
|
76
|
+
task_id_list: list[str] | None,
|
|
77
77
|
arg_format: FormatArgument,
|
|
78
78
|
) -> None:
|
|
79
79
|
super().validate_project(project_id, project_member_roles=None)
|
|
@@ -165,7 +165,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
165
165
|
parser.set_defaults(subcommand_func=main)
|
|
166
166
|
|
|
167
167
|
|
|
168
|
-
def add_parser(subparsers:
|
|
168
|
+
def add_parser(subparsers: argparse._SubParsersAction | None = None) -> argparse.ArgumentParser:
|
|
169
169
|
subcommand_name = "list_all"
|
|
170
170
|
subcommand_help = "すべてのタスク履歴イベントの一覧を出力します。"
|
|
171
171
|
description = "すべてのタスク履歴イベントの一覧を出力します。\n出力されるタスク履歴イベントは、コマンドを実行した日の02:00(JST)頃の状態です。最新の情報を出力する方法はありません。"
|