[sr-dev] git:5.2:1ef44dbf: tools: use correct check of None instead of wrong comparison in route_graph.py tool

Henning Westerholt hw at skalatan.de
Sat Sep 21 21:27:44 CEST 2019


Module: kamailio
Branch: 5.2
Commit: 1ef44dbf7a62a912618f2dc3174ac0adc91e63ac
URL: https://github.com/kamailio/kamailio/commit/1ef44dbf7a62a912618f2dc3174ac0adc91e63ac

Author: Henning Westerholt <hw at skalatan.de>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2019-09-21T21:24:55+02:00

tools: use correct check of None instead of wrong comparison in route_graph.py tool

(cherry picked from commit 545ef51912ae9bf5e14eaffeb9f41be8359a442f)

---

Modified: misc/tools/route_graph/route_graph.py

---

Diff:  https://github.com/kamailio/kamailio/commit/1ef44dbf7a62a912618f2dc3174ac0adc91e63ac.diff
Patch: https://github.com/kamailio/kamailio/commit/1ef44dbf7a62a912618f2dc3174ac0adc91e63ac.patch

---

diff --git a/misc/tools/route_graph/route_graph.py b/misc/tools/route_graph/route_graph.py
index 2024cf42a0..135440a3c5 100755
--- a/misc/tools/route_graph/route_graph.py
+++ b/misc/tools/route_graph/route_graph.py
@@ -79,7 +79,7 @@ def traverse_routes(_level, _name):
 if len(sys.argv) == 3:
 	max_depth = int(sys.argv[2])
 cfg = file(sys.argv[1], "r")
-if cfg == None:
+if cfg is None:
 	raise "Missing config file"
 line = cfg.readline()
 rt = routes
@@ -90,40 +90,40 @@ def traverse_routes(_level, _name):
 		main_match = re_main_route.search(line)
 		def_match = re_def_route.search(line)
 		call_match = re_call_route.search(line)
-		if not call_match == None:
+		if not call_match is None:
 			log("CALL: " + line)
 			name = call_match.group(2)
 			log(rname +":"+name)
 			rt[rname].append(name)
-		elif not def_match == None:
+		elif not def_match is None:
 			log("DEF: " + line)
 			rtype = def_match.group(1)
 			rname = def_match.group(3)
 			if rtype == "failure_":
 				rt = f_routes
-				if rname == None:
+				if rname is None:
 					rname = "failure"
 			elif rtype == "onreply_":
 				rt = r_routes
-				if rname == None:
+				if rname is None:
 					rname = "onreply"
 			elif rtype == "onsend_":
 				rt = s_routes
-				if rname == None:
+				if rname is None:
 					rname = "onsend"
 			elif rtype == "branch_":
 				rt = b_routes
-				if rname == None:
+				if rname is None:
 					rname = "branch"
 			elif rtype == "event_":
 				rt = e_routes
-				if rname == None:
+				if rname is None:
 					rname = "event"
 			else:
 				rt = routes
 			log(rname)
 			rt[rname] = []
-		elif not main_match == None:
+		elif not main_match is None:
 			log("MAIN: " + line)
 			rtype = main_match.group(1)
 			if rtype == "failure_":




More information about the sr-dev mailing list