Skip to content

Commit

Permalink
really it should just drop none
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Dec 10, 2024
1 parent fae5f60 commit ee07b91
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions spec/dfn2toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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__":
Expand Down

0 comments on commit ee07b91

Please sign in to comment.