• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# Copyright (c) 2024 Huawei Device Co., Ltd.
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16import enum
17from coreImpl import detection_label
18
19
20class ToolNameType(enum.Enum):
21    DETECTION = 'detection'
22
23
24tool_name_type_set = [
25    member.value for name_tool,
26    member in ToolNameType.__members__.items()
27]
28
29
30class FormatType(enum.Enum):
31    JSON = 'json'
32    EXCEL = 'excel'
33
34
35format_set = [
36    member.value for name_format,
37    member in FormatType.__members__.items()
38]
39
40
41def run_tools(options):
42    tool_name = options.tool_name
43    if tool_name == ToolNameType["DETECTION"].value:
44        detection_label.detection_label(options.check_labels, options.result_json_path, options.output_path)
45
46
47class Config(object):
48    name = 'parser'
49    version = '0.1.0'
50    description = 'Compare the parser the NDKS'
51    commands = [
52        {
53            "name": "--tool-name",
54            "abbr": "-N",
55            "required": True,
56            "choices": tool_name_type_set,
57            "type": str,
58            "default": ToolNameType["DETECTION"],
59            "help": "工具名称"
60        },
61        {
62            "name": "--check-labels",
63            "abbr": "-L",
64            "required": True,
65            "type": str,
66            "help": "需要校验的标签"
67        },
68        {
69            "name": "--result-json-path",
70            "abbr": "-P",
71            "required": True,
72            "type": str,
73            "help": "解析结果json文件路径"
74        },
75        {
76            "name": "--output-path",
77            "abbr": "-O",
78            "required": False,
79            "type": str,
80            "help": "输出路径"
81        }
82    ]
83
84