From 417b01f3f59d1e01abc3cf6335edca511f85c00e Mon Sep 17 00:00:00 2001 From: dingsheng Date: Thu, 10 Oct 2024 11:53:44 +0000 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=86=E5=B1=82=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E5=88=9D=E5=A7=8B=E5=8C=96=E6=95=B0=E6=8D=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E4=BF=9D=E5=AD=98=E5=88=86=E5=B1=82=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E7=BB=93=E6=9E=9C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 26 +++++++++++++++++++++++++- src/data/classify_data.json | 1 + src/data/layer_data.json | 6 ++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/data/classify_data.json create mode 100644 src/data/layer_data.json diff --git a/main.py b/main.py index 8a5ffba..72e48b5 100644 --- a/main.py +++ b/main.py @@ -13,14 +13,38 @@ # ********************************************************************************** """ import sys +import os +import json import argparse from src.utils.isocheck import IsoCheck +from src.utils import util -class kyClassifier: + +LAYERDATA = '/opt/kyclassifier/src/data/layer_data.json' +CLASSIFYDATA = '/opt/kyclassifier/src/data/classify_data.json' + +class kyClassifier(object): + @staticmethod def process_iso(iso_path): pass + @staticmethod + def save_output(pkg2layer,pkg2category): + JSON_OUTPATH = ( + (pkg2layer,'pkg2layer.json'), + (pkg2category,'pkg2category.json'), + ) + formatted_time = util.get_formatted_time() + dir_path = '/opt/kyclassifier/output/{}/'.format(formatted_time) + json_path = '{}json/'.format(dir_path) + os.makedirs(dir_path) + os.makedirs(json_path) + for tup in JSON_OUTPATH: + with open(json_path + tup[1],'w') as f: + json.dump(tup[0],f) + print(("Output json file saved at {}").format(json_path)) + if __name__ == '__main__': options = ['-h\n', diff --git a/src/data/classify_data.json b/src/data/classify_data.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/src/data/classify_data.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/data/layer_data.json b/src/data/layer_data.json new file mode 100644 index 0000000..374cc9c --- /dev/null +++ b/src/data/layer_data.json @@ -0,0 +1,6 @@ +{ + "1":[], + "2":[], + "3":[], + "4":[] +} \ No newline at end of file -- Gitee