old_key_removed#

gufe.tokenization.old_key_removed(dct, old_key, should_warn)#

Serialization migration: Remove an old key from the dictionary.

This can be used in when writing a serialization migration (see GufeTokenizable.serialization_migration() ) where a key has been removed from the object’s serialized representation (e.g., an old parameter is no longer allowed). If a parameter has been removed, it is likely that you will want to warn the user that the parameter is no longer used: the should_warn option allows that.

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

  • old_key (str) – name of the key that has been removed

  • should_warn (bool) – whether to issue a warning for this (generally recommended)

Returns:

input dictionary modified to remove the old key

Return type:

dict