From ff5c1ae139db2c3daca3866ed2d17b0d527dcee6 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Wed, 16 Jun 2021 17:35:40 +0200 Subject: [PATCH] Added remove-egde cli-argument --- caliGraph.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/caliGraph.py b/caliGraph.py index 2aaf08f..bab3fb1 100755 --- a/caliGraph.py +++ b/caliGraph.py @@ -540,6 +540,9 @@ def analyze(G, type_name, name, dist=2.7): ratio = fuzz.ratio(node['label'], name) if ratio > bestRatio: bestRatio, match, n = ratio, node, ni + if not match: + raise Exception("No such "+type_name+" could be found.") + menge = set() pruneDist(G, match, n, dist, menge) for n in list(G.nodes): @@ -601,6 +604,7 @@ def cliInterface(): parser.add_argument('--remove-unread', action="store_true") parser.add_argument('--no-web', action="store_true") parser.add_argument('--no-list', action="store_true") + parser.add_argument('--remove-edge', action="store_true") cmds = parser.add_subparsers(required=True, dest='cmd') p_rec = cmds.add_parser('recommend', description="TODO", aliases=['rec']) @@ -640,6 +644,9 @@ def cliInterface(): else: raise Exception("Bad") + if args.remove_edge: + removeEdge(G) + if not args.no_list: printBestList(G) if not args.no_web: