From 92546019246361d183c95a969c0e2ece923c4609 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Fri, 28 Mar 2025 12:11:27 +0100 Subject: [PATCH] Underscores in geom setting to argparse namespace --- src/ifcopenshell-python/ifcopenshell/geom/main.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/geom/main.py b/src/ifcopenshell-python/ifcopenshell/geom/main.py index 07d267c06f..037eba1317 100644 --- a/src/ifcopenshell-python/ifcopenshell/geom/main.py +++ b/src/ifcopenshell-python/ifcopenshell/geom/main.py @@ -252,17 +252,17 @@ class settings_mixin: group = parser.add_mutually_exclusive_group() group.add_argument( f"--{nm}", - dest=nm, + dest=nm.replace('-', '_'), action="store_true", ) group.add_argument( f"--no-{nm}", - dest=nm, + dest=nm.replace('-', '_'), action="store_false", ) - parser.set_defaults(**{nm: None}) + parser.set_defaults(**{nm.replace('-', '_'): None}) else: - parser.add_argument(f"--{nm}", dest=nm, type=type_factories[ty]) + parser.add_argument(f"--{nm}", dest=nm.replace('-', '_'), type=type_factories[ty]) def apply_namespace(self, namespace) -> None: """ @@ -271,8 +271,8 @@ class settings_mixin: """ names = set(self.setting_names()) for k, v in namespace._get_kwargs(): - if k in names and v is not None: - self.set(k, v) + if k.replace('_', '-') in names and v is not None: + self.set(k.replace('_', '-'), v) class serializer_settings(settings_mixin, ifcopenshell_wrapper.SerializerSettings):