Skip to content

Commit

Permalink
Remove invalid values
Browse files Browse the repository at this point in the history
  • Loading branch information
elupus committed Oct 13, 2024
1 parent bb3bdf0 commit c09fb08
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
5 changes: 4 additions & 1 deletion nibe/console_scripts/convert_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
def update_dict(d: MutableMapping, u: Mapping, removeExplicitNulls: bool) -> Mapping:
for k, v in u.items():
if v is None and removeExplicitNulls:
d.pop(k, None)
try:
d.pop(k)
except (IndexError, KeyError):
pass

Check warning on line 22 in nibe/console_scripts/convert_csv.py

View check run for this annotation

Codecov / codecov/patch

nibe/console_scripts/convert_csv.py#L19-L22

Added lines #L19 - L22 were not covered by tests
elif isinstance(v, Mapping):
update_dict(d.setdefault(k, {}), v, removeExplicitNulls)
else:
Expand Down
3 changes: 2 additions & 1 deletion nibe/data/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,8 @@
"write": true,
"mappings": {
"0": "inactive",
"1": "active"
"1": "active",
"10": null
}
},
"48044": {
Expand Down
3 changes: 1 addition & 2 deletions nibe/data/f1155_f1255.json
Original file line number Diff line number Diff line change
Expand Up @@ -5405,8 +5405,7 @@
"write": true,
"mappings": {
"0": "inactive",
"1": "active",
"10": "active"
"1": "active"
}
},
"48053": {
Expand Down
3 changes: 1 addition & 2 deletions nibe/data/f750.json
Original file line number Diff line number Diff line change
Expand Up @@ -4457,8 +4457,7 @@
"write": true,
"mappings": {
"0": "inactive",
"1": "active",
"10": "active"
"1": "active"
}
},
"48044": {
Expand Down

0 comments on commit c09fb08

Please sign in to comment.