def from_string(s): """ .. todo:: WRITEME """ return cPickle.loads(s)
def from_string(s): """ .. todo:: WRITEME """ return cPickle.loads(s)
def clone_via_serialize(obj): """ .. todo:: WRITEME """ s = cPickle.dumps(obj, get_pickle_protocol()) return cPickle.loads(s)
def clone_via_serialize(obj): """ .. todo:: WRITEME """ s = cPickle.dumps(obj, get_pickle_protocol()) return cPickle.loads(s)
def exponential_backoff(): if recurse_depth > 9: logger.info('Max number of tries exceeded while trying to open ' '{0}'.format(filepath)) logger.info('attempting to open via reading string') with open(filepath, 'rb') as f: content = f.read() return cPickle.loads(content, **encoding) else: nsec = 0.5 * (2.0 ** float(recurse_depth)) logger.info("Waiting {0} seconds and trying again".format(nsec)) time.sleep(nsec) return _load(filepath, recurse_depth + 1, retry)
def exponential_backoff(): if recurse_depth > 9: logger.info('Max number of tries exceeded while trying to open ' '{0}'.format(filepath)) logger.info('attempting to open via reading string') with open(filepath, 'rb') as f: content = f.read() return cPickle.loads(content, **encoding) else: nsec = 0.5 * (2.0 ** float(recurse_depth)) logger.info("Waiting {0} seconds and trying again".format(nsec)) time.sleep(nsec) return _load(filepath, recurse_depth + 1, retry)
def from_string(s): """ Deserializes an object from a string. Parameters ---------- s : str The object serialized as a string. Returns ------- obj : object The object. """ return cPickle.loads(s)
def clone_via_serialize(obj): """ Makes a "deep copy" of an object by serializing it and then deserializing it. Parameters ---------- obj : object The object to clone. Returns ------- obj2 : object A copy of the object. """ s = cPickle.dumps(obj, get_pickle_protocol()) return cPickle.loads(s)