wenn nur ein Tunnel oder zu viele gleichlautende Tunnel definiert wurden, dann Fehler werfen
This commit is contained in:
+17
-3
@@ -621,10 +621,11 @@ def check_file_in_work(work_dir: Path, filename: Path) -> tuple[Path, bool]:
|
||||
mypath = filename
|
||||
return mypath, fexists
|
||||
|
||||
def check_existance(res_mappings: dict, res_dist: dict, res_pos: dict) -> dict:
|
||||
def check_existance(res_mappings: dict, res_dist: dict, res_pos: dict, res_tunnel: dict) -> dict:
|
||||
ret = dict()
|
||||
ret["missing_distributors"] = list()
|
||||
ret["missing_sensors"] = list()
|
||||
ret["missing_tunnel"] = list()
|
||||
for dname in res_mappings.keys():
|
||||
if dname not in res_dist:
|
||||
ret["missing_distributors"].append(dname)
|
||||
@@ -632,7 +633,13 @@ def check_existance(res_mappings: dict, res_dist: dict, res_pos: dict) -> dict:
|
||||
for s in lofsensors:
|
||||
if s not in res_pos:
|
||||
ret['missing_sensors'].append(s)
|
||||
|
||||
for tname in res_tunnel.keys():
|
||||
if len(res_tunnel[tname]) < 2 :
|
||||
ret["missing_tunnel"].append(tname)
|
||||
if len(res_tunnel[tname]) > 2 :
|
||||
if "overdefined_tunnel" not in ret:
|
||||
ret["overdefined_tunnel"] = list()
|
||||
ret["overdefined_tunnel"].append(tname)
|
||||
return ret
|
||||
|
||||
def dxf_is_binary(dxf_path: Path) -> bool:
|
||||
@@ -810,11 +817,18 @@ if __name__ == '__main__':
|
||||
|
||||
if args.write:
|
||||
basename = os.path.splitext(args.write)[0]
|
||||
res_not_found = check_existance(res_mappings, res_dist, res_sens)
|
||||
res_not_found = check_existance(res_mappings, res_dist, res_sens, res_tunnel)
|
||||
if args.errors and "overdefined_tunnel" in res_not_found:
|
||||
print("unorrect tunnels found. Writing errors-file.")
|
||||
err_ids = list(res_not_found["overdefined_tunnel"])
|
||||
write_results(to_json(list(err_ids)), work_dir, args.errors)
|
||||
|
||||
added_warnings = merge_two_dicts(warnings, missing_attribs)
|
||||
res_not_found["missing_attributes"] = added_warnings
|
||||
output_results["not_found"] = res_not_found
|
||||
output_results["double_ids"] = res_double
|
||||
|
||||
|
||||
write_results(to_json(output_results), work_dir, f"{basename}.json")
|
||||
|
||||
else:
|
||||
|
||||
+7
-5
@@ -434,11 +434,13 @@ class Anlage():
|
||||
die Rückage enthält ein Tuple, welche Tunnel keinem Rack zugeordnet werden konnten
|
||||
'''
|
||||
for tname, pos in self._tunnels.items():
|
||||
tunbeg = pos[0]
|
||||
tunend = pos[1]
|
||||
trackname = f"t-Rack-{tname}"
|
||||
self._racks.add_rack(tunbeg, tunend, trackname)
|
||||
|
||||
if len(pos) == 2:
|
||||
tunbeg = pos[0]
|
||||
tunend = pos[1]
|
||||
trackname = f"t-Rack-{tname}"
|
||||
self._racks.add_rack(tunbeg, tunend, trackname)
|
||||
else:
|
||||
raise Exception("Tunnel has more than one begin and end/ just one begin")
|
||||
errors = list()
|
||||
for name, pos in self._tunnels.items():
|
||||
p1 = self._tunnels[name][0]
|
||||
|
||||
Reference in New Issue
Block a user