From b5096f38d633192d7ecc92965fcbf2491e8aa91d Mon Sep 17 00:00:00 2001 From: aodongbiao Date: Fri, 23 Sep 2022 11:38:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: aodongbiao Change-Id: I70656958f0189843e04bc20465c07b4025003259 --- tools/syscap_check.py | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/tools/syscap_check.py b/tools/syscap_check.py index 99c550d..a4932aa 100644 --- a/tools/syscap_check.py +++ b/tools/syscap_check.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,9 +18,6 @@ import json import re import argparse from prettytable import PrettyTable, ALL -import sys - -debug = True if sys.gettrace() else False def get_args(): @@ -83,14 +80,10 @@ def read_value_from_json(filepath: str, return f = open(filepath, 'r') data = json.load(f) - if debug: - print(filepath) for key in key_hierarchy: try: data = data[key] except KeyError: - if debug: - print('warning: can\'t find the key:"{}" in file "{}"'.format(key, filepath)) return finally: f.close() @@ -114,7 +107,7 @@ def collect_syscap_from_codec(filepath: str, pattern: str = r'{"(.*)"') -> tuple array_syscap_set.update(re.findall(ptrn, content)) array_syscap_dict[filepath] = list() for v in array_syscap_set: - array_syscap_dict[filepath].append(v) + array_syscap_dict.get(filepath).append(v) return array_syscap_set, array_syscap_dict @@ -311,16 +304,6 @@ def main(): bundle_key_heirarchy=bundle_syscap_heirarchy, bundles=bundles) -def test(): - h_path = "./bundle.json" - key_heirarchy = ("component", "syscap") - result_dict = dict() - read_value_from_json(h_path, key_heirarchy, result_dict, bundle_syscap_post_handler) - print(result_dict) - print(len(result_dict)) - - if __name__ == "__main__": main() - # test()