Henning Schröder avatar Henning Schröder committed a14797d

simplified logic

Comments (0)

Files changed (1)

experimental/test.py

 		names = [str(n) for n in mm.parameterNames()]
 		types = [str(t).rstrip("&*") for t in mm.parameterTypes()]
 		param_types = zip(names, types)
-		if len(param_types) == len(args):
-			arg_types = []
-			for i, (pn, pt) in enumerate(param_types):
-				a = args[i]
-				classes = [type(a)]
-				at = None
-				for cls in classes:
-					if cls.__name__ == pt:
-						at = cls
-						break
-					for base in cls.__bases__:
-						if base not in classes:
-							classes.append(base)
-				if not at:
+		if len(param_types) != len(args):
+			continue
+		arg_types = []
+		for i, (pn, pt) in enumerate(param_types):
+			a = args[i]
+			classes = [type(a)]
+			at = None
+			for cls in classes:
+				if cls.__name__ == pt:
+					at = cls
 					break
-				arg_types.append(at)
-			if len(arg_types) == len(args):
-				obj = mo.newInstance(*[Q_ARG(at, an) for (at,an) in zip(arg_types, args)])
-				obj.pyqtConfigure(**properties)
-				if obj is not None:
-					break
+				for base in cls.__bases__:
+					if base not in classes:
+						classes.append(base)
+			if not at:
+				break
+			arg_types.append(at)
+		if len(arg_types) == len(args):
+			obj = mo.newInstance(*[Q_ARG(at, an) for (at,an) in zip(arg_types, args)])
+			obj.pyqtConfigure(**properties)
+			if obj is not None:
+				break
 
 	if not obj:
 		raise TypeError("Could not find matching constructor for %s" % class_name)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.