You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
# Copyright (C) 2022 CVAT.ai Corporation
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
import json
|
|
import os.path as osp
|
|
from http import HTTPStatus
|
|
|
|
from config import ASSETS_DIR, get_method
|
|
|
|
if __name__ == "__main__":
|
|
annotations = {}
|
|
for obj in [
|
|
"user",
|
|
"project",
|
|
"task",
|
|
"job",
|
|
"organization",
|
|
"membership",
|
|
"invitation",
|
|
"cloudstorage",
|
|
"comment",
|
|
"issue",
|
|
"webhook",
|
|
]:
|
|
response = get_method("admin1", f"{obj}s", page_size="all")
|
|
with open(osp.join(ASSETS_DIR, f"{obj}s.json"), "w") as f:
|
|
json.dump(response.json(), f, indent=2, sort_keys=True)
|
|
|
|
if obj in ["job", "task"]:
|
|
annotations[obj] = {}
|
|
for _obj in response.json()["results"]:
|
|
oid = _obj["id"]
|
|
response = get_method("admin1", f"{obj}s/{oid}/annotations")
|
|
if response.status_code == HTTPStatus.OK:
|
|
annotations[obj][oid] = response.json()
|
|
|
|
with open(osp.join(ASSETS_DIR, f"annotations.json"), "w") as f:
|
|
json.dump(annotations, f, indent=2, sort_keys=True)
|