�
Ϫ�f�� � �| � d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z ddl
mZ ddlm
Z
mZmZmZmZmZ ddlmZ ddlmZ dd lmZmZmZ dd
lmZmZ efZdZ dZ!d
Z"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ, e edddd� ddd� dZ-i a.i a/d� Z0d� Z1d � Z2d!� Z3d"� Z4d8d#�Z5d$� Z6d%� Z7 G d&� d'� Z8 e e� G d(� d)� � Z9 e e� G d*� d+� � Z: G d,� d-� Z; G d.� d/� Z< G d0� d1e=� Z> G d2� d3� Z? G d4� d5� Z@ e@� ZAeAj� � e?� ddfd6�ZC e?� ddfd7�ZDy)9aM
S-expression-based persistence of python objects.
It does something very much like L{Pickle<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 Python 2.x C{sets.Set} and C{sets.ImmutableSet} classes are
serialized to the same thing as the builtin C{set} and C{frozenset}
classes. (This is only relevant if you are communicating with a
version of jelly running on an older version of Python.)
@author: Glyph Lefkowitz
� N)�reduce)�implementer)�Version)�NotKnown�
_Container�_Dereference�_DictKeyAndValue�_InstanceMethod�_Tuple)�nativeString)�deprecatedModuleAttribute)�namedAny�namedObject�qual)�
IJellyable�IUnjellyable� None� class� module� functions dereferences
persistents references
dictionarys list� sets tuples instance� frozenset�Twisted� z'instance_atom is unused within Twisted.ztwisted.spread.jelly�
instance_atoms
unpersistablec �F � t | t � r| j | � S y)a�
Given an object, if that object is a type, return a new, blank instance
of that type which has not had C{__init__} called on it. If the object
is not a type, return L{None}.
@param cls: The type (or class) to create an instance of.
@type cls: L{type} or something else that cannot be
instantiated.
@return: a new blank instance or L{None} if C{cls} is not a class or type.
N)�
isinstance�type�__new__)�clss �6/usr/lib/python3/dist-packages/twisted/spread/jelly.py�_createBlankr" |