1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import os
- import yaml
- topoCheckData = None
- # 读取yaml
- def read_yaml_file(filepath):
- with open(filepath, 'r') as file:
- data = yaml.load(file, Loader=yaml.FullLoader)
- return data
- current_file_path = os.path.abspath(__file__)
- # 获取当前脚本所在的目录
- current_dir = os.path.dirname(current_file_path)
- topoCheckData = read_yaml_file(f"{current_dir}\\topoCheck.yaml")
- # print(topoCheckData)
- # print(topoCheckData["topoCheck"]["A03"])
- # tempdata = topoCheckData["topoCheck"]
- # print(f"标识码 名称 说明")
- # for attr in tempdata:
- # print(
- # f"{attr} {tempdata[attr]['note']} {tempdata[attr]['UI']['description'].replace('说明: ', '').replace('说明:', '').replace('<br/>', '')}")
- def getTopoCheckSQL(type, my_dict):
- # sqllist = []
- data = topoCheckData["topoCheck"][type]
- tempSql = data["ALG"]
- for key in my_dict:
- value = my_dict[key]
- k = f"@{key}@"
- tempSql = tempSql.replace(k, value)
- print(tempSql)
- return tempSql
- # 获取description
- def getTopoCheckDescription(type):
- # sqllist = []
- data = topoCheckData["topoCheck"][type]
- description = data["UI"]["description"]
- return description
- # 获取note
- def getTopoCheckNote(type):
- # sqllist = []
- data = topoCheckData["topoCheck"][type]
- note = data["note"]
- return f"{type}:{note}"
- # my_dict = {
- # "intable_s": "topology_table",
- # "outtable": "topology_table_temp"
- # }
- # sql = getTopoCheckSQL("A03", my_dict)
- # print(sql)
- # for s in sql.split(";"):
- # print(s)
|