new_key_added#

gufe.tokenization.new_key_added(dct, new_key, default)#

Serialization migration: Add a new key to the dictionary.

This can be used in when writing a serialization migration (see GufeTokenizable.serialization_migration() ) where a new key has been added to the object’s representation (e.g., a new parameter has been added). In order to be migratable, the new key must have an associated default value.

Parameters:
  • dct (dict) – dictionary based on the old serialization version

  • new_key (str) – name of the new key

  • default (Any) – default value for the new key

Returns:

input dictionary modified to add the new key

Return type:

dict