module documentation
(source)

S-expression-based persistence of python objects.

It does something very much like Pickle; however, pickle's main goal seems to be efficiency (both in space and time); jelly's main goals are security, human readability, and portability to other environments.

This is how Jelly converts various objects to s-expressions.

Boolean:

    True --> ['boolean', 'true']

Integer:

    1 --> 1

List:

    [1, 2] --> ['list', 1, 2]

String:

    "hello" --> "hello"

Float:

    2.3 --> 2.3

Dictionary:

    {'a': 1, 'b': 'c'} --> ['dictionary', ['b', 'c'], ['a', 1]]

Module:

    UserString --> ['module', 'UserString']

Class:

    UserString.UserString --> ['class', ['module', 'UserString'], 'UserString']

Function:

    string.join --> ['function', 'join', ['module', 'string']]

Instance: s is an instance of UserString.UserString, with a __dict__ {'data': 'hello'}:

    ["UserString.UserString", ['dictionary', ['data', 'hello']]]

Class Method: UserString.UserString.center:

    ['method', 'center', ['None'], ['class', ['module', 'UserString'],
     'UserString']]

Instance Method: s.center, where s is an instance of UserString.UserString:

    ['method', 'center', ['instance', ['reference', 1, ['class',
    ['module', 'UserString'], 'UserString']], ['dictionary', ['data', 'd']]],
    ['dereference', 1]]

The set builtin and the sets.Set class are serialized to the same thing, and unserialized to set if available, else to sets.Set. It means that there's a possibility of type switching in the serialization process. The solution is to always use set.

The same rule applies for frozenset and sets.ImmutableSet.

Author
Glyph Lefkowitz
Class ​Dummy​Security​Options DummySecurityOptions() -> insecure security options Dummy security options -- this class will allow anything.
Class ​Insecure​Jelly This exception will be raised when a jelly is deemed `insecure'; e.g. it contains a type, class, or module disallowed by the specified `taster'
Class ​Security​Options This will by default disallow everything, except for 'none'.
Class ​Unjellyable Inherit from me to Unjelly yourself directly with the setStateFor convenience method.
Class ​Unpersistable This is an instance of a class that comes back when something couldn't be unpersisted.
Function get​Instance​State Utility method to default to 'normal' state rules in serialization.
Function jelly Serialize to s-expression.
Function set​Instance​State Utility method to default to 'normal' state rules in unserialization.
Function unjelly Unserialize from s-expression.
Variable class​_atom Undocumented
Variable dereference​_atom Undocumented
Variable dictionary​_atom Undocumented
Variable ​Dict​Types Undocumented
Variable frozenset​_atom Undocumented
Variable function​_atom Undocumented
Variable global​Security Undocumented
Variable instance​_atom Undocumented
Variable list​_atom Undocumented
Variable module​_atom Undocumented
Variable ​None_atom Undocumented
Variable persistent​_atom Undocumented
Variable reference​_atom Undocumented
Variable set​_atom Undocumented
Variable tuple​_atom Undocumented
Variable unjellyable​Factory​Registry Undocumented
Variable unpersistable​_atom Undocumented
Class _​Jellier (Internal) This class manages state for a call to jelly()
Class _​Unjellier No class docstring; 0/5 instance variable, 8/29 methods documented
Function _create​Blank Given an object, if that object is a type, return a new, blank instance of that type which has not had __init__ called on it. If the object is not a type, return None.
Function _maybe​Class Undocumented
Function _new​Instance Make a new instance of a class without calling its __init__ method.
Variable _​Immutable​Set​Types Undocumented
Variable _sets Undocumented
Variable _​Set​Types Undocumented
def getInstanceState(inst, jellier): (source)
Utility method to default to 'normal' state rules in serialization.
def jelly(object, taster=DummySecurityOptions(), persistentStore=None, invoker=None): (source)

Serialize to s-expression.

Returns a list which is the serialized representation of an object. An optional 'taster' argument takes a SecurityOptions and will mark any insecure objects as unpersistable rather than serializing them.

def setInstanceState(inst, unjellier, jellyList): (source)
Utility method to default to 'normal' state rules in unserialization.
def unjelly(sexp, taster=DummySecurityOptions(), persistentLoad=None, invoker=None): (source)

Unserialize from s-expression.

Takes a list that was the result from a call to jelly() and unserializes an arbitrary object from it. The optional 'taster' argument, an instance of SecurityOptions, will cause an InsecureJelly exception to be raised if a disallowed type, module, or class attempted to unserialize.

class_atom: bytes = (source)

Undocumented

dereference_atom: bytes = (source)

Undocumented

dictionary_atom: bytes = (source)

Undocumented

DictTypes = (source)

Undocumented

frozenset_atom: bytes = (source)

Undocumented

function_atom: bytes = (source)

Undocumented

globalSecurity = (source)

Undocumented

instance_atom: bytes = (source)

Undocumented

list_atom: bytes = (source)

Undocumented

module_atom: bytes = (source)

Undocumented

None_atom: bytes = (source)

Undocumented

persistent_atom: bytes = (source)

Undocumented

reference_atom: bytes = (source)

Undocumented

set_atom: bytes = (source)

Undocumented

tuple_atom: bytes = (source)

Undocumented

unjellyableFactoryRegistry: dict = (source)

Undocumented

unpersistable_atom: bytes = (source)

Undocumented

def _createBlank(cls): (source)
Given an object, if that object is a type, return a new, blank instance of that type which has not had __init__ called on it. If the object is not a type, return None.
Parameters
cls:type or something else that cannot be instantiated.The type (or class) to create an instance of.
Returns
a new blank instance or None if cls is not a class or type.
def _maybeClass(classnamep): (source)

Undocumented

def _newInstance(cls, state): (source)
Make a new instance of a class without calling its __init__ method.
Parameters
stateA dict used to update inst.__dict__ either directly or via __setstate__, if available.
Returns
A new instance of cls.
_ImmutableSetTypes = (source)

Undocumented

_sets = (source)

Undocumented

_SetTypes = (source)

Undocumented