class documentation

(Internal) This class manages state for a call to jelly()

Method __init__ Initialize.
Method jelly Undocumented
Method jelly_decimal Jelly a decimal object.
Method prepare (internal) Create a list for persisting an object to. This will allow backreferences to be made internal to the object. (circular references).
Method preserve (internal) Mark an object's persistent list for later referral.
Method unpersistable (internal) Returns an sexp: (unpersistable "reason"). Utility method for making note that a particular object could not be serialized.
Instance Variable cooked Undocumented
Instance Variable cooker Undocumented
Instance Variable invoker Undocumented
Instance Variable persistentStore Undocumented
Instance Variable preserved Undocumented
Instance Variable taster Undocumented
Method _checkMutable Undocumented
Method _cook (internal) Backreference an object.
Method _jellyIterable Jelly an iterable object.
Instance Variable _ref_id Undocumented
def __init__(self, taster, persistentStore, invoker): (source)

Initialize.

def jelly(self, obj): (source)

Undocumented

def jelly_decimal(self, d): (source)

Jelly a decimal object.

Parameters
d:decimal.Decimala decimal object to serialize.
Returns
listjelly for the decimal object.
def prepare(self, object): (source)

(internal) Create a list for persisting an object to. This will allow backreferences to be made internal to the object. (circular references).

The reason this needs to happen is that we don't generate an ID for every object, so we won't necessarily know which ID the object will have in the future. When it is 'cooked' ( see _cook ), it will be assigned an ID, and the temporary placeholder list created here will be modified in-place to create an expression that gives this object an ID: [reference id# [object-jelly]].

def preserve(self, object, sexp): (source)

(internal) Mark an object's persistent list for later referral.

def unpersistable(self, reason, sxp=None): (source)

(internal) Returns an sexp: (unpersistable "reason"). Utility method for making note that a particular object could not be serialized.

Undocumented

Undocumented

Undocumented

persistentStore = (source)

Undocumented

preserved: dict = (source)

Undocumented

Undocumented

def _checkMutable(self, obj): (source)

Undocumented

def _cook(self, object): (source)

(internal) Backreference an object.

Notes on this method for the hapless future maintainer: If I've already gone through the prepare/preserve cycle on the specified object (it is being referenced after the serializer is "done with" it, e.g. this reference is NOT circular), the copy-in-place of aList is relevant, since the list being modified is the actual, pre-existing jelly expression that was returned for that object. If not, it's technically superfluous, since the value in self.preserved didn't need to be set, but the invariant that self.preserved[id(object)] is a list is convenient because that means we don't have to test and create it or not create it here, creating fewer code-paths. that's why self.preserved is always set to a list.

Sorry that this code is so hard to follow, but Python objects are tricky to persist correctly. -glyph

def _jellyIterable(self, atom, obj): (source)

Jelly an iterable object.

Parameters
atom:strthe identifier atom of the object.
obj:iterableany iterable object.
Returns
generatora generator of jellied data.

Undocumented