migrate#

class migrate(obj, update=True, verbose=True, die=False)[source]#

Define migrations allowing compatibility between different versions of saved files. Usually invoked automatically upon load, but can be called directly by the user to load custom objects, e.g. lists of sims.

Currently supported objects are sims, multisims, scenarios, and people.

Parameters:
  • obj (any) – the object to migrate

  • update (bool) – whether to update version information to current version after successful migration

  • verbose (bool) – whether to print warnings if something goes wrong

  • die (bool) – whether to raise an exception if something goes wrong

Returns:

The migrated object

Example:

sims = cv.load('my-list-of-sims.obj')
sims = [cv.migrate(sim) for sim in sims]