annofabcli 1.114.3__py3-none-any.whl → 1.114.4__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/list_annotation.py +4 -4
- annofabcli/annotation/list_annotation_count.py +4 -4
- annofabcli/annotation_specs/export_annotation_specs.py +4 -4
- annofabcli/annotation_specs/get_annotation_specs_with_attribute_id_replaced.py +4 -4
- annofabcli/annotation_specs/get_annotation_specs_with_choice_id_replaced.py +4 -4
- annofabcli/annotation_specs/get_annotation_specs_with_label_id_replaced.py +4 -4
- annofabcli/annotation_specs/list_annotation_specs_attribute.py +7 -7
- annofabcli/annotation_specs/list_annotation_specs_choice.py +9 -9
- annofabcli/annotation_specs/list_annotation_specs_history.py +2 -2
- annofabcli/annotation_specs/list_annotation_specs_label.py +8 -8
- annofabcli/annotation_specs/list_annotation_specs_label_attribute.py +7 -7
- annofabcli/annotation_specs/list_label_color.py +2 -2
- annofabcli/annotation_zip/list_annotation_3d_bounding_box.py +8 -8
- annofabcli/annotation_zip/list_annotation_bounding_box_2d.py +8 -8
- annofabcli/annotation_zip/list_polygon_annotation.py +8 -8
- annofabcli/annotation_zip/list_polyline_annotation.py +8 -8
- annofabcli/annotation_zip/list_range_annotation.py +8 -8
- annofabcli/annotation_zip/list_single_point_annotation.py +8 -8
- annofabcli/annotation_zip/validate_annotation.py +2 -2
- annofabcli/comment/list_all_comment.py +8 -8
- annofabcli/comment/list_comment.py +8 -8
- annofabcli/common/cli.py +3 -3
- annofabcli/common/enums.py +1 -1
- annofabcli/common/pandas.py +4 -3
- annofabcli/common/utils.py +10 -10
- annofabcli/common/visualize.py +3 -3
- annofabcli/filesystem/mask_user_info.py +3 -2
- annofabcli/input_data/list_all_input_data.py +11 -22
- annofabcli/input_data/list_all_input_data_merged_task.py +7 -7
- annofabcli/input_data/list_input_data.py +67 -18
- annofabcli/instruction/list_instruction_history.py +2 -2
- annofabcli/job/list_job.py +2 -2
- annofabcli/job/list_last_job.py +2 -2
- annofabcli/my_account/get_my_account.py +4 -4
- annofabcli/organization/list_organization.py +5 -5
- annofabcli/organization_member/list_organization_member.py +4 -4
- annofabcli/project/list_project.py +9 -9
- annofabcli/project_member/list_users.py +4 -4
- annofabcli/statistics/list_annotation_area.py +8 -8
- annofabcli/statistics/list_annotation_attribute.py +8 -8
- annofabcli/statistics/list_annotation_attribute_filled_count.py +11 -11
- annofabcli/statistics/list_annotation_count.py +8 -8
- annofabcli/statistics/list_annotation_duration.py +8 -8
- annofabcli/statistics/list_video_duration.py +6 -6
- annofabcli/statistics/summarize_task_count_by_task_id_group.py +2 -2
- annofabcli/statistics/summarize_task_count_by_user.py +2 -2
- annofabcli/statistics/visualization/dataframe/project_performance.py +2 -1
- annofabcli/statistics/visualization/dataframe/task.py +25 -6
- annofabcli/supplementary/list_supplementary_data.py +2 -2
- annofabcli/task/list_all_tasks.py +8 -18
- annofabcli/task/list_all_tasks_added_task_history.py +6 -6
- annofabcli/task/list_tasks.py +73 -37
- annofabcli/task/list_tasks_added_task_history.py +25 -16
- annofabcli/task_history/list_all_task_history.py +6 -6
- annofabcli/task_history/list_task_history.py +6 -6
- annofabcli/task_history_event/list_all_task_history_event.py +6 -6
- annofabcli/task_history_event/list_worktime.py +6 -6
- {annofabcli-1.114.3.dist-info → annofabcli-1.114.4.dist-info}/METADATA +2 -2
- {annofabcli-1.114.3.dist-info → annofabcli-1.114.4.dist-info}/RECORD +62 -62
- {annofabcli-1.114.3.dist-info → annofabcli-1.114.4.dist-info}/WHEEL +0 -0
- {annofabcli-1.114.3.dist-info → annofabcli-1.114.4.dist-info}/entry_points.txt +0 -0
- {annofabcli-1.114.3.dist-info → annofabcli-1.114.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -21,7 +21,7 @@ from annofabcli.common.cli import (
|
|
|
21
21
|
)
|
|
22
22
|
from annofabcli.common.dataclasses import WaitOptions
|
|
23
23
|
from annofabcli.common.download import DownloadingFile
|
|
24
|
-
from annofabcli.common.enums import
|
|
24
|
+
from annofabcli.common.enums import OutputFormat
|
|
25
25
|
from annofabcli.common.facade import AnnofabApiFacade, TaskQuery, match_task_with_query
|
|
26
26
|
from annofabcli.task.list_tasks_added_task_history import AddingAdditionalInfoToTask, TasksAddedTaskHistoryOutput
|
|
27
27
|
|
|
@@ -118,14 +118,14 @@ class ListAllTasksAddedTaskHistoryMain:
|
|
|
118
118
|
filtered_task_list = [e for e in task_list if self.match_task_with_conditions(e, task_query=task_query, task_id_set=task_id_set)]
|
|
119
119
|
return filtered_task_list
|
|
120
120
|
|
|
121
|
-
def get_task_list_added_task_history(
|
|
121
|
+
def get_task_list_added_task_history(
|
|
122
122
|
self,
|
|
123
123
|
task_json_path: Path | None,
|
|
124
124
|
task_history_json_path: Path | None,
|
|
125
125
|
task_id_list: list[str] | None,
|
|
126
126
|
task_query: TaskQuery | None,
|
|
127
127
|
temp_dir: Path | None,
|
|
128
|
-
):
|
|
128
|
+
) -> list[dict[str, Any]]:
|
|
129
129
|
"""
|
|
130
130
|
タスク履歴情報を加えたタスク一覧を取得する。
|
|
131
131
|
"""
|
|
@@ -178,7 +178,7 @@ class ListAllTasksAddedTaskHistory(CommandLine):
|
|
|
178
178
|
)
|
|
179
179
|
|
|
180
180
|
logger.info(f"タスク一覧の件数: {len(task_list)}")
|
|
181
|
-
TasksAddedTaskHistoryOutput(task_list).output(output_path=args.output, output_format=
|
|
181
|
+
TasksAddedTaskHistoryOutput(task_list).output(output_path=args.output, output_format=OutputFormat(args.format))
|
|
182
182
|
|
|
183
183
|
|
|
184
184
|
def main(args: argparse.Namespace) -> None:
|
|
@@ -216,8 +216,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
216
216
|
argument_parser.add_output()
|
|
217
217
|
|
|
218
218
|
argument_parser.add_format(
|
|
219
|
-
choices=[
|
|
220
|
-
default=
|
|
219
|
+
choices=[OutputFormat.CSV, OutputFormat.JSON, OutputFormat.PRETTY_JSON],
|
|
220
|
+
default=OutputFormat.CSV,
|
|
221
221
|
)
|
|
222
222
|
|
|
223
223
|
parser.set_defaults(subcommand_func=main)
|
annofabcli/task/list_tasks.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
import logging
|
|
3
|
+
from pathlib import Path
|
|
3
4
|
from typing import Any
|
|
4
5
|
|
|
5
6
|
import annofabapi
|
|
@@ -8,14 +9,77 @@ from annofabapi.models import Task
|
|
|
8
9
|
|
|
9
10
|
import annofabcli.common.cli
|
|
10
11
|
from annofabcli.common.cli import ArgumentParser, CommandLine, build_annofabapi_resource_and_login
|
|
11
|
-
from annofabcli.common.enums import
|
|
12
|
+
from annofabcli.common.enums import OutputFormat
|
|
12
13
|
from annofabcli.common.facade import AnnofabApiFacade
|
|
13
|
-
from annofabcli.common.utils import get_columns_with_priority
|
|
14
|
+
from annofabcli.common.utils import get_columns_with_priority, print_csv, print_id_list, print_json
|
|
14
15
|
from annofabcli.common.visualize import AddProps
|
|
15
16
|
|
|
16
17
|
logger = logging.getLogger(__name__)
|
|
17
18
|
|
|
18
19
|
|
|
20
|
+
def print_task_list(
|
|
21
|
+
task_list: list[dict[str, Any]],
|
|
22
|
+
output_format: OutputFormat,
|
|
23
|
+
output_file: Path | None,
|
|
24
|
+
) -> None:
|
|
25
|
+
"""
|
|
26
|
+
タスク一覧を指定されたフォーマットで出力する。
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
task_list: タスク一覧
|
|
30
|
+
output_format: 出力フォーマット
|
|
31
|
+
output_file: 出力先
|
|
32
|
+
"""
|
|
33
|
+
task_prior_columns = [
|
|
34
|
+
"project_id",
|
|
35
|
+
"task_id",
|
|
36
|
+
"phase",
|
|
37
|
+
"phase_stage",
|
|
38
|
+
"status",
|
|
39
|
+
"started_datetime",
|
|
40
|
+
"updated_datetime",
|
|
41
|
+
"operation_updated_datetime",
|
|
42
|
+
"account_id",
|
|
43
|
+
"user_id",
|
|
44
|
+
"username",
|
|
45
|
+
"worktime_hour",
|
|
46
|
+
"number_of_rejections_by_inspection",
|
|
47
|
+
"number_of_rejections_by_acceptance",
|
|
48
|
+
"sampling",
|
|
49
|
+
"input_data_count",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
if output_format == OutputFormat.CSV:
|
|
53
|
+
if len(task_list) > 0:
|
|
54
|
+
# json_normalizeでメタデータを自動展開
|
|
55
|
+
df = pandas.json_normalize(task_list)
|
|
56
|
+
|
|
57
|
+
# metadata.*列を検出して優先列リストに追加
|
|
58
|
+
metadata_columns = sorted([col for col in df.columns if col.startswith("metadata.")])
|
|
59
|
+
prior_columns_with_metadata = task_prior_columns + metadata_columns
|
|
60
|
+
columns = get_columns_with_priority(df, prior_columns=prior_columns_with_metadata)
|
|
61
|
+
# work_time_span列を除外(worktime_hourと重複するため)
|
|
62
|
+
# histories_by_phase列を除外(list型のためCSVでは扱いにくいため)
|
|
63
|
+
# input_data_id_list列を除外(list型のためCSVでは扱いにくいため。input_data_countで件数は把握できる)
|
|
64
|
+
columns = [col for col in columns if col not in ["work_time_span", "histories_by_phase", "input_data_id_list"]]
|
|
65
|
+
print_csv(df[columns], output=output_file)
|
|
66
|
+
else:
|
|
67
|
+
df = pandas.DataFrame(columns=task_prior_columns)
|
|
68
|
+
print_csv(df, output=output_file)
|
|
69
|
+
|
|
70
|
+
elif output_format == OutputFormat.PRETTY_JSON:
|
|
71
|
+
print_json(task_list, is_pretty=True, output=output_file)
|
|
72
|
+
|
|
73
|
+
elif output_format == OutputFormat.JSON:
|
|
74
|
+
print_json(task_list, is_pretty=False, output=output_file)
|
|
75
|
+
|
|
76
|
+
elif output_format == OutputFormat.TASK_ID_LIST:
|
|
77
|
+
task_id_list = [e["task_id"] for e in task_list]
|
|
78
|
+
print_id_list(task_id_list, output=output_file)
|
|
79
|
+
else:
|
|
80
|
+
raise ValueError(f"{output_format}は対応していないフォーマットです。")
|
|
81
|
+
|
|
82
|
+
|
|
19
83
|
class ListTasksMain:
|
|
20
84
|
def __init__(self, service: annofabapi.Resource, project_id: str) -> None:
|
|
21
85
|
self.service = service
|
|
@@ -53,7 +117,7 @@ class ListTasksMain:
|
|
|
53
117
|
|
|
54
118
|
"""
|
|
55
119
|
|
|
56
|
-
def remove_key(arg_key: str)
|
|
120
|
+
def remove_key(arg_key: str) -> None:
|
|
57
121
|
if arg_key in task_query:
|
|
58
122
|
logger.info(f"タスク検索クエリから、`{arg_key}` キーを削除しました。")
|
|
59
123
|
task_query.pop(arg_key)
|
|
@@ -96,7 +160,6 @@ class ListTasksMain:
|
|
|
96
160
|
task_query = {}
|
|
97
161
|
|
|
98
162
|
if user_id_list is None:
|
|
99
|
-
logger.debug(f"task_query: {task_query}")
|
|
100
163
|
tasks = self.service.wrapper.get_all_tasks(project_id, query_params=task_query)
|
|
101
164
|
if len(tasks) == 10000:
|
|
102
165
|
logger.warning("タスク一覧は10,000件で打ち切られている可能性があります。")
|
|
@@ -151,27 +214,6 @@ class ListTasks(CommandLine):
|
|
|
151
214
|
super().__init__(service, facade, args)
|
|
152
215
|
self.visualize = AddProps(self.service, args.project_id)
|
|
153
216
|
|
|
154
|
-
PRIOR_COLUMNS = [ # noqa: RUF012
|
|
155
|
-
"project_id",
|
|
156
|
-
"task_id",
|
|
157
|
-
"phase",
|
|
158
|
-
"phase_stage",
|
|
159
|
-
"status",
|
|
160
|
-
"started_datetime",
|
|
161
|
-
"updated_datetime",
|
|
162
|
-
"operation_updated_datetime",
|
|
163
|
-
"account_id",
|
|
164
|
-
"user_id",
|
|
165
|
-
"username",
|
|
166
|
-
"worktime_hour",
|
|
167
|
-
"number_of_rejections_by_inspection",
|
|
168
|
-
"number_of_rejections_by_acceptance",
|
|
169
|
-
"metadata",
|
|
170
|
-
"sampling",
|
|
171
|
-
"input_data_count",
|
|
172
|
-
"input_data_id_list",
|
|
173
|
-
]
|
|
174
|
-
|
|
175
217
|
def main(self) -> None:
|
|
176
218
|
args = self.args
|
|
177
219
|
|
|
@@ -190,17 +232,11 @@ class ListTasks(CommandLine):
|
|
|
190
232
|
user_id_list=user_id_list,
|
|
191
233
|
)
|
|
192
234
|
|
|
193
|
-
logger.
|
|
235
|
+
logger.info(f"{len(task_list)}件のタスク情報を出力します。")
|
|
194
236
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
columns = get_columns_with_priority(df, prior_columns=self.PRIOR_COLUMNS)
|
|
199
|
-
self.print_csv(df[columns])
|
|
200
|
-
else:
|
|
201
|
-
self.print_according_to_format(task_list)
|
|
202
|
-
else:
|
|
203
|
-
logger.info("タスク一覧の件数が0件のため、出力しません。")
|
|
237
|
+
output_file = args.output
|
|
238
|
+
output_format = OutputFormat(args.format)
|
|
239
|
+
print_task_list(task_list, output_format, output_file)
|
|
204
240
|
|
|
205
241
|
|
|
206
242
|
def main(args: argparse.Namespace) -> None:
|
|
@@ -245,8 +281,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
245
281
|
)
|
|
246
282
|
|
|
247
283
|
argument_parser.add_format(
|
|
248
|
-
choices=[
|
|
249
|
-
default=
|
|
284
|
+
choices=[OutputFormat.CSV, OutputFormat.JSON, OutputFormat.PRETTY_JSON, OutputFormat.TASK_ID_LIST],
|
|
285
|
+
default=OutputFormat.CSV,
|
|
250
286
|
)
|
|
251
287
|
argument_parser.add_output()
|
|
252
288
|
|
|
@@ -14,7 +14,7 @@ from annofabapi.utils import get_task_history_index_skipped_acceptance, get_task
|
|
|
14
14
|
|
|
15
15
|
import annofabcli.common.cli
|
|
16
16
|
from annofabcli.common.cli import ArgumentParser, CommandLine, build_annofabapi_resource_and_login
|
|
17
|
-
from annofabcli.common.enums import
|
|
17
|
+
from annofabcli.common.enums import OutputFormat
|
|
18
18
|
from annofabcli.common.facade import AnnofabApiFacade
|
|
19
19
|
from annofabcli.common.utils import isoduration_to_hour, print_csv, print_json
|
|
20
20
|
from annofabcli.common.visualize import AddProps
|
|
@@ -384,7 +384,7 @@ class ListTasksAddedTaskHistoryMain:
|
|
|
384
384
|
|
|
385
385
|
for index, task in enumerate(task_list):
|
|
386
386
|
if (index + 1) % 100 == 0:
|
|
387
|
-
logger.
|
|
387
|
+
logger.info(f"{index + 1} 件目のタスク履歴情報を取得します。")
|
|
388
388
|
|
|
389
389
|
obj.add_additional_info_to_task(task)
|
|
390
390
|
task_id = task["task_id"]
|
|
@@ -422,7 +422,6 @@ class TasksAddedTaskHistoryOutput:
|
|
|
422
422
|
"user_id",
|
|
423
423
|
"username",
|
|
424
424
|
"input_data_count",
|
|
425
|
-
"metadata",
|
|
426
425
|
"sampling",
|
|
427
426
|
# 作業時間情報
|
|
428
427
|
"worktime_hour",
|
|
@@ -454,20 +453,30 @@ class TasksAddedTaskHistoryOutput:
|
|
|
454
453
|
]
|
|
455
454
|
)
|
|
456
455
|
|
|
457
|
-
def output(self, output_path: Path, output_format:
|
|
456
|
+
def output(self, output_path: Path, output_format: OutputFormat) -> None:
|
|
458
457
|
task_list = self.task_list
|
|
459
458
|
logger.debug(f"タスク {len(task_list)} 件の情報を出力します。")
|
|
460
|
-
if output_format ==
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
459
|
+
if output_format == OutputFormat.CSV:
|
|
460
|
+
if len(task_list) > 0:
|
|
461
|
+
# json_normalizeでメタデータを自動展開
|
|
462
|
+
df = pandas.json_normalize(task_list)
|
|
463
|
+
|
|
464
|
+
# metadata.*列を検出して出力対象列リストに追加
|
|
465
|
+
metadata_columns = sorted([col for col in df.columns if col.startswith("metadata.")])
|
|
466
|
+
output_columns = self._get_output_target_columns() + metadata_columns
|
|
467
|
+
# 出力列を output_columns に含まれる列のみに限定(意図しない列の混入を防ぐ)
|
|
468
|
+
columns = [col for col in output_columns if col in df.columns]
|
|
469
|
+
print_csv(df[columns], output=output_path)
|
|
470
|
+
else:
|
|
471
|
+
df = pandas.DataFrame(columns=self._get_output_target_columns())
|
|
472
|
+
print_csv(df, output=output_path)
|
|
473
|
+
|
|
474
|
+
elif output_format == OutputFormat.JSON:
|
|
468
475
|
print_json(task_list, is_pretty=False, output=output_path)
|
|
469
|
-
elif output_format ==
|
|
476
|
+
elif output_format == OutputFormat.PRETTY_JSON:
|
|
470
477
|
print_json(task_list, is_pretty=True, output=output_path)
|
|
478
|
+
else:
|
|
479
|
+
raise ValueError(f"{output_format=}は不正な値です。")
|
|
471
480
|
|
|
472
481
|
|
|
473
482
|
class ListTasksAddedTaskHistory(CommandLine):
|
|
@@ -481,7 +490,7 @@ class ListTasksAddedTaskHistory(CommandLine):
|
|
|
481
490
|
task_list = main_obj.main(task_query=task_query, task_id_list=task_id_list)
|
|
482
491
|
|
|
483
492
|
output_obj = TasksAddedTaskHistoryOutput(task_list)
|
|
484
|
-
output_obj.output(args.output, output_format=
|
|
493
|
+
output_obj.output(args.output, output_format=OutputFormat(args.format))
|
|
485
494
|
|
|
486
495
|
|
|
487
496
|
def main(args: argparse.Namespace) -> None:
|
|
@@ -519,8 +528,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
519
528
|
argument_parser.add_output()
|
|
520
529
|
|
|
521
530
|
argument_parser.add_format(
|
|
522
|
-
choices=[
|
|
523
|
-
default=
|
|
531
|
+
choices=[OutputFormat.CSV, OutputFormat.JSON, OutputFormat.PRETTY_JSON],
|
|
532
|
+
default=OutputFormat.CSV,
|
|
524
533
|
)
|
|
525
534
|
|
|
526
535
|
parser.set_defaults(subcommand_func=main)
|
|
@@ -10,7 +10,7 @@ from annofabapi.models import TaskHistory
|
|
|
10
10
|
import annofabcli.common.cli
|
|
11
11
|
from annofabcli.common.cli import ArgumentParser, CommandLine, build_annofabapi_resource_and_login
|
|
12
12
|
from annofabcli.common.download import DownloadingFile
|
|
13
|
-
from annofabcli.common.enums import
|
|
13
|
+
from annofabcli.common.enums import OutputFormat
|
|
14
14
|
from annofabcli.common.facade import AnnofabApiFacade
|
|
15
15
|
from annofabcli.common.visualize import AddProps
|
|
16
16
|
|
|
@@ -92,7 +92,7 @@ class ListTaskHistoryWithJson(CommandLine):
|
|
|
92
92
|
project_id: str,
|
|
93
93
|
task_history_json: Path | None,
|
|
94
94
|
task_id_list: list[str] | None,
|
|
95
|
-
arg_format:
|
|
95
|
+
arg_format: OutputFormat,
|
|
96
96
|
temp_dir: Path | None,
|
|
97
97
|
):
|
|
98
98
|
"""
|
|
@@ -111,7 +111,7 @@ class ListTaskHistoryWithJson(CommandLine):
|
|
|
111
111
|
main_obj = ListTaskHistoryWithJsonMain(self.service)
|
|
112
112
|
task_history_dict = main_obj.get_task_history_dict(project_id, task_history_json=task_history_json, task_id_list=task_id_list, temp_dir=temp_dir)
|
|
113
113
|
logger.debug(f"{len(task_history_dict)} 件のタスクの履歴情報を出力します。")
|
|
114
|
-
if arg_format ==
|
|
114
|
+
if arg_format == OutputFormat.CSV:
|
|
115
115
|
all_task_history_list = main_obj.to_all_task_history_list_from_dict(task_history_dict)
|
|
116
116
|
self.print_according_to_format(all_task_history_list)
|
|
117
117
|
else:
|
|
@@ -127,7 +127,7 @@ class ListTaskHistoryWithJson(CommandLine):
|
|
|
127
127
|
args.project_id,
|
|
128
128
|
task_history_json=args.task_history_json,
|
|
129
129
|
task_id_list=task_id_list,
|
|
130
|
-
arg_format=
|
|
130
|
+
arg_format=OutputFormat(args.format),
|
|
131
131
|
temp_dir=temp_dir,
|
|
132
132
|
)
|
|
133
133
|
|
|
@@ -164,8 +164,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
164
164
|
)
|
|
165
165
|
|
|
166
166
|
argument_parser.add_format(
|
|
167
|
-
choices=[
|
|
168
|
-
default=
|
|
167
|
+
choices=[OutputFormat.CSV, OutputFormat.JSON, OutputFormat.PRETTY_JSON],
|
|
168
|
+
default=OutputFormat.CSV,
|
|
169
169
|
)
|
|
170
170
|
argument_parser.add_output()
|
|
171
171
|
|
|
@@ -6,7 +6,7 @@ from annofabapi.models import TaskHistory
|
|
|
6
6
|
|
|
7
7
|
import annofabcli.common.cli
|
|
8
8
|
from annofabcli.common.cli import ArgumentParser, CommandLine, build_annofabapi_resource_and_login
|
|
9
|
-
from annofabcli.common.enums import
|
|
9
|
+
from annofabcli.common.enums import OutputFormat
|
|
10
10
|
from annofabcli.common.facade import AnnofabApiFacade
|
|
11
11
|
from annofabcli.common.visualize import AddProps
|
|
12
12
|
|
|
@@ -78,7 +78,7 @@ class ListTaskHistory(CommandLine):
|
|
|
78
78
|
self,
|
|
79
79
|
project_id: str,
|
|
80
80
|
task_id_list: list[str] | None,
|
|
81
|
-
arg_format:
|
|
81
|
+
arg_format: OutputFormat,
|
|
82
82
|
) -> None:
|
|
83
83
|
"""
|
|
84
84
|
タスク一覧を出力する
|
|
@@ -94,7 +94,7 @@ class ListTaskHistory(CommandLine):
|
|
|
94
94
|
|
|
95
95
|
main_obj = ListTaskHistoryMain(self.service)
|
|
96
96
|
task_history_dict = main_obj.get_task_history_dict_for_output(project_id, task_id_list=task_id_list)
|
|
97
|
-
if arg_format ==
|
|
97
|
+
if arg_format == OutputFormat.CSV:
|
|
98
98
|
all_task_history_list = main_obj.to_all_task_history_list_from_dict(task_history_dict)
|
|
99
99
|
if len(all_task_history_list) > 0:
|
|
100
100
|
self.print_according_to_format(all_task_history_list)
|
|
@@ -111,7 +111,7 @@ class ListTaskHistory(CommandLine):
|
|
|
111
111
|
self.print_task_history_list(
|
|
112
112
|
args.project_id,
|
|
113
113
|
task_id_list=task_id_list,
|
|
114
|
-
arg_format=
|
|
114
|
+
arg_format=OutputFormat(args.format),
|
|
115
115
|
)
|
|
116
116
|
|
|
117
117
|
|
|
@@ -134,8 +134,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
134
134
|
)
|
|
135
135
|
|
|
136
136
|
argument_parser.add_format(
|
|
137
|
-
choices=[
|
|
138
|
-
default=
|
|
137
|
+
choices=[OutputFormat.CSV, OutputFormat.JSON, OutputFormat.PRETTY_JSON],
|
|
138
|
+
default=OutputFormat.CSV,
|
|
139
139
|
)
|
|
140
140
|
argument_parser.add_output()
|
|
141
141
|
|
|
@@ -19,7 +19,7 @@ from annofabcli.common.cli import (
|
|
|
19
19
|
get_list_from_args,
|
|
20
20
|
)
|
|
21
21
|
from annofabcli.common.download import DownloadingFile
|
|
22
|
-
from annofabcli.common.enums import
|
|
22
|
+
from annofabcli.common.enums import OutputFormat
|
|
23
23
|
from annofabcli.common.facade import AnnofabApiFacade
|
|
24
24
|
from annofabcli.common.visualize import AddProps
|
|
25
25
|
|
|
@@ -86,7 +86,7 @@ class ListTaskHistoryEventWithJson(CommandLine):
|
|
|
86
86
|
project_id: str,
|
|
87
87
|
task_history_event_json: Path | None,
|
|
88
88
|
task_id_list: list[str] | None,
|
|
89
|
-
arg_format:
|
|
89
|
+
arg_format: OutputFormat,
|
|
90
90
|
temp_dir: Path | None,
|
|
91
91
|
) -> None:
|
|
92
92
|
super().validate_project(project_id, project_member_roles=None)
|
|
@@ -96,7 +96,7 @@ class ListTaskHistoryEventWithJson(CommandLine):
|
|
|
96
96
|
|
|
97
97
|
logger.debug(f"{len(task_history_event_list)} 件のタスク履歴イベントの情報を出力します。")
|
|
98
98
|
|
|
99
|
-
if arg_format ==
|
|
99
|
+
if arg_format == OutputFormat.CSV:
|
|
100
100
|
columns = [
|
|
101
101
|
"project_id",
|
|
102
102
|
"task_id",
|
|
@@ -133,7 +133,7 @@ class ListTaskHistoryEventWithJson(CommandLine):
|
|
|
133
133
|
args.project_id,
|
|
134
134
|
task_history_event_json=args.task_history_event_json,
|
|
135
135
|
task_id_list=task_id_list,
|
|
136
|
-
arg_format=
|
|
136
|
+
arg_format=OutputFormat(args.format),
|
|
137
137
|
temp_dir=temp_dir,
|
|
138
138
|
)
|
|
139
139
|
|
|
@@ -178,8 +178,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
178
178
|
)
|
|
179
179
|
|
|
180
180
|
argument_parser.add_format(
|
|
181
|
-
choices=[
|
|
182
|
-
default=
|
|
181
|
+
choices=[OutputFormat.CSV, OutputFormat.JSON, OutputFormat.PRETTY_JSON],
|
|
182
|
+
default=OutputFormat.CSV,
|
|
183
183
|
)
|
|
184
184
|
argument_parser.add_output()
|
|
185
185
|
|
|
@@ -23,7 +23,7 @@ from annofabcli.common.cli import (
|
|
|
23
23
|
get_list_from_args,
|
|
24
24
|
)
|
|
25
25
|
from annofabcli.common.download import DownloadingFile
|
|
26
|
-
from annofabcli.common.enums import
|
|
26
|
+
from annofabcli.common.enums import OutputFormat
|
|
27
27
|
from annofabcli.common.facade import AnnofabApiFacade
|
|
28
28
|
from annofabcli.common.visualize import AddProps
|
|
29
29
|
|
|
@@ -255,7 +255,7 @@ class ListWorktimeFromTaskHistoryEvent(CommandLine):
|
|
|
255
255
|
task_history_event_json: Path | None,
|
|
256
256
|
task_id_list: list[str] | None,
|
|
257
257
|
user_id_list: list[str] | None,
|
|
258
|
-
arg_format:
|
|
258
|
+
arg_format: OutputFormat,
|
|
259
259
|
) -> None:
|
|
260
260
|
super().validate_project(project_id, project_member_roles=None)
|
|
261
261
|
|
|
@@ -270,7 +270,7 @@ class ListWorktimeFromTaskHistoryEvent(CommandLine):
|
|
|
270
270
|
logger.debug(f"作業時間一覧の件数: {len(worktime_list)}")
|
|
271
271
|
dict_worktime_list = [e.to_dict() for e in worktime_list]
|
|
272
272
|
|
|
273
|
-
if arg_format ==
|
|
273
|
+
if arg_format == OutputFormat.CSV:
|
|
274
274
|
columns = [
|
|
275
275
|
"project_id",
|
|
276
276
|
"task_id",
|
|
@@ -312,7 +312,7 @@ class ListWorktimeFromTaskHistoryEvent(CommandLine):
|
|
|
312
312
|
task_history_event_json=args.task_history_event_json,
|
|
313
313
|
task_id_list=task_id_list,
|
|
314
314
|
user_id_list=user_id_list,
|
|
315
|
-
arg_format=
|
|
315
|
+
arg_format=OutputFormat(args.format),
|
|
316
316
|
)
|
|
317
317
|
|
|
318
318
|
@staticmethod
|
|
@@ -359,8 +359,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
359
359
|
)
|
|
360
360
|
|
|
361
361
|
argument_parser.add_format(
|
|
362
|
-
choices=[
|
|
363
|
-
default=
|
|
362
|
+
choices=[OutputFormat.CSV, OutputFormat.JSON, OutputFormat.PRETTY_JSON],
|
|
363
|
+
default=OutputFormat.CSV,
|
|
364
364
|
)
|
|
365
365
|
argument_parser.add_output()
|
|
366
366
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: annofabcli
|
|
3
|
-
Version: 1.114.
|
|
3
|
+
Version: 1.114.4
|
|
4
4
|
Summary: Utility Command Line Interface for AnnoFab
|
|
5
5
|
Author: Kurusugawa Computer Inc.
|
|
6
6
|
License: MIT
|
|
@@ -24,7 +24,7 @@ Requires-Dist: dictdiffer
|
|
|
24
24
|
Requires-Dist: isodate
|
|
25
25
|
Requires-Dist: more-itertools
|
|
26
26
|
Requires-Dist: numpy
|
|
27
|
-
Requires-Dist: pandas
|
|
27
|
+
Requires-Dist: pandas>=2
|
|
28
28
|
Requires-Dist: pillow
|
|
29
29
|
Requires-Dist: pydantic>=2.12; python_version >= '3.14'
|
|
30
30
|
Requires-Dist: pyquery
|