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
|
@@ -19,7 +19,7 @@ from annofabcli.common.cli import (
|
|
|
19
19
|
get_json_from_args,
|
|
20
20
|
get_list_from_args,
|
|
21
21
|
)
|
|
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.utils import get_columns_with_priority
|
|
25
25
|
from annofabcli.common.visualize import AddProps
|
|
@@ -194,7 +194,7 @@ class ListAnnotation(CommandLine):
|
|
|
194
194
|
|
|
195
195
|
logger.debug(f"アノテーション {len(annotation_list)} 件を出力します。")
|
|
196
196
|
|
|
197
|
-
if self.str_format ==
|
|
197
|
+
if self.str_format == OutputFormat.CSV.value:
|
|
198
198
|
annotation_list_for_csv = to_annotation_list_for_csv(annotation_list)
|
|
199
199
|
df = pandas.DataFrame(annotation_list_for_csv)
|
|
200
200
|
columns = get_columns_with_priority(df, prior_columns=self.PRIOR_COLUMNS)
|
|
@@ -243,8 +243,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
243
243
|
)
|
|
244
244
|
|
|
245
245
|
argument_parser.add_format(
|
|
246
|
-
choices=[
|
|
247
|
-
default=
|
|
246
|
+
choices=[OutputFormat.CSV, OutputFormat.JSON, OutputFormat.PRETTY_JSON],
|
|
247
|
+
default=OutputFormat.CSV,
|
|
248
248
|
)
|
|
249
249
|
|
|
250
250
|
argument_parser.add_output()
|
|
@@ -20,7 +20,7 @@ from annofabcli.common.cli import (
|
|
|
20
20
|
get_json_from_args,
|
|
21
21
|
get_list_from_args,
|
|
22
22
|
)
|
|
23
|
-
from annofabcli.common.enums import
|
|
23
|
+
from annofabcli.common.enums import OutputFormat
|
|
24
24
|
from annofabcli.common.facade import AnnofabApiFacade
|
|
25
25
|
from annofabcli.common.type_util import assert_noreturn
|
|
26
26
|
from annofabcli.common.visualize import AddProps
|
|
@@ -103,7 +103,7 @@ class ListAnnotationCount(CommandLine):
|
|
|
103
103
|
group_by = GroupBy(args.group_by)
|
|
104
104
|
df = aggregate_annotations(all_annotation_list, group_by)
|
|
105
105
|
|
|
106
|
-
if self.str_format ==
|
|
106
|
+
if self.str_format == OutputFormat.CSV.value:
|
|
107
107
|
self.print_csv(df)
|
|
108
108
|
else:
|
|
109
109
|
self.print_according_to_format(df.to_dict(orient="records"))
|
|
@@ -154,8 +154,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
154
154
|
argument_parser.add_output()
|
|
155
155
|
|
|
156
156
|
argument_parser.add_format(
|
|
157
|
-
choices=[
|
|
158
|
-
default=
|
|
157
|
+
choices=[OutputFormat.CSV, OutputFormat.JSON, OutputFormat.PRETTY_JSON],
|
|
158
|
+
default=OutputFormat.CSV,
|
|
159
159
|
)
|
|
160
160
|
|
|
161
161
|
parser.set_defaults(subcommand_func=main)
|
|
@@ -12,7 +12,7 @@ from annofabcli.common.cli import (
|
|
|
12
12
|
CommandLine,
|
|
13
13
|
build_annofabapi_resource_and_login,
|
|
14
14
|
)
|
|
15
|
-
from annofabcli.common.enums import
|
|
15
|
+
from annofabcli.common.enums import OutputFormat
|
|
16
16
|
from annofabcli.common.facade import AnnofabApiFacade
|
|
17
17
|
from annofabcli.common.utils import print_according_to_format
|
|
18
18
|
|
|
@@ -62,7 +62,7 @@ class ExportAnnotationSpecs(CommandLine):
|
|
|
62
62
|
|
|
63
63
|
annotation_specs = self.get_exported_annotation_specs(args.project_id, history_id=history_id)
|
|
64
64
|
|
|
65
|
-
print_according_to_format(annotation_specs, format=
|
|
65
|
+
print_according_to_format(annotation_specs, format=OutputFormat(args.format), output=args.output)
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
@@ -98,8 +98,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
98
98
|
"-f",
|
|
99
99
|
"--format",
|
|
100
100
|
type=str,
|
|
101
|
-
choices=[
|
|
102
|
-
default=
|
|
101
|
+
choices=[OutputFormat.JSON.value, OutputFormat.PRETTY_JSON.value],
|
|
102
|
+
default=OutputFormat.JSON.value,
|
|
103
103
|
help="出力フォーマット",
|
|
104
104
|
)
|
|
105
105
|
|
|
@@ -16,7 +16,7 @@ from annofabcli.common.cli import (
|
|
|
16
16
|
build_annofabapi_resource_and_login,
|
|
17
17
|
get_list_from_args,
|
|
18
18
|
)
|
|
19
|
-
from annofabcli.common.enums import
|
|
19
|
+
from annofabcli.common.enums import OutputFormat
|
|
20
20
|
from annofabcli.common.facade import AnnofabApiFacade
|
|
21
21
|
|
|
22
22
|
logger = logging.getLogger(__name__)
|
|
@@ -150,10 +150,10 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
150
150
|
|
|
151
151
|
argument_parser.add_format(
|
|
152
152
|
choices=[
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
OutputFormat.JSON,
|
|
154
|
+
OutputFormat.PRETTY_JSON,
|
|
155
155
|
],
|
|
156
|
-
default=
|
|
156
|
+
default=OutputFormat.PRETTY_JSON,
|
|
157
157
|
)
|
|
158
158
|
|
|
159
159
|
parser.set_defaults(subcommand_func=main)
|
|
@@ -16,7 +16,7 @@ from annofabcli.common.cli import (
|
|
|
16
16
|
build_annofabapi_resource_and_login,
|
|
17
17
|
get_list_from_args,
|
|
18
18
|
)
|
|
19
|
-
from annofabcli.common.enums import
|
|
19
|
+
from annofabcli.common.enums import OutputFormat
|
|
20
20
|
from annofabcli.common.facade import AnnofabApiFacade
|
|
21
21
|
|
|
22
22
|
logger = logging.getLogger(__name__)
|
|
@@ -124,10 +124,10 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
124
124
|
|
|
125
125
|
argument_parser.add_format(
|
|
126
126
|
choices=[
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
OutputFormat.JSON,
|
|
128
|
+
OutputFormat.PRETTY_JSON,
|
|
129
129
|
],
|
|
130
|
-
default=
|
|
130
|
+
default=OutputFormat.PRETTY_JSON,
|
|
131
131
|
)
|
|
132
132
|
|
|
133
133
|
parser.set_defaults(subcommand_func=main)
|
|
@@ -16,7 +16,7 @@ from annofabcli.common.cli import (
|
|
|
16
16
|
build_annofabapi_resource_and_login,
|
|
17
17
|
get_list_from_args,
|
|
18
18
|
)
|
|
19
|
-
from annofabcli.common.enums import
|
|
19
|
+
from annofabcli.common.enums import OutputFormat
|
|
20
20
|
from annofabcli.common.facade import AnnofabApiFacade
|
|
21
21
|
|
|
22
22
|
logger = logging.getLogger(__name__)
|
|
@@ -135,10 +135,10 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
135
135
|
|
|
136
136
|
argument_parser.add_format(
|
|
137
137
|
choices=[
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
OutputFormat.JSON,
|
|
139
|
+
OutputFormat.PRETTY_JSON,
|
|
140
140
|
],
|
|
141
|
-
default=
|
|
141
|
+
default=OutputFormat.PRETTY_JSON,
|
|
142
142
|
)
|
|
143
143
|
|
|
144
144
|
parser.set_defaults(subcommand_func=main)
|
|
@@ -22,7 +22,7 @@ from annofabcli.common.cli import (
|
|
|
22
22
|
CommandLine,
|
|
23
23
|
build_annofabapi_resource_and_login,
|
|
24
24
|
)
|
|
25
|
-
from annofabcli.common.enums import
|
|
25
|
+
from annofabcli.common.enums import OutputFormat
|
|
26
26
|
from annofabcli.common.facade import AnnofabApiFacade
|
|
27
27
|
from annofabcli.common.utils import print_according_to_format, print_csv
|
|
28
28
|
|
|
@@ -124,10 +124,10 @@ def create_flatten_attribute_list_from_additionals(additionals_v3: list[dict[str
|
|
|
124
124
|
class PrintAnnotationSpecsAttribute(CommandLine):
|
|
125
125
|
COMMON_MESSAGE = "annofabcli annotation_specs list_attribute: error:"
|
|
126
126
|
|
|
127
|
-
def print_annotation_specs_attribute(self, annotation_specs_v3: dict[str, Any], output_format:
|
|
127
|
+
def print_annotation_specs_attribute(self, annotation_specs_v3: dict[str, Any], output_format: OutputFormat, output: str | None = None) -> None:
|
|
128
128
|
attribute_list = create_flatten_attribute_list_from_additionals(annotation_specs_v3["additionals"], annotation_specs_v3["labels"], annotation_specs_v3["restrictions"])
|
|
129
129
|
logger.info(f"{len(attribute_list)} 件の属性情報を出力します。")
|
|
130
|
-
if output_format ==
|
|
130
|
+
if output_format == OutputFormat.CSV:
|
|
131
131
|
columns = [
|
|
132
132
|
"attribute_id",
|
|
133
133
|
"attribute_name_en",
|
|
@@ -145,7 +145,7 @@ class PrintAnnotationSpecsAttribute(CommandLine):
|
|
|
145
145
|
df = pandas.DataFrame(attribute_list, columns=columns)
|
|
146
146
|
print_csv(df, output)
|
|
147
147
|
|
|
148
|
-
elif output_format in [
|
|
148
|
+
elif output_format in [OutputFormat.JSON, OutputFormat.PRETTY_JSON]:
|
|
149
149
|
print_according_to_format([e.to_dict() for e in attribute_list], format=output_format, output=output)
|
|
150
150
|
|
|
151
151
|
def get_history_id_from_before_index(self, project_id: str, before: int) -> str | None:
|
|
@@ -179,7 +179,7 @@ class PrintAnnotationSpecsAttribute(CommandLine):
|
|
|
179
179
|
else:
|
|
180
180
|
raise RuntimeError("'--project_id'か'--annotation_specs_json'のどちらかを指定する必要があります。")
|
|
181
181
|
|
|
182
|
-
self.print_annotation_specs_attribute(annotation_specs, output_format=
|
|
182
|
+
self.print_annotation_specs_attribute(annotation_specs, output_format=OutputFormat(args.format), output=args.output)
|
|
183
183
|
|
|
184
184
|
|
|
185
185
|
def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
@@ -219,8 +219,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
219
219
|
"-f",
|
|
220
220
|
"--format",
|
|
221
221
|
type=str,
|
|
222
|
-
choices=[
|
|
223
|
-
default=
|
|
222
|
+
choices=[OutputFormat.CSV.value, OutputFormat.JSON.value, OutputFormat.PRETTY_JSON.value],
|
|
223
|
+
default=OutputFormat.CSV.value,
|
|
224
224
|
help="出力フォーマット ",
|
|
225
225
|
)
|
|
226
226
|
|
|
@@ -21,7 +21,7 @@ from annofabcli.common.cli import (
|
|
|
21
21
|
CommandLine,
|
|
22
22
|
build_annofabapi_resource_and_login,
|
|
23
23
|
)
|
|
24
|
-
from annofabcli.common.enums import
|
|
24
|
+
from annofabcli.common.enums import OutputFormat
|
|
25
25
|
from annofabcli.common.facade import AnnofabApiFacade
|
|
26
26
|
from annofabcli.common.utils import print_according_to_format, print_csv
|
|
27
27
|
|
|
@@ -104,12 +104,11 @@ def create_flatten_choice_list_from_additionals(additionals_v3: list[dict[str, A
|
|
|
104
104
|
class PrintAnnotationSpecsAttribute(CommandLine):
|
|
105
105
|
COMMON_MESSAGE = "annofabcli annotation_specs list_choice: error:"
|
|
106
106
|
|
|
107
|
-
def print_annotation_specs_choice(self, annotation_specs_v3: dict[str, Any], output_format:
|
|
107
|
+
def print_annotation_specs_choice(self, annotation_specs_v3: dict[str, Any], output_format: OutputFormat, output: str | None = None) -> None:
|
|
108
108
|
choice_list = create_flatten_choice_list_from_additionals(annotation_specs_v3["additionals"])
|
|
109
109
|
logger.info(f"{len(choice_list)} 件の選択肢情報を出力します。")
|
|
110
110
|
|
|
111
|
-
if output_format ==
|
|
112
|
-
df = pandas.DataFrame(choice_list)
|
|
111
|
+
if output_format == OutputFormat.CSV:
|
|
113
112
|
columns = [
|
|
114
113
|
"attribute_id",
|
|
115
114
|
"attribute_name_en",
|
|
@@ -121,9 +120,10 @@ class PrintAnnotationSpecsAttribute(CommandLine):
|
|
|
121
120
|
"is_default",
|
|
122
121
|
"keybind",
|
|
123
122
|
]
|
|
124
|
-
|
|
123
|
+
df = pandas.DataFrame(choice_list, columns=columns)
|
|
124
|
+
print_csv(df, output)
|
|
125
125
|
|
|
126
|
-
elif output_format in [
|
|
126
|
+
elif output_format in [OutputFormat.JSON, OutputFormat.PRETTY_JSON]:
|
|
127
127
|
print_according_to_format([e.to_dict() for e in choice_list], format=output_format, output=output)
|
|
128
128
|
|
|
129
129
|
def get_history_id_from_before_index(self, project_id: str, before: int) -> str | None:
|
|
@@ -159,7 +159,7 @@ class PrintAnnotationSpecsAttribute(CommandLine):
|
|
|
159
159
|
else:
|
|
160
160
|
raise RuntimeError("'--project_id'か'--annotation_specs_json'のどちらかを指定する必要があります。")
|
|
161
161
|
|
|
162
|
-
self.print_annotation_specs_choice(annotation_specs, output_format=
|
|
162
|
+
self.print_annotation_specs_choice(annotation_specs, output_format=OutputFormat(args.format), output=args.output)
|
|
163
163
|
|
|
164
164
|
|
|
165
165
|
def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
@@ -199,8 +199,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
199
199
|
"-f",
|
|
200
200
|
"--format",
|
|
201
201
|
type=str,
|
|
202
|
-
choices=[
|
|
203
|
-
default=
|
|
202
|
+
choices=[OutputFormat.CSV.value, OutputFormat.JSON.value, OutputFormat.PRETTY_JSON.value],
|
|
203
|
+
default=OutputFormat.CSV.value,
|
|
204
204
|
help="出力フォーマット ",
|
|
205
205
|
)
|
|
206
206
|
|
|
@@ -6,7 +6,7 @@ import annofabapi
|
|
|
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
|
|
|
@@ -48,7 +48,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
48
48
|
|
|
49
49
|
argument_parser.add_project_id()
|
|
50
50
|
|
|
51
|
-
argument_parser.add_format(choices=[
|
|
51
|
+
argument_parser.add_format(choices=[OutputFormat.CSV, OutputFormat.JSON, OutputFormat.PRETTY_JSON], default=OutputFormat.CSV)
|
|
52
52
|
argument_parser.add_output()
|
|
53
53
|
|
|
54
54
|
parser.set_defaults(subcommand_func=main)
|
|
@@ -21,7 +21,7 @@ from annofabcli.common.cli import (
|
|
|
21
21
|
CommandLine,
|
|
22
22
|
build_annofabapi_resource_and_login,
|
|
23
23
|
)
|
|
24
|
-
from annofabcli.common.enums import
|
|
24
|
+
from annofabcli.common.enums import OutputFormat
|
|
25
25
|
from annofabcli.common.facade import AnnofabApiFacade
|
|
26
26
|
from annofabcli.common.utils import print_csv
|
|
27
27
|
|
|
@@ -101,16 +101,16 @@ class PrintAnnotationSpecsLabel(CommandLine):
|
|
|
101
101
|
|
|
102
102
|
COMMON_MESSAGE = "annofabcli annotation_specs list_label: error:"
|
|
103
103
|
|
|
104
|
-
def print_annotation_specs_label(self, annotation_specs_v3: dict[str, Any], output_format:
|
|
104
|
+
def print_annotation_specs_label(self, annotation_specs_v3: dict[str, Any], output_format: OutputFormat, output: str | None = None) -> None:
|
|
105
105
|
label_list = create_label_list(annotation_specs_v3["labels"])
|
|
106
|
-
if output_format ==
|
|
106
|
+
if output_format == OutputFormat.CSV:
|
|
107
107
|
df = pandas.DataFrame(label_list)
|
|
108
108
|
|
|
109
109
|
columns = ["label_id", "label_name_en", "label_name_ja", "label_name_vi", "annotation_type", "color", "attribute_count", "keybind"]
|
|
110
110
|
print_csv(df[columns], output)
|
|
111
111
|
|
|
112
|
-
elif output_format in [
|
|
113
|
-
annofabcli.common.utils.print_according_to_format([e.to_dict() for e in label_list], format=
|
|
112
|
+
elif output_format in [OutputFormat.JSON, OutputFormat.PRETTY_JSON]:
|
|
113
|
+
annofabcli.common.utils.print_according_to_format([e.to_dict() for e in label_list], format=OutputFormat(output_format), output=output)
|
|
114
114
|
|
|
115
115
|
def get_history_id_from_before_index(self, project_id: str, before: int) -> str | None:
|
|
116
116
|
histories, _ = self.service.api.get_annotation_specs_histories(project_id)
|
|
@@ -146,7 +146,7 @@ class PrintAnnotationSpecsLabel(CommandLine):
|
|
|
146
146
|
else:
|
|
147
147
|
raise RuntimeError("'--project_id'か'--annotation_specs_json'のどちらかを指定する必要があります。")
|
|
148
148
|
|
|
149
|
-
self.print_annotation_specs_label(annotation_specs, output_format=
|
|
149
|
+
self.print_annotation_specs_label(annotation_specs, output_format=OutputFormat(args.format), output=args.output)
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
@@ -186,8 +186,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
186
186
|
"-f",
|
|
187
187
|
"--format",
|
|
188
188
|
type=str,
|
|
189
|
-
choices=[
|
|
190
|
-
default=
|
|
189
|
+
choices=[OutputFormat.CSV.value, OutputFormat.JSON.value, OutputFormat.PRETTY_JSON.value],
|
|
190
|
+
default=OutputFormat.CSV.value,
|
|
191
191
|
help="出力フォーマット ",
|
|
192
192
|
)
|
|
193
193
|
|
|
@@ -20,7 +20,7 @@ from annofabcli.common.cli import (
|
|
|
20
20
|
CommandLine,
|
|
21
21
|
build_annofabapi_resource_and_login,
|
|
22
22
|
)
|
|
23
|
-
from annofabcli.common.enums import
|
|
23
|
+
from annofabcli.common.enums import OutputFormat
|
|
24
24
|
from annofabcli.common.facade import AnnofabApiFacade
|
|
25
25
|
from annofabcli.common.utils import print_according_to_format, print_csv
|
|
26
26
|
|
|
@@ -90,11 +90,11 @@ def create_label_attribute_list(labels_v3: list[dict[str, Any]], additionals_v3:
|
|
|
90
90
|
class PrintAnnotationSpecsLabelAndAttribute(CommandLine):
|
|
91
91
|
COMMON_MESSAGE = "annofabcli annotation_specs list_label: error:"
|
|
92
92
|
|
|
93
|
-
def print_annotation_specs_label(self, annotation_specs_v3: dict[str, Any], output_format:
|
|
93
|
+
def print_annotation_specs_label(self, annotation_specs_v3: dict[str, Any], output_format: OutputFormat, output: str | None = None) -> None:
|
|
94
94
|
# アノテーション仕様のv2とv3はほとんど同じなので、`convert_annotation_specs_labels_v2_to_v1`にはV3のアノテーション仕様を渡す
|
|
95
95
|
label_attribute_list = create_label_attribute_list(annotation_specs_v3["labels"], annotation_specs_v3["additionals"])
|
|
96
96
|
|
|
97
|
-
if output_format ==
|
|
97
|
+
if output_format == OutputFormat.CSV:
|
|
98
98
|
columns = [
|
|
99
99
|
"label_id",
|
|
100
100
|
"label_name_en",
|
|
@@ -111,7 +111,7 @@ class PrintAnnotationSpecsLabelAndAttribute(CommandLine):
|
|
|
111
111
|
df = pandas.DataFrame(label_attribute_list, columns=columns)
|
|
112
112
|
print_csv(df, output)
|
|
113
113
|
|
|
114
|
-
elif output_format in [
|
|
114
|
+
elif output_format in [OutputFormat.JSON, OutputFormat.PRETTY_JSON]:
|
|
115
115
|
print_according_to_format([e.to_dict() for e in label_attribute_list], format=output_format, output=output)
|
|
116
116
|
|
|
117
117
|
def get_history_id_from_before_index(self, project_id: str, before: int) -> str | None:
|
|
@@ -148,7 +148,7 @@ class PrintAnnotationSpecsLabelAndAttribute(CommandLine):
|
|
|
148
148
|
else:
|
|
149
149
|
raise RuntimeError("'--project_id'か'--annotation_specs_json'のどちらかを指定する必要があります。")
|
|
150
150
|
|
|
151
|
-
self.print_annotation_specs_label(annotation_specs, output_format=
|
|
151
|
+
self.print_annotation_specs_label(annotation_specs, output_format=OutputFormat(args.format), output=args.output)
|
|
152
152
|
|
|
153
153
|
|
|
154
154
|
def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
@@ -188,8 +188,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
188
188
|
"-f",
|
|
189
189
|
"--format",
|
|
190
190
|
type=str,
|
|
191
|
-
choices=[
|
|
192
|
-
default=
|
|
191
|
+
choices=[OutputFormat.CSV.value, OutputFormat.JSON.value, OutputFormat.PRETTY_JSON.value],
|
|
192
|
+
default=OutputFormat.CSV.value,
|
|
193
193
|
help="出力フォーマット ",
|
|
194
194
|
)
|
|
195
195
|
|
|
@@ -10,7 +10,7 @@ import annofabcli.common.cli
|
|
|
10
10
|
from annofabcli.common.cli import (
|
|
11
11
|
ArgumentParser,
|
|
12
12
|
CommandLine,
|
|
13
|
-
|
|
13
|
+
OutputFormat,
|
|
14
14
|
build_annofabapi_resource_and_login,
|
|
15
15
|
)
|
|
16
16
|
from annofabcli.common.facade import AnnofabApiFacade
|
|
@@ -51,7 +51,7 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
51
51
|
|
|
52
52
|
argument_parser.add_project_id()
|
|
53
53
|
|
|
54
|
-
argument_parser.add_format(choices=[
|
|
54
|
+
argument_parser.add_format(choices=[OutputFormat.JSON, OutputFormat.PRETTY_JSON], default=OutputFormat.PRETTY_JSON)
|
|
55
55
|
|
|
56
56
|
argument_parser.add_output()
|
|
57
57
|
|
|
@@ -17,7 +17,7 @@ import annofabcli.common.cli
|
|
|
17
17
|
from annofabcli.common.annofab.annotation_zip import lazy_parse_simple_annotation_by_input_data
|
|
18
18
|
from annofabcli.common.cli import COMMAND_LINE_ERROR_STATUS_CODE, ArgumentParser, CommandLine, build_annofabapi_resource_and_login, get_list_from_args
|
|
19
19
|
from annofabcli.common.download import DownloadingFile
|
|
20
|
-
from annofabcli.common.enums import
|
|
20
|
+
from annofabcli.common.enums import OutputFormat
|
|
21
21
|
from annofabcli.common.facade import (
|
|
22
22
|
AnnofabApiFacade,
|
|
23
23
|
TaskQuery,
|
|
@@ -200,7 +200,7 @@ def create_df(
|
|
|
200
200
|
def print_annotation_3d_bounding_box(
|
|
201
201
|
annotation_path: Path,
|
|
202
202
|
output_file: Path,
|
|
203
|
-
output_format:
|
|
203
|
+
output_format: OutputFormat,
|
|
204
204
|
*,
|
|
205
205
|
target_task_ids: Collection[str] | None = None,
|
|
206
206
|
task_query: TaskQuery | None = None,
|
|
@@ -215,12 +215,12 @@ def print_annotation_3d_bounding_box(
|
|
|
215
215
|
|
|
216
216
|
logger.info(f"{len(annotation_bbox_list)} 件の3Dバウンディングボックスアノテーションの情報を出力します。 :: output='{output_file}'")
|
|
217
217
|
|
|
218
|
-
if output_format ==
|
|
218
|
+
if output_format == OutputFormat.CSV:
|
|
219
219
|
df = create_df(annotation_bbox_list)
|
|
220
220
|
print_csv(df, output_file)
|
|
221
221
|
|
|
222
|
-
elif output_format in [
|
|
223
|
-
json_is_pretty = output_format ==
|
|
222
|
+
elif output_format in [OutputFormat.PRETTY_JSON, OutputFormat.JSON]:
|
|
223
|
+
json_is_pretty = output_format == OutputFormat.PRETTY_JSON
|
|
224
224
|
# DataClassJsonMixinを使用したtoJSON処理
|
|
225
225
|
print_json(
|
|
226
226
|
[e.to_dict(encode_json=True) for e in annotation_bbox_list],
|
|
@@ -265,7 +265,7 @@ class ListAnnotation3DBoundingBox(CommandLine):
|
|
|
265
265
|
label_name_list = get_list_from_args(args.label_name) if args.label_name is not None else None
|
|
266
266
|
|
|
267
267
|
output_file: Path = args.output
|
|
268
|
-
output_format =
|
|
268
|
+
output_format = OutputFormat(args.format)
|
|
269
269
|
|
|
270
270
|
downloading_obj = DownloadingFile(self.service)
|
|
271
271
|
|
|
@@ -320,8 +320,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
320
320
|
group.add_argument("-p", "--project_id", type=str, help="project_id。アノテーションZIPをダウンロードします。")
|
|
321
321
|
|
|
322
322
|
argument_parser.add_format(
|
|
323
|
-
choices=[
|
|
324
|
-
default=
|
|
323
|
+
choices=[OutputFormat.CSV, OutputFormat.JSON, OutputFormat.PRETTY_JSON],
|
|
324
|
+
default=OutputFormat.CSV,
|
|
325
325
|
)
|
|
326
326
|
|
|
327
327
|
argument_parser.add_output()
|
|
@@ -17,7 +17,7 @@ import annofabcli.common.cli
|
|
|
17
17
|
from annofabcli.common.annofab.annotation_zip import lazy_parse_simple_annotation_by_input_data
|
|
18
18
|
from annofabcli.common.cli import COMMAND_LINE_ERROR_STATUS_CODE, ArgumentParser, CommandLine, build_annofabapi_resource_and_login, get_list_from_args
|
|
19
19
|
from annofabcli.common.download import DownloadingFile
|
|
20
|
-
from annofabcli.common.enums import
|
|
20
|
+
from annofabcli.common.enums import OutputFormat
|
|
21
21
|
from annofabcli.common.facade import (
|
|
22
22
|
AnnofabApiFacade,
|
|
23
23
|
TaskQuery,
|
|
@@ -163,7 +163,7 @@ def create_df(
|
|
|
163
163
|
def print_annotation_bounding_box(
|
|
164
164
|
annotation_path: Path,
|
|
165
165
|
output_file: Path,
|
|
166
|
-
output_format:
|
|
166
|
+
output_format: OutputFormat,
|
|
167
167
|
*,
|
|
168
168
|
target_task_ids: Collection[str] | None = None,
|
|
169
169
|
task_query: TaskQuery | None = None,
|
|
@@ -178,12 +178,12 @@ def print_annotation_bounding_box(
|
|
|
178
178
|
|
|
179
179
|
logger.info(f"{len(annotation_bbox_list)} 件のバウンディングボックスアノテーションの情報を出力します。 :: output='{output_file}'")
|
|
180
180
|
|
|
181
|
-
if output_format ==
|
|
181
|
+
if output_format == OutputFormat.CSV:
|
|
182
182
|
df = create_df(annotation_bbox_list)
|
|
183
183
|
print_csv(df, output_file)
|
|
184
184
|
|
|
185
|
-
elif output_format in [
|
|
186
|
-
json_is_pretty = output_format ==
|
|
185
|
+
elif output_format in [OutputFormat.PRETTY_JSON, OutputFormat.JSON]:
|
|
186
|
+
json_is_pretty = output_format == OutputFormat.PRETTY_JSON
|
|
187
187
|
# DataClassJsonMixinを使用したtoJSON処理
|
|
188
188
|
print_json(
|
|
189
189
|
[e.to_dict(encode_json=True) for e in annotation_bbox_list],
|
|
@@ -228,7 +228,7 @@ class ListAnnotationBoundingBox2d(CommandLine):
|
|
|
228
228
|
label_name_list = get_list_from_args(args.label_name) if args.label_name is not None else None
|
|
229
229
|
|
|
230
230
|
output_file: Path = args.output
|
|
231
|
-
output_format =
|
|
231
|
+
output_format = OutputFormat(args.format)
|
|
232
232
|
|
|
233
233
|
downloading_obj = DownloadingFile(self.service)
|
|
234
234
|
|
|
@@ -283,8 +283,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
283
283
|
group.add_argument("-p", "--project_id", type=str, help="project_id。アノテーションZIPをダウンロードします。")
|
|
284
284
|
|
|
285
285
|
argument_parser.add_format(
|
|
286
|
-
choices=[
|
|
287
|
-
default=
|
|
286
|
+
choices=[OutputFormat.CSV, OutputFormat.JSON, OutputFormat.PRETTY_JSON],
|
|
287
|
+
default=OutputFormat.CSV,
|
|
288
288
|
)
|
|
289
289
|
|
|
290
290
|
argument_parser.add_output()
|
|
@@ -16,7 +16,7 @@ import annofabcli.common.cli
|
|
|
16
16
|
from annofabcli.common.annofab.annotation_zip import lazy_parse_simple_annotation_by_input_data
|
|
17
17
|
from annofabcli.common.cli import COMMAND_LINE_ERROR_STATUS_CODE, ArgumentParser, CommandLine, build_annofabapi_resource_and_login, get_list_from_args
|
|
18
18
|
from annofabcli.common.download import DownloadingFile
|
|
19
|
-
from annofabcli.common.enums import
|
|
19
|
+
from annofabcli.common.enums import OutputFormat
|
|
20
20
|
from annofabcli.common.facade import (
|
|
21
21
|
AnnofabApiFacade,
|
|
22
22
|
TaskQuery,
|
|
@@ -218,7 +218,7 @@ def create_df(
|
|
|
218
218
|
def print_annotation_polygon(
|
|
219
219
|
annotation_path: Path,
|
|
220
220
|
output_file: Path,
|
|
221
|
-
output_format:
|
|
221
|
+
output_format: OutputFormat,
|
|
222
222
|
*,
|
|
223
223
|
target_task_ids: Collection[str] | None = None,
|
|
224
224
|
task_query: TaskQuery | None = None,
|
|
@@ -233,12 +233,12 @@ def print_annotation_polygon(
|
|
|
233
233
|
|
|
234
234
|
logger.info(f"{len(annotation_polygon_list)} 件のポリゴンアノテーションの情報を出力します。 :: output='{output_file}'")
|
|
235
235
|
|
|
236
|
-
if output_format ==
|
|
236
|
+
if output_format == OutputFormat.CSV:
|
|
237
237
|
df = create_df(annotation_polygon_list)
|
|
238
238
|
print_csv(df, output_file)
|
|
239
239
|
|
|
240
|
-
elif output_format in [
|
|
241
|
-
json_is_pretty = output_format ==
|
|
240
|
+
elif output_format in [OutputFormat.PRETTY_JSON, OutputFormat.JSON]:
|
|
241
|
+
json_is_pretty = output_format == OutputFormat.PRETTY_JSON
|
|
242
242
|
# Pydantic BaseModelを使用したJSON処理
|
|
243
243
|
print_json(
|
|
244
244
|
[e.model_dump() for e in annotation_polygon_list],
|
|
@@ -283,7 +283,7 @@ class ListAnnotationPolygon(CommandLine):
|
|
|
283
283
|
label_name_list = get_list_from_args(args.label_name) if args.label_name is not None else None
|
|
284
284
|
|
|
285
285
|
output_file: Path = args.output
|
|
286
|
-
output_format =
|
|
286
|
+
output_format = OutputFormat(args.format)
|
|
287
287
|
|
|
288
288
|
downloading_obj = DownloadingFile(self.service)
|
|
289
289
|
|
|
@@ -338,8 +338,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
338
338
|
group.add_argument("-p", "--project_id", type=str, help="project_id。アノテーションZIPをダウンロードします。")
|
|
339
339
|
|
|
340
340
|
argument_parser.add_format(
|
|
341
|
-
choices=[
|
|
342
|
-
default=
|
|
341
|
+
choices=[OutputFormat.CSV, OutputFormat.JSON, OutputFormat.PRETTY_JSON],
|
|
342
|
+
default=OutputFormat.CSV,
|
|
343
343
|
)
|
|
344
344
|
|
|
345
345
|
argument_parser.add_output()
|
|
@@ -15,7 +15,7 @@ import annofabcli.common.cli
|
|
|
15
15
|
from annofabcli.common.annofab.annotation_zip import lazy_parse_simple_annotation_by_input_data
|
|
16
16
|
from annofabcli.common.cli import COMMAND_LINE_ERROR_STATUS_CODE, ArgumentParser, CommandLine, build_annofabapi_resource_and_login, get_list_from_args
|
|
17
17
|
from annofabcli.common.download import DownloadingFile
|
|
18
|
-
from annofabcli.common.enums import
|
|
18
|
+
from annofabcli.common.enums import OutputFormat
|
|
19
19
|
from annofabcli.common.facade import (
|
|
20
20
|
AnnofabApiFacade,
|
|
21
21
|
TaskQuery,
|
|
@@ -230,7 +230,7 @@ def create_df(
|
|
|
230
230
|
def print_annotation_polyline(
|
|
231
231
|
annotation_path: Path,
|
|
232
232
|
output_file: Path,
|
|
233
|
-
output_format:
|
|
233
|
+
output_format: OutputFormat,
|
|
234
234
|
*,
|
|
235
235
|
target_task_ids: Collection[str] | None = None,
|
|
236
236
|
task_query: TaskQuery | None = None,
|
|
@@ -245,12 +245,12 @@ def print_annotation_polyline(
|
|
|
245
245
|
|
|
246
246
|
logger.info(f"{len(annotation_polyline_list)} 件のポリラインアノテーションの情報を出力します。 :: output='{output_file}'")
|
|
247
247
|
|
|
248
|
-
if output_format ==
|
|
248
|
+
if output_format == OutputFormat.CSV:
|
|
249
249
|
df = create_df(annotation_polyline_list)
|
|
250
250
|
print_csv(df, output_file)
|
|
251
251
|
|
|
252
|
-
elif output_format in [
|
|
253
|
-
json_is_pretty = output_format ==
|
|
252
|
+
elif output_format in [OutputFormat.PRETTY_JSON, OutputFormat.JSON]:
|
|
253
|
+
json_is_pretty = output_format == OutputFormat.PRETTY_JSON
|
|
254
254
|
# Pydantic BaseModelを使用したJSON処理
|
|
255
255
|
print_json(
|
|
256
256
|
[e.model_dump() for e in annotation_polyline_list],
|
|
@@ -295,7 +295,7 @@ class ListAnnotationPolyline(CommandLine):
|
|
|
295
295
|
label_name_list = get_list_from_args(args.label_name) if args.label_name is not None else None
|
|
296
296
|
|
|
297
297
|
output_file: Path = args.output
|
|
298
|
-
output_format =
|
|
298
|
+
output_format = OutputFormat(args.format)
|
|
299
299
|
|
|
300
300
|
downloading_obj = DownloadingFile(self.service)
|
|
301
301
|
|
|
@@ -350,8 +350,8 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
350
350
|
group.add_argument("-p", "--project_id", type=str, help="project_id。アノテーションZIPをダウンロードします。")
|
|
351
351
|
|
|
352
352
|
argument_parser.add_format(
|
|
353
|
-
choices=[
|
|
354
|
-
default=
|
|
353
|
+
choices=[OutputFormat.CSV, OutputFormat.JSON, OutputFormat.PRETTY_JSON],
|
|
354
|
+
default=OutputFormat.CSV,
|
|
355
355
|
)
|
|
356
356
|
|
|
357
357
|
argument_parser.add_output()
|