mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 02:07:36 +00:00
Underscores in geom setting to argparse namespace
This commit is contained in:
@@ -252,17 +252,17 @@ class settings_mixin:
|
|||||||
group = parser.add_mutually_exclusive_group()
|
group = parser.add_mutually_exclusive_group()
|
||||||
group.add_argument(
|
group.add_argument(
|
||||||
f"--{nm}",
|
f"--{nm}",
|
||||||
dest=nm,
|
dest=nm.replace('-', '_'),
|
||||||
action="store_true",
|
action="store_true",
|
||||||
)
|
)
|
||||||
group.add_argument(
|
group.add_argument(
|
||||||
f"--no-{nm}",
|
f"--no-{nm}",
|
||||||
dest=nm,
|
dest=nm.replace('-', '_'),
|
||||||
action="store_false",
|
action="store_false",
|
||||||
)
|
)
|
||||||
parser.set_defaults(**{nm: None})
|
parser.set_defaults(**{nm.replace('-', '_'): None})
|
||||||
else:
|
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:
|
def apply_namespace(self, namespace) -> None:
|
||||||
"""
|
"""
|
||||||
@@ -271,8 +271,8 @@ class settings_mixin:
|
|||||||
"""
|
"""
|
||||||
names = set(self.setting_names())
|
names = set(self.setting_names())
|
||||||
for k, v in namespace._get_kwargs():
|
for k, v in namespace._get_kwargs():
|
||||||
if k in names and v is not None:
|
if k.replace('_', '-') in names and v is not None:
|
||||||
self.set(k, v)
|
self.set(k.replace('_', '-'), v)
|
||||||
|
|
||||||
|
|
||||||
class serializer_settings(settings_mixin, ifcopenshell_wrapper.SerializerSettings):
|
class serializer_settings(settings_mixin, ifcopenshell_wrapper.SerializerSettings):
|
||||||
|
|||||||
Reference in New Issue
Block a user