Skip to content

Commit

Permalink
drop_none -> drop_empty
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Dec 10, 2024
1 parent 173ccec commit 736c508
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_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
Expand All @@ -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__":
Expand Down

0 comments on commit 736c508

Please sign in to comment.