pg.save

Accessible via pg.save, pg.symbolic.save.

save(value, path, *args, **kwargs)[source]

Save a symbolic value using the global save handler.

Example:

@pg.members([
  ('x', pg.typing.Any())
])
class A(pg.Object):
  pass

a1 = A(1)
file = 'my_file.json'
a1.save(file)
a2 = pg.load(file)
assert pg.eq(a1, a2)
Return type:

Any

Parameters:
  • value – value to save.

  • path – A path string for saving value.

  • *args – Positional arguments that will be passed through to the global save handler.

  • **kwargs – Keyword arguments that will be passed through to the global save handler.

Returns:

Return value from the global save handler.

Raises:

RuntimeError – if global save handler is not set.