aiida-workgraph treats None as "unset" rather than as a legitimate value. This gave rise to a couple of surprises.
First, any Optional[T] parameter without a = None default raises TypeError: missing 1 required keyword-only argument even when it has been provided by the caller. (Not especially critical, because typically such parameters come with None as a default)
Second, a dict-typed socket carrying {"k": None} arrives at the receiver as {} — the key is dropped silently, so downstream payload["k"] raises KeyError. More critical than the first case, because this entry won't be re-populated via defaults.
Is there any reason why None should be stripped rather than retained?
aiida-workgraphtreatsNoneas "unset" rather than as a legitimate value. This gave rise to a couple of surprises.First, any
Optional[T]parameter without a= Nonedefault raisesTypeError: missing 1 required keyword-only argumenteven when it has been provided by the caller. (Not especially critical, because typically such parameters come withNoneas a default)Second, a
dict-typed socket carrying{"k": None}arrives at the receiver as{}— the key is dropped silently, so downstreampayload["k"]raisesKeyError. More critical than the first case, because this entry won't be re-populated via defaults.Is there any reason why
Noneshould be stripped rather than retained?