edgegraph.output.nrpickler.NonrecursivePickler#
- class edgegraph.output.nrpickler.NonrecursivePickler(file, **kwargs)#
Bases:
PicklerNon-recursive pickler class.
This class subclasses :py:cls`dill.Pickler`, and overrides its
dumpsmethod with a non-recursive implementation, making it safe to use with arbitrary edgegraph objects regardless of the size of graphs they may be a part of.This class it not really intended for direct usage; see also
dumps()for a better interface. For unpickling, use the regular built-inpicklemodule (nonrecursive specialties are only needed on the pickling side, not the unpickling side).- __init__(file, **kwargs)#
This takes a binary file for writing a pickle data stream.
The optional protocol argument tells the pickler to use the given protocol; supported protocols are 0, 1, 2, 3, 4 and 5. The default protocol is 4. It was introduced in Python 3.4, and is incompatible with previous versions.
Specifying a negative protocol version selects the highest protocol version supported. The higher the protocol used, the more recent the version of Python needed to read the pickle produced.
The file argument must have a write() method that accepts a single bytes argument. It can thus be a file object opened for binary writing, an io.BytesIO instance, or any other custom object that meets this interface.
If fix_imports is True and protocol is less than 3, pickle will try to map the new Python 3 names to the old module names used in Python 2, so that the pickle data stream is readable with Python 2.
If buffer_callback is None (the default), buffer views are serialized into file as part of the pickle stream.
If buffer_callback is not None, then it can be called any number of times with a buffer view. If the callback returns a false value (such as None), the given buffer is out-of-band; otherwise the buffer is serialized in-band, i.e. inside the pickle stream.
It is an error if buffer_callback is not None and protocol is None or smaller than 5.
Methods
__init__(file, **kwargs)This takes a binary file for writing a pickle data stream.
Clears the pickler's "memo".
dump(obj)Write a pickled representation of obj to the open file.
get(i)lazymemoize(obj)Store an object in the memo.
lazywrite(*args)Lazily write an object to the memo.
memoize(obj)Store an object in the memo.
persistent_id(obj)put(idx)realmemoize(obj)Store an object in the memo.
realsave(obj[, save_persistent_id])save(obj)Lazy-save the given object (that is, add it to the queue for writing later).
save_bool(obj)save_bytearray(obj)save_bytes(obj)save_dict(obj)save_float(obj)save_frozenset(obj)save_global(obj[, name])save_list(obj)save_long(obj)save_none(obj)save_pers(pid)save_picklebuffer(obj)save_reduce(func, args[, state, listitems, ...])save_set(obj)save_str(obj)save_tuple(obj)save_type(obj)Attributes
The dispatch table, a dictionary of serializing functions used by Pickler to save objects of specific types.
settings- clear_memo()#
Clears the pickler’s “memo”.
The memo is the data structure that remembers which objects the pickler has already seen, so that shared or recursive objects are pickled by reference and not by value. This method is useful when re-using picklers.
- dispatch: Dict[type, Callable[[Pickler, Any], None]]#
The dispatch table, a dictionary of serializing functions used by Pickler to save objects of specific types. Use
pickle()orregister()to associate types to custom functions.
- dump(obj)#
Write a pickled representation of obj to the open file.
- lazymemoize(obj)#
Store an object in the memo.
- lazywrite(*args)#
Lazily write an object to the memo.
- memoize(obj)#
Store an object in the memo.
- realmemoize(obj)#
Store an object in the memo.
- realsave(obj, save_persistent_id=True)#
Alias to the true
dill.Pickler.save().
- save(obj)#
Lazy-save the given object (that is, add it to the queue for writing later).