Skip to content

Commit 67dc8cc

Browse files
committed
Another try at making CodeScene happy with get_keys_from_config
1 parent 1176303 commit 67dc8cc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

satpy/dataset/id_keys.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ def get_keys_from_config(common_id_keys: dict, config: dict) -> dict:
1111
"""Gather keys for a new DataID from the ones available in configured dataset."""
1212
id_keys = {}
1313
for key, val in common_id_keys.items():
14-
has_key = key in config
15-
is_required_or_default = val is not None and (val.get("required") is True or val.get("default") is not None)
16-
if has_key or is_required_or_default:
14+
if key in config:
15+
id_keys[key] = val
16+
if val is None:
17+
continue
18+
if val.get("required") is True or val.get("default") is not None:
1719
id_keys[key] = val
1820
if not id_keys:
1921
raise ValueError("Metadata does not contain enough information to create a DataID.")

0 commit comments

Comments
 (0)