annofabcli 1.105.0__py3-none-any.whl → 1.105.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- annofabcli/annotation/change_annotation_attributes_per_annotation.py +26 -7
- {annofabcli-1.105.0.dist-info → annofabcli-1.105.1.dist-info}/METADATA +1 -1
- {annofabcli-1.105.0.dist-info → annofabcli-1.105.1.dist-info}/RECORD +6 -6
- {annofabcli-1.105.0.dist-info → annofabcli-1.105.1.dist-info}/WHEEL +0 -0
- {annofabcli-1.105.0.dist-info → annofabcli-1.105.1.dist-info}/entry_points.txt +0 -0
- {annofabcli-1.105.0.dist-info → annofabcli-1.105.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -9,6 +9,7 @@ from pathlib import Path
|
|
|
9
9
|
from typing import Any, Optional, Union
|
|
10
10
|
|
|
11
11
|
import annofabapi
|
|
12
|
+
import pandas
|
|
12
13
|
from annofabapi.models import ProjectMemberRole
|
|
13
14
|
from annofabapi.pydantic_models.task_status import TaskStatus
|
|
14
15
|
from pydantic import BaseModel
|
|
@@ -205,12 +206,23 @@ class ChangeAttributesPerAnnotation(CommandLine):
|
|
|
205
206
|
def main(self) -> None:
|
|
206
207
|
args = self.args
|
|
207
208
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
if args.json is not None:
|
|
210
|
+
annotation_items = get_json_from_args(args.json)
|
|
211
|
+
if not isinstance(annotation_items, list):
|
|
212
|
+
print(f"{self.COMMON_MESSAGE} argument --json: JSON形式が不正です。オブジェクトの配列を指定してください。", file=sys.stderr) # noqa: T201
|
|
213
|
+
sys.exit(COMMAND_LINE_ERROR_STATUS_CODE)
|
|
212
214
|
|
|
213
|
-
|
|
215
|
+
target_annotation_list = [TargetAnnotation.model_validate(anno) for anno in annotation_items]
|
|
216
|
+
|
|
217
|
+
elif args.csv is not None:
|
|
218
|
+
df_input = pandas.read_csv(args.csv)
|
|
219
|
+
target_annotation_list = [
|
|
220
|
+
TargetAnnotation(task_id=e["task_id"], input_data_id=e["input_data_id"], annotation_id=e["annotation_id"], attributes=json.loads(e["attributes"]))
|
|
221
|
+
for e in df_input.to_dict(orient="records")
|
|
222
|
+
]
|
|
223
|
+
else:
|
|
224
|
+
print(f"{self.COMMON_MESSAGE} argument '--json' または '--csv' のいずれかを指定してください。", file=sys.stderr) # noqa: T201
|
|
225
|
+
sys.exit(COMMAND_LINE_ERROR_STATUS_CODE)
|
|
214
226
|
|
|
215
227
|
project_id = args.project_id
|
|
216
228
|
|
|
@@ -243,13 +255,20 @@ def parse_args(parser: argparse.ArgumentParser) -> None:
|
|
|
243
255
|
argument_parser.add_project_id()
|
|
244
256
|
|
|
245
257
|
sample_json_obj = [{"task_id": "t1", "input_data_id": "i1", "annotation_id": "a1", "attributes": {"occluded": True}}]
|
|
246
|
-
parser.
|
|
258
|
+
input_group = parser.add_mutually_exclusive_group(required=True)
|
|
259
|
+
input_group.add_argument(
|
|
247
260
|
"--json",
|
|
248
261
|
type=str,
|
|
249
|
-
required=True,
|
|
250
262
|
help="各アノテーションごとに変更内容を記載したJSONリストを指定します。 ``file://`` を先頭に付けるとJSON形式のファイルを指定できます。\n"
|
|
251
263
|
f"(例) '{json.dumps(sample_json_obj, ensure_ascii=False)}'",
|
|
252
264
|
)
|
|
265
|
+
input_group.add_argument(
|
|
266
|
+
"--csv",
|
|
267
|
+
type=str,
|
|
268
|
+
help="各アノテーションごとに変更内容を記載したCSVファイルを指定します。 \n"
|
|
269
|
+
"* `task_id`, `input_data_id`, `annotation_id`, `attributes` の4つのカラムが必要です。\n"
|
|
270
|
+
f"`attributes` カラムには、属性名と値を '{json.dumps({'occluded': True})}' のようにJSON形式で指定します。\n",
|
|
271
|
+
)
|
|
253
272
|
|
|
254
273
|
parser.add_argument(
|
|
255
274
|
"--force",
|
|
@@ -4,7 +4,7 @@ annofabcli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
4
4
|
annofabcli/annotation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
annofabcli/annotation/annotation_query.py,sha256=VwfPWpLOpVa2SeEJ264LmCKkBGDJvpX8o7GbWIrDE0o,15712
|
|
6
6
|
annofabcli/annotation/change_annotation_attributes.py,sha256=Zjqax-sb7ujJnTUVv4io0GFmZzfqx0rpN2N1W86uVTs,17092
|
|
7
|
-
annofabcli/annotation/change_annotation_attributes_per_annotation.py,sha256=
|
|
7
|
+
annofabcli/annotation/change_annotation_attributes_per_annotation.py,sha256=4OkFOasRpW86akmgZOdKwnt__b-Q6uCwILInxgiy5o8,13878
|
|
8
8
|
annofabcli/annotation/change_annotation_properties.py,sha256=Kp_LZ5sSoVmmjGE80ABVO3InxsXBIxiFFvVcIJNsOMk,18309
|
|
9
9
|
annofabcli/annotation/copy_annotation.py,sha256=Pih2k3vvpgfT3Ovb3gZw2L_8fK_ws_wKR7ARYG5hG_8,18407
|
|
10
10
|
annofabcli/annotation/delete_annotation.py,sha256=hQApNrx2Ci1bBWk0dRGA0oJkIgDHwl6Jy0-33gYF6jo,22989
|
|
@@ -209,8 +209,8 @@ annofabcli/task_history_event/download_task_history_event_json.py,sha256=hQLVbQ0
|
|
|
209
209
|
annofabcli/task_history_event/list_all_task_history_event.py,sha256=EeKMyPUxGwYCFtWQHHW954ZserGm8lUqrwNnV1iX9X4,6830
|
|
210
210
|
annofabcli/task_history_event/list_worktime.py,sha256=Y7Pu5DP7scPf7HPt6CTiTvB1_5_Nfi1bStUIaCpkhII,15507
|
|
211
211
|
annofabcli/task_history_event/subcommand_task_history_event.py,sha256=mJVJoT4RXk4HWnY7-Nrsl4If-gtaIIEXd2z7eFZwM2I,1260
|
|
212
|
-
annofabcli-1.105.
|
|
213
|
-
annofabcli-1.105.
|
|
214
|
-
annofabcli-1.105.
|
|
215
|
-
annofabcli-1.105.
|
|
216
|
-
annofabcli-1.105.
|
|
212
|
+
annofabcli-1.105.1.dist-info/METADATA,sha256=1wpj99TzN1VpD56ObB9viB1goGsbs7qUMSUhQAk3DHY,5286
|
|
213
|
+
annofabcli-1.105.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
214
|
+
annofabcli-1.105.1.dist-info/entry_points.txt,sha256=C2uSUc-kkLJpoK_mDL5FEMAdorLEMPfwSf8VBMYnIFM,56
|
|
215
|
+
annofabcli-1.105.1.dist-info/licenses/LICENSE,sha256=pcqWYfxFtxBzhvKp3x9MXNM4xciGb2eFewaRhXUNHlo,1081
|
|
216
|
+
annofabcli-1.105.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|