123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- 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
- # 调用示例
- topoCheckData = read_yaml_file(
- "D:\\Program Files\\QGIS 3.34.9\\apps\\qgis-ltr\\python\\plugins\\processing\\tools\\topology\\topoCheck.yaml")
- print(topoCheckData)
- print(topoCheckData["topoCheck"]["A03"])
- 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)
- 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 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)
|