diff --git a/spec/dfn2toml.py b/spec/dfn2toml.py index 664f09a..3ed26d0 100644 --- a/spec/dfn2toml.py +++ b/spec/dfn2toml.py @@ -24,12 +24,12 @@ def _attach_children(d: Any): return d @staticmethod - def _drop_empty(d: Any): + def _drop_none(d: Any): if isinstance(d, Mapping): return { - k: Shim._drop_empty(v) + k: Shim._drop_none(v) for k, v in d.items() - if (v or isinstance(v, bool)) + if v is not None } else: return d @@ -43,7 +43,7 @@ def _trim(d: dict) -> dict: @staticmethod def apply(d: dict) -> dict: - return Shim._attach_children(Shim._drop_empty(Shim._trim(d))) + return Shim._attach_children(Shim._drop_none(Shim._trim(d))) if __name__ == "__main__":