From bfd9cc0cf097b66da6ee012402af2142bcf79906 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Tue, 18 Jun 2024 13:55:19 +1000 Subject: [PATCH] Allow calling ifcpatch from code with no arguments --- src/ifcpatch/ifcpatch/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ifcpatch/ifcpatch/__init__.py b/src/ifcpatch/ifcpatch/__init__.py index 9efabf19da..9ffc25ba6f 100644 --- a/src/ifcpatch/ifcpatch/__init__.py +++ b/src/ifcpatch/ifcpatch/__init__.py @@ -76,10 +76,11 @@ def execute(args: dict) -> Union[ifcopenshell.file, str]: logger = logging.getLogger("IFCPatch") recipes = getattr(__import__("ifcpatch.recipes.{}".format(args["recipe"])), "recipes") recipe = getattr(recipes, args["recipe"]) + arguments = args.get("arguments", []) if recipe.Patcher.__init__.__doc__ is not None: - patcher = recipe.Patcher(args.get("input"), args["file"], logger, *args["arguments"]) + patcher = recipe.Patcher(args.get("input"), args["file"], logger, *arguments) else: - patcher = recipe.Patcher(args.get("input"), args["file"], logger, args["arguments"]) + patcher = recipe.Patcher(args.get("input"), args["file"], logger, arguments) patcher.patch() output = getattr(patcher, "file_patched", patcher.file) return output