From 736c508349e532eccf0ce188d988a2448e1a1eca Mon Sep 17 00:00:00 2001 From: w-bonelli Date: Tue, 10 Dec 2024 07:19:37 -0500 Subject: [PATCH] drop_none -> drop_empty --- spec/dfn2toml.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/dfn2toml.py b/spec/dfn2toml.py index 3ed26d0..664f09a 100644 --- a/spec/dfn2toml.py +++ b/spec/dfn2toml.py @@ -24,12 +24,12 @@ def _attach_children(d: Any): return d @staticmethod - def _drop_none(d: Any): + def _drop_empty(d: Any): if isinstance(d, Mapping): return { - k: Shim._drop_none(v) + k: Shim._drop_empty(v) for k, v in d.items() - if v is not None + if (v or isinstance(v, bool)) } else: return d @@ -43,7 +43,7 @@ def _trim(d: dict) -> dict: @staticmethod def apply(d: dict) -> dict: - return Shim._attach_children(Shim._drop_none(Shim._trim(d))) + return Shim._attach_children(Shim._drop_empty(Shim._trim(d))) if __name__ == "__main__":