From b503463a02efbeef6b1eeb93d2d68ad6768767a8 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 5 Feb 2024 16:23:16 +0500 Subject: [PATCH] ifcpatch.execute - make input attribute optional e.g. MergeDuplicateTypes doesn't use it in the code either way --- src/ifcpatch/ifcpatch/__init__.py | 5 ++--- src/ifcpatch/ifcpatch/recipes/MergeDuplicateTypes.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/ifcpatch/ifcpatch/__init__.py b/src/ifcpatch/ifcpatch/__init__.py index 549990e06a..c40f316563 100644 --- a/src/ifcpatch/ifcpatch/__init__.py +++ b/src/ifcpatch/ifcpatch/__init__.py @@ -69,13 +69,12 @@ def execute(args): if "log" in args: logging.basicConfig(filename=args["log"], filemode="a", level=logging.DEBUG) logger = logging.getLogger("IFCPatch") - ifc_file = args["input"] recipes = getattr(__import__("ifcpatch.recipes.{}".format(args["recipe"])), "recipes") recipe = getattr(recipes, args["recipe"]) if recipe.Patcher.__init__.__doc__ is not None: - patcher = recipe.Patcher(args["input"], args["file"], logger, *args["arguments"]) + patcher = recipe.Patcher(args.get("input"), args["file"], logger, *args["arguments"]) else: - patcher = recipe.Patcher(args["input"], args["file"], logger, args["arguments"]) + patcher = recipe.Patcher(args.get("input"), args["file"], logger, args["arguments"]) patcher.patch() output = getattr(patcher, "file_patched", patcher.file) return output diff --git a/src/ifcpatch/ifcpatch/recipes/MergeDuplicateTypes.py b/src/ifcpatch/ifcpatch/recipes/MergeDuplicateTypes.py index a02f989ee1..4b4524bd0f 100644 --- a/src/ifcpatch/ifcpatch/recipes/MergeDuplicateTypes.py +++ b/src/ifcpatch/ifcpatch/recipes/MergeDuplicateTypes.py @@ -53,10 +53,10 @@ class Patcher: .. code:: python # Default behaviour of merging by Tag attribute - ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "MergeDuplicateTypes", "arguments": []}) + ifcpatch.execute({"file": model, "recipe": "MergeDuplicateTypes", "arguments": []}) # Explicitly say we want to merge based on the Name attribute - ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "MergeDuplicateTypes", "arguments": ["Name"]}) + ifcpatch.execute({"file": model, "recipe": "MergeDuplicateTypes", "arguments": ["Name"]}) """ self.src = src self.file = file