How to use the cloudpickle.CloudPickler.dispatch.copy function in cloudpickle

To help you get started, we’ve selected a few cloudpickle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ray-project / ray / python / ray / pickling.py View on Github external
base_globals))
    self.write(pickle.REDUCE)
    self.memoize(func)

    self.save(f_globals)
    self.save(defaults)
    self.save(closure)
    self.save(dct)
    self.write(pickle.TUPLE)
    self.write(pickle.REDUCE)

  def save_cell(self, obj):
    self.save(cloudpickle._make_cell)
    self.save((obj.cell_contents,))
    self.write(pickle.REDUCE)
  dispatch = CloudPickler.dispatch.copy()
  dispatch[(lambda _: lambda: _)(0).__closure__[0].__class__] = save_cell