From f4fac9210da2db3191d5982eea075c85fd9f9303 Mon Sep 17 00:00:00 2001 From: Gorgious Date: Tue, 17 Aug 2021 09:46:43 +0200 Subject: [PATCH] Fix https://github.com/IfcOpenShell/IfcOpenShell/issues/1664 : IFCPatch wouldn't correctly unpack un-hinted arguments --- src/ifcpatch/ifcpatch/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ifcpatch/ifcpatch/__init__.py b/src/ifcpatch/ifcpatch/__init__.py index 79b9027592..b9e9166d66 100644 --- a/src/ifcpatch/ifcpatch/__init__.py +++ b/src/ifcpatch/ifcpatch/__init__.py @@ -37,10 +37,9 @@ def execute(args, is_library=None): print("# Loading patch recipe ...") recipes = getattr(__import__("ifcpatch.recipes.{}".format(args["recipe"])), "recipes") recipe = getattr(recipes, args["recipe"]) - try: - # We unpack the arguments if the Patcher has been type-hinted and docstringed + if recipe.Patcher.__init__.__doc__ is not None: patcher = recipe.Patcher(args["input"], ifc_file, logger, *args["arguments"]) - except TypeError: + else: patcher = recipe.Patcher(args["input"], ifc_file, logger, args["arguments"]) print("# Patching ...") patcher.patch()