Ë
    oj‡Š  ã                   ó|  — d Z ddlZddlZddlZddlZddlZddlmZ ddlm	Z	 ddl
mZ ddlmZmZmZmZmZmZ ddlmZ ddlmZ dd	lmZmZmZ dd
lmZmZ efZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ, e edddd«      ddd«       dZ-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?«       ddfd6„ZC e?«       ddfd7„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.ztwisted.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"   �   s"   € ô �#”tÔØ�{‰{˜3ÓÐð ó    c                 óR   ‡— t        | «      Šˆfd„}t        ‰d|«      } ||«       ‰S )zð
    Make a new instance of a class without calling its __init__ method.

    @param state: A C{dict} used to update C{inst.__dict__} either directly or
        via C{__setstate__}, if available.

    @return: A new instance of C{cls}.
    c                 ó>   •— t        | t        «      r| xs i ‰_        y y ©N)r   ÚdictÚ__dict__)ÚstateÚinstances    €r!   ÚdefaultSetterz#_newInstance.<locals>.defaultSetterœ   s   ø€ Ü�eœTÔ"Ø %¢¨ˆHÕð #r#   Ú__setstate__)r"   Úgetattr)r    r)   r+   Úsetterr*   s       @r!   Ú_newInstancer/   ‘   s0   ø€ ô ˜CÓ €Hô,ô �X˜~¨}Ó=€FÙ
ˆ5„MØ€Or#   c                 ó‚   — t        | t        «      }|rt        | «      } t        | t        «      s| j	                  d«      } | S )Núutf-8)r   r   r   ÚbytesÚencode)Ú
classnamepÚisObjects     r!   Ú_maybeClassr6   ¥   s;   € Ü˜*¤dÓ+€HáÜ˜*Ó%ˆ
ä�j¤%Ô(Ø×&Ñ& wÓ/ˆ
àÐr#   c                 óV   — t        | «      } |t        | <   t        j                  | «       y)at  
    Set which local class will represent a remote type.

    If you have written a Copyable class that you expect your client to be
    receiving, write a local "copy" class to represent it, then call::

        jellier.setUnjellyableForClass('module.package.Class', MyCopier).

    Call this at the module level immediately after its class
    definition. MyCopier should be a subclass of RemoteCopy.

    The classname may be a special tag returned by
    'Copyable.getTypeToCopyFor' rather than an actual classname.

    This call is also for cached classes, since there will be no
    overlap.  The rules are the same.
    N)r6   ÚunjellyableRegistryÚglobalSecurityÚ
allowTypes)Ú	classnameÚunjellyables     r!   ÚsetUnjellyableForClassr=   ±   s'   € ô( ˜IÓ&€IØ%0Ô˜	Ñ"Ü×Ñ˜iÕ(r#   c                 óV   — t        | «      } |t        | <   t        j                  | «       y)a¥  
    Set the factory to construct a remote instance of a type::

      jellier.setUnjellyableFactoryForClass('module.package.Class', MyFactory)

    Call this at the module level immediately after its class definition.
    C{copyFactory} should return an instance or subclass of
    L{RemoteCopy<pb.RemoteCopy>}.

    Similar to L{setUnjellyableForClass} except it uses a factory instead
    of creating an instance.
    N)r6   ÚunjellyableFactoryRegistryr9   r:   )r;   ÚcopyFactorys     r!   ÚsetUnjellyableFactoryForClassrA   Ê   s'   € ô ˜IÓ&€IØ,7Ô˜yÑ)Ü×Ñ˜iÕ(r#   c                 óÄ   — |€| j                   }|rd|z  }t        | «      D ].  }t        | |«      }	 t        ||«      }|sŒt	        |› |› �|«       Œ0 y# t
        $ r Y Œ=w xY w)aÌ  
    Set all classes in a module derived from C{baseClass} as copiers for
    a corresponding remote class.

    When you have a hierarchy of Copyable (or Cacheable) classes on one
    side, and a mirror structure of Copied (or RemoteCache) classes on the
    other, use this to setUnjellyableForClass all your Copieds for the
    Copyables.

    Each copyTag (the "classname" argument to getTypeToCopyFor, and
    what the Copyable's getTypeToCopyFor returns) is formed from
    adding a prefix to the Copied's class name.  The prefix defaults
    to module.__name__.  If you wish the copy tag to consist of solely
    the classname, pass the empty string ''.

    @param module: a module object from which to pull the Copied classes.
        (passing sys.modules[__name__] might be useful)

    @param baseClass: the base class from which all your Copied classes derive.

    @param prefix: the string prefixed to classnames to form the
        unjellyableRegistry.
    Nz%s.)Ú__name__Údirr-   Ú
issubclassr=   Ú	TypeError)ÚmoduleÚ	baseClassÚprefixÚnameÚloadedÚyess         r!   ÚsetUnjellyableForClassTreerM   Þ   s}   € ð0 €~Ø—‘ˆáØ˜‘ˆä�F“ò BˆÜ˜ Ó&ˆð	BÜ˜V YÓ/ˆCò Ü&¨&¨°$°Ð'8¸&ÕAñBøô ò 	 Ùð	 ús   ±AÁ	AÁAc                 ó"  — t        | d«      r| j                  «       }n| j                  }|j                  | «      }|j	                  t        | j                  «      j                  d«      |j                  |«      g«       |j                  | |«      S )zM
    Utility method to default to 'normal' state rules in serialization.
    Ú__getstate__r1   )
ÚhasattrrO   r(   ÚprepareÚextendr   Ú	__class__r3   ÚjellyÚpreserve)ÚinstÚjellierr)   Úsxps       r!   ÚgetInstanceStaterY     st   € ô ˆt�^Ô$Ø×!Ñ!Ó#‰à—‘ˆØ
�/‰/˜$Ó
€CØ‡J�J”�T—^‘^Ó$×+Ñ+¨GÓ4°g·m±mÀEÓ6JÐKÔLØ×Ñ˜D #Ó&Ð&r#   c                 óz   — |j                  |d   «      }t        | d«      r| j                  |«       | S || _        | S )zO
    Utility method to default to 'normal' state rules in unserialization.
    é   r,   )ÚunjellyrP   r,   r(   )rV   Ú	unjellierÚ	jellyListr)   s       r!   ÚsetInstanceStater_     sE   € ð ×Ñ˜i¨™lÓ+€EÜˆt�^Ô$Ø×Ñ˜%Ô ð €Kð ˆŒØ€Kr#   c                   ó"   — e Zd ZdZd„ Zdefd„Zy)ÚUnpersistablezd
    This is an instance of a class that comes back when something couldn't be
    unpersisted.
    c                 ó   — || _         y)zY
        Initialize an unpersistable object with a descriptive C{reason} string.
        N)Úreason)Úselfrc   s     r!   Ú__init__zUnpersistable.__init__&  s   € ð ˆ�r#   Úreturnc                 ó2   — dt        | j                  «      z  S )NzUnpersistable(%s))Úreprrc   ©rd   s    r!   Ú__repr__zUnpersistable.__repr__,  s   € Ø"¤T¨$¯+©+Ó%6Ñ6Ð6r#   N)rC   Ú
__module__Ú__qualname__Ú__doc__re   Ústrrj   © r#   r!   ra   ra      s   „ ñò
ð7˜#ô 7r#   ra   c                   ó   — e Zd ZdZd„ Zd„ Zy)Ú	Jellyablezc
    Inherit from me to Jelly yourself directly with the `getStateFor'
    convenience method.
    c                 ó   — | j                   S r&   ©r(   )rd   rW   s     r!   ÚgetStateForzJellyable.getStateFor7  s   € Ø�}‰}Ðr#   c                 óî   — |j                  | «      }|j                  t        | j                  «      j	                  d«      |j                  | j                  |«      «      g«       |j                  | |«      S )zH
        @see: L{twisted.spread.interfaces.IJellyable.jellyFor}
        r1   )rQ   rR   r   rS   r3   rT   rt   rU   )rd   rW   rX   s      r!   ÚjellyForzJellyable.jellyFor:  sf   € ð �o‰o˜dÓ#ˆØ�
‰
ä�T—^‘^Ó$×+Ñ+¨GÓ4Ø—‘˜d×.Ñ.¨wÓ7Ó8ðô	
ð ×Ñ  cÓ*Ð*r#   N)rC   rk   rl   rm   rt   rv   ro   r#   r!   rq   rq   0  s   „ ñò
ó+r#   rq   c                   ó   — e Zd ZdZd„ Zd„ Zy)ÚUnjellyablezf
    Inherit from me to Unjelly yourself directly with the
    C{setStateFor} convenience method.
    c                 ó   — || _         y r&   rs   )rd   r]   r)   s      r!   ÚsetStateForzUnjellyable.setStateForO  s	   € Øˆ�r#   c                 óR   — |j                  |d   «      }| j                  ||«       | S )z�
        Perform the inverse operation of L{Jellyable.jellyFor}.

        @see: L{twisted.spread.interfaces.IUnjellyable.unjellyFor}
        r[   )r\   rz   )rd   r]   r^   r)   s       r!   Ú
unjellyForzUnjellyable.unjellyForR  s-   € ð ×!Ñ! )¨A¡,Ó/ˆØ×Ñ˜ EÔ*Øˆr#   N)rC   rk   rl   rm   rz   r|   ro   r#   r!   rx   rx   H  s   „ ñò
ór#   rx   c                   óH   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zdd„Zy
)Ú_JellierzC
    (Internal) This class manages state for a call to jelly()
    c                 óf   — || _         i | _        i | _        i | _        d| _        || _        || _        y)z
        Initialize.
        r[   N)ÚtasterÚ	preservedÚcookedÚcookerÚ_ref_idÚpersistentStoreÚinvoker)rd   r€   r…   r†   s       r!   re   z_Jellier.__init__b  s8   € ð ˆŒàˆŒð ˆŒØˆŒØˆŒØ.ˆÔØˆ�r#   c                 óô   — | j                   t        |«         }t        j                  |«      }| j                  }| j                  dz   | _        t        ||g|dd t
        |g| j                  t        |«      <   |S )aÏ  
        (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
        r[   N)r�   ÚidÚcopyr„   Úreference_atomÚdereference_atomr‚   )rd   ÚobjectÚaListÚnewListÚrefids        r!   Ú_cookz_Jellier._cookq  sk   € ð& —‘œr &›zÑ*ˆÜ—)‘)˜EÓ"ˆà—‘ˆØ—|‘| aÑ'ˆŒô # E¨7Ð3ˆ‰aˆÜ#3°UÐ";ˆ�‰”B�v“JÑØˆr#   c                 óf   — g | j                   t        |«      <   || j                  t        |«      <   g S )a]  
        (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]].
        )r�   rˆ   rƒ   )rd   rŒ   s     r!   rQ   z_Jellier.prepare�  s/   € ð &(ˆ�‰”r˜&“zÑ"ð #)ˆ�‰”B�v“JÑØˆ	r#   c                 óÎ   — t        |«      | j                  v r5|| j                  t        |«         d<   | j                  t        |«         }|S || j                  t        |«      <   |S )zQ
        (internal) Mark an object's persistent list for later referral.
        é   )rˆ   r‚   r�   )rd   rŒ   Úsexps      r!   rU   z_Jellier.preserve§  s]   € ô
 ˆf‹:˜Ÿ™Ñ$à,0ˆD�N‰Nœ2˜f›:Ñ& qÑ)à—>‘>¤" V£*Ñ-ˆDð ˆð *.ˆD�N‰Nœ2˜f›:Ñ&Øˆr#   c                 ó°   — t        |«      }|| j                  v r| j                  |   S || j                  v r | j                  |«       | j                  |   S y r&   )rˆ   r‚   r�   r�   )rd   ÚobjÚobjIds      r!   Ú_checkMutablez_Jellier._checkMutableµ  sQ   € Ü�3“ˆØ�D—K‘KÑØ—;‘;˜uÑ%Ð%Ø�D—N‘NÑ"Ø�J‰J�sŒOØ—;‘;˜uÑ%Ð%ð #r#   c           
      ó0  — t        |t        «      r&| j                  |«      }|r|S |j                  | «      S t	        |«      }| j
                  j                  t        |«      j                  d«      «      �rý|t        t        t        fv r|S t        |t        j                  «      rR|j                  }|j                  }|j                   }d|j"                  | j%                  |«      | j%                  |«      gS |t&        u rd|j                  d«      gS t        |t	        d «      «      rdgS t        |t        j(                  «      rd|j*                  dz   |j,                  z   gS t        |t        j.                  «      rd|j"                  gS |t0        u rd	|xr d
xs dgS |t2        j2                  u r�|j4                  rt7        d«      ‚ddj9                  |j:                  |j<                  |j>                  |j@                  |jB                  |jD                  |jF                  fD �cg c]  }t'        |«      ‘Œ c}«      j                  d«      gS |t2        jH                  u r||j4                  rt7        d«      ‚ddj9                  |j@                  |jB                  |jD                  |jF                  fD �cg c]  }t'        |«      ‘Œ c}«      j                  d«      gS |t2        jJ                  u rZddj9                  |j:                  |j<                  |j>                  fD �cg c]  }t'        |«      ‘Œ c}«      j                  d«      gS |t2        jL                  u rZddj9                  |jN                  |jP                  |jR                  fD �cg c]  }t'        |«      ‘Œ c}«      j                  d«      gS tU        |t        «      rdt        |«      j                  d«      gS |tV        jX                  u r| j[                  |«      S | j                  |«      }|r|S | j]                  |«      }|t^        u r'|ja                  | jc                  td        |«      «       �n
|tf        u r'|ja                  | jc                  th        |«      «       �nÛ|tj        v r`|jm                  tn        «       |jq                  «       D ]6  \  }	}
|jm                  | j%                  |	«      | j%                  |
«      g«       Œ8 �ns|tr        u r'|ja                  | jc                  tt        |«      «       �nD|tv        u r'|ja                  | jc                  tx        |«      «       �nt        |j                   «      j                  d«      }d }| jz                  r| j{                  || «      }|�'|jm                  t|        «       |jm                  |«       n¨| j
                  j                  |j                   «      r[|jm                  |«       t�        |d«      r|jƒ                  «       }n|j„                  }|jm                  | j%                  |«      «       n(| j‡                  dt        |j                   «      z  |«       | j‰                  ||«      S t‹        d|› d|› �«      ‚c c}w c c}w c c}w c c}w )Nr1   s   methodó   unicodeúUTF-8r   r   ú.r   ó   booleanó   trueó   falsez2Currently can't jelly datetime objects with tzinfoó   datetimeú ó   timeó   dateó	   timedeltar   rO   z$instance of class %s deemed insecurezType not allowed for object: )Fr   rq   r˜   rv   r   r€   ÚisTypeAllowedr   r3   r2   ÚintÚfloatÚtypesÚ
MethodTypeÚ__self__Ú__func__rS   rC   rT   rn   ÚFunctionTyperk   rl   Ú
ModuleTypeÚboolÚdatetimeÚtzinfoÚNotImplementedErrorÚjoinÚyearÚmonthÚdayÚhourÚminuteÚsecondÚmicrosecondÚtimeÚdateÚ	timedeltaÚdaysÚsecondsÚmicrosecondsrE   ÚdecimalÚDecimalÚjelly_decimalrQ   ÚlistrR   Ú_jellyIterableÚ	list_atomÚtupleÚ
tuple_atomÚ	DictTypesÚappendÚdictionary_atomÚitemsÚsetÚset_atomÚ	frozensetÚfrozenset_atomr…   Úpersistent_atomÚisClassAllowedrP   rO   r(   ÚunpersistablerU   ÚInsecureJelly)rd   r–   ÚpreRefÚobjTypeÚaSelfÚaFuncÚaClassÚxrX   ÚkeyÚvalÚ	classNameÚ
persistentr)   s                 r!   rT   z_Jellier.jelly½  s€  € Ü�cœ9Ô%Ø×'Ñ'¨Ó,ˆFÙØ�Ø—<‘< Ó%Ð%Ü�s“)ˆØ�;‰;×$Ñ$¤T¨'£]×%9Ñ%9¸'Ó%BÕCàœ5¤#¤uÐ-Ñ-Ø�
Ü˜C¤×!1Ñ!1Ô2ØŸ™�ØŸ™�ØŸ™�àØ—N‘NØ—J‘J˜uÓ%Ø—J‘J˜vÓ&ð	ð ð œC‘Ø" C§J¡J¨wÓ$7Ð8Ð8Ü˜C¤ d£Ô,Ø�yÐ Ü˜C¤×!3Ñ!3Ô4Ø# S§^¡^°cÑ%9¸C×<LÑ<LÑ%LÐMÐMÜ˜C¤×!1Ñ!1Ô2Ø! 3§<¡<Ð0Ð0ØœD‘Ø" C¢O¨GÒ$?°xÐ@Ð@ØœH×-Ñ-Ñ-Ø—:’:Ü-ØLóð ð  Ø—H‘Hð !$§¡Ø #§	¡	Ø #§¡Ø #§¡Ø #§
¡
Ø #§
¡
Ø #§¡ð&öà !ô   �Fòó÷ ‘f˜W“oðð ð" œHŸM™MÑ)Ø—:’:Ü-ØLóð ð Ø—H‘Hð '*§h¡h°·
±
¸C¿J¹JÈÏÉÐ%Xöà !ô   �Fòó÷
 ‘f˜W“oðð ð œHŸM™MÑ)àØ—H‘H¨s¯x©x¸¿¹ÀCÇGÁGÐ.LÖM¨œc !�fÒMÓN×UÑUØóðð ð œH×.Ñ.Ñ.à Ø—H‘HØ*-¯(©(°C·K±KÀ×AQÑAQÐ)RÖS Aœ˜Q�ÒSóç‘f˜W“oð	ð ô ˜G¤TÔ*Ø ¤$ s£)×"2Ñ"2°7Ó";Ð<Ð<ØœGŸO™OÑ+Ø×)Ñ)¨#Ó.Ð.à×+Ñ+¨CÓ0�ÙØ!�Mà—l‘l 3Ó'�Øœd‘?Ø—J‘J˜t×2Ñ2´9¸cÓBÖCØ¤Ñ%Ø—J‘J˜t×2Ñ2´:¸sÓCÖDØ¤	Ñ)Ø—J‘JœÔ/Ø$'§I¡I£Kò G™˜˜SØŸ
™
 D§J¡J¨s£O°T·Z±ZÀ³_Ð#EÕFòGà¤‘^Ø—J‘J˜t×2Ñ2´8¸SÓAÖBØ¤	Ñ)Ø—J‘J˜t×2Ñ2´>À3ÓGÖHä $ S§]¡]Ó 3× :Ñ :¸7Ó C�IØ!%�JØ×+Ò+Ø%)×%9Ñ%9¸#¸tÓ%D˜
Ø!Ð-ØŸ
™
¤?Ô3ØŸ
™
 :Õ.ØŸ™×3Ñ3°C·M±MÔBØŸ
™
 9Ô-Ü" 3¨Ô7Ø$'×$4Ñ$4Ó$6™Eà$'§L¡L˜EØŸ
™
 4§:¡:¨eÓ#4Õ5à×*Ñ*ØBÜ" 3§=¡=Ó1ñ2àôð
 —}‘} S¨#Ó.Ð.äÐ"?À¸yÈÈ#ÈÐ OÓPÐPùòoùò,ùò Nùò Ts   È$Z
Ê2Z	
ÌZ
Î
Z
c              #   óH   K  — |–— |D ]  }| j                  |«      –— Œ y­w)a  
        Jelly an iterable object.

        @param atom: the identifier atom of the object.
        @type atom: C{str}

        @param obj: any iterable object.
        @type obj: C{iterable}

        @return: a generator of jellied data.
        @rtype: C{generator}
        N)rT   )rd   Úatomr–   Úitems       r!   rÄ   z_Jellier._jellyIterable=  s+   è ø€ ð Š
Øò 	#ˆDØ—*‘*˜TÓ"Ó"ñ	#ùs   ‚ "c                 óX   — |j                  «       \  }}}t        d„ |«      }|r| }d||gS )zÇ
        Jelly a decimal object.

        @param d: a decimal object to serialize.
        @type d: C{decimal.Decimal}

        @return: jelly for the decimal object.
        @rtype: C{list}
        c                 ó   — | dz  |z   S )Né
   ro   )ÚleftÚrights     r!   ú<lambda>z(_Jellier.jelly_decimal.<locals>.<lambda>Y  s   € ¨4°"©9°uÑ+<€ r#   ó   decimal)Úas_tupler   )rd   ÚdÚsignÚgutsÚexponentÚvalues         r!   rÂ   z_Jellier.jelly_decimalN  s:   € ð  !Ÿz™z›|Ñˆˆd�HÜÑ<¸dÓCˆÙØ�FˆEØ˜E 8Ð,Ð,r#   Nc                 óœ   — |€g }|j                  t        «       t        |t        «      r|j	                  d«      }|j                  |«       |S )z¡
        (internal) Returns an sexp: (unpersistable "reason").  Utility method
        for making note that a particular object could not be serialized.
        r1   )rÉ   Úunpersistable_atomr   rn   r3   )rd   rc   rX   s      r!   rÒ   z_Jellier.unpersistable^  sD   € ð
 ˆ;ØˆCØ�
‰
Ô%Ô&Ü�fœcÔ"Ø—]‘] 7Ó+ˆFØ�
‰
�6ÔØˆ
r#   r&   )rC   rk   rl   rm   re   r�   rQ   rU   r˜   rT   rÄ   rÂ   rÒ   ro   r#   r!   r~   r~   ]  s7   „ ñòòò<ò0ò&ò~Qò@#ò"-ô r#   r~   c                   óº   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zy)Ú
_Unjellierc                 óJ   — || _         || _        i | _        g | _        || _        y r&   )r€   ÚpersistentLoadÚ
referencesÚpostCallbacksr†   )rd   r€   ró   r†   s       r!   re   z_Unjellier.__init__m  s'   € ØˆŒØ,ˆÔØˆŒØˆÔØˆ�r#   c                 óX   — | j                  |«      }| j                  D ]	  } |«        Œ |S r&   )r\   rõ   )rd   r–   ÚoÚms       r!   ÚunjellyFullz_Unjellier.unjellyFullt  s/   € Ø�L‰L˜ÓˆØ×#Ñ#ò 	ˆAÙ�Cð	àˆr#   c                 óh   — t        |d«      r%| j                  j                  |j                  «       |S )zñ
        If the given object has support for the C{postUnjelly} hook, set it up
        to be called at the end of deserialization.

        @param unjellied: an object that has already been unjellied.

        @return: C{unjellied}
        ÚpostUnjelly)rP   rõ   rÉ   rû   )rd   Ú	unjellieds     r!   Ú_maybePostUnjellyz_Unjellier._maybePostUnjellyz  s.   € ô �9˜mÔ,Ø×Ñ×%Ñ% i×&;Ñ&;Ô<ØÐr#   c                 ó  — t        |«      t        ur|S |d   }| j                  j                  |«      st	        |«      ‚t
        j                  |«      }|�.t        t        |«      d|«      }| j                   || |«      «      S t        j                  |«      }|�)| j                   || j                  |d   «      «      «      S t        |«      }t        | d|z  d «      }|� ||dd  «      S |j                  d«      }dj                  |d d «      }	| j                  j                  |	«      st	        d|	› d|› d	�«      ‚t!        |«      }
| j                  j#                  |
«      st	        d
|z  «      ‚| j%                  |
|d   «      S )Nr   r|   r[   z_unjelly_%srœ   éÿÿÿÿzModule z not allowed (in type z).zClass %s not allowed.)r   rÃ   r€   r¥   rÓ   r8   Úgetr-   r"   rý   r?   r\   r   Úsplitr²   ÚisModuleAllowedr   rÑ   Ú_genericUnjelly)rd   r–   ÚjelTypeBytesÚregClassÚmethodÚ
regFactoryÚjelTypeTextÚthunkÚ	nameSplitÚmodNameÚclzs              r!   r\   z_Unjellier.unjelly‡  s‚  € Ü�‹9œDÑ ØˆJØ˜1‘vˆØ�{‰{×(Ñ(¨Ô6Ü Ó-Ð-Ü&×*Ñ*¨<Ó8ˆØÐÜœ\¨(Ó3°\À8ÓLˆFØ×)Ñ)©&°°sÓ*;Ó<Ð<Ü/×3Ñ3°LÓAˆ
ØÐ!Ø×)Ñ)©*°T·\±\À#ÀaÁ&Ó5IÓ*JÓKÐKä" <Ó0ˆÜ˜˜m¨kÑ9¸4Ó@ˆØÐÙ˜˜Q˜R˜“>Ð!à#×)Ñ)¨#Ó.ˆIØ—h‘h˜y¨¨"˜~Ó.ˆGØ—;‘;×.Ñ.¨wÔ7Ü#Ø˜g˜YÐ&<¸[¸MÈÐLóð ô ˜kÓ*ˆCØ—;‘;×-Ñ-¨cÔ2Ü#Ð$;¸kÑ$IÓJÐJØ×'Ñ'¨¨S°©VÓ4Ð4r#   c                 óV   — | j                  t        || j                  |«      «      «      S )aÎ  
        Unjelly a type for which no specific unjellier is registered, but which
        is nonetheless allowed.

        @param cls: the class of the instance we are unjellying.
        @type cls: L{type}

        @param state: The jellied representation of the object's state; its
            C{__dict__} unless it has a C{__setstate__} that takes something
            else.
        @type state: L{list}

        @return: the new, unjellied instance.
        )rý   r/   r\   )rd   r    r)   s      r!   r  z_Unjellier._genericUnjelly¥  s%   € ð ×%Ñ%¤l°3¸¿¹ÀUÓ8KÓ&LÓMÐMr#   c                  ó   — y r&   ro   ©rd   Úexps     r!   Ú_unjelly_Nonez_Unjellier._unjelly_None¶  s   € Ør#   c                 ó    — t        |d   d«      S )Nr   r›   )rn   r  s     r!   Ú_unjelly_unicodez_Unjellier._unjelly_unicode¹  s   € Ü�3�q‘6˜7Ó#Ð#r#   c                 ó¦   — |d   }|d   }|dk  rd}nd}t        j                  |«      j                  «       d   }t        j                  |||f«      S )z*
        Unjelly decimal objects.
        r   r[   )rÀ   rÁ   rè   )rd   r  rí   rì   rê   rë   s         r!   Ú_unjelly_decimalz_Unjellier._unjelly_decimal¼  sY   € ð �A‘ˆØ�q‘6ˆØ�1Š9Ø‰DàˆDÜ�‰˜uÓ%×.Ñ.Ó0°Ñ3ˆÜ�‰  d¨HÐ5Ó6Ð6r#   c                 ó$   — |d   dv sJ ‚|d   dk(  S )Nr   )rž   rŸ   rž   ro   r  s     r!   Ú_unjelly_booleanz_Unjellier._unjelly_booleanÉ  s$   € Ø�1‰vÐ,Ñ,Ð,Ð,Ø�1‰v˜Ñ Ð r#   c                 ód   — t        j                   t        t        |d   j                  «       «      Ž S ©Nr   )r¯   Úmapr¦   r  r  s     r!   Ú_unjelly_datetimez_Unjellier._unjelly_datetimeÍ  s$   € Ü× Ñ ¤#¤c¨3¨q©6¯<©<«>Ó":Ð;Ð;r#   c                 ód   — t        j                  t        t        |d   j	                  «       «      Ž S r  )r¯   r»   r  r¦   r  r  s     r!   Ú_unjelly_datez_Unjellier._unjelly_dateÐ  ó"   € Ü�}‰}œc¤# s¨1¡v§|¡|£~Ó6Ð7Ð7r#   c                 ód   — t        j                  t        t        |d   j	                  «       «      Ž S r  )r¯   rº   r  r¦   r  r  s     r!   Ú_unjelly_timez_Unjellier._unjelly_timeÓ  r  r#   c                 ó|   — t        t        |d   j                  «       «      \  }}}t        j                  |||¬«      S )Nr   )r½   r¾   r¿   )r  r¦   r  r¯   r¼   )rd   r  r½   r¾   r¿   s        r!   Ú_unjelly_timedeltaz_Unjellier._unjelly_timedeltaÖ  s4   € Ü&)¬#¨s°1©v¯|©|«~Ó&>Ñ#ˆˆg�|Ü×!Ñ! t°WÈ<ÔXÐXr#   c                 óv   — | j                  |«      }t        |t        «      r|j                  ||«       |||<   |S r&   )r\   r   r   ÚaddDependant)rd   r–   ÚlocÚjelr÷   s        r!   ÚunjellyIntoz_Unjellier.unjellyIntoÚ  s6   € Ø�L‰L˜ÓˆÜ�aœÔ"Ø�N‰N˜3 Ô$ØˆˆC‰Øˆr#   c                 ó‚   — |d   }| j                   j                  |«      }|�|S t        |«      }|| j                   |<   |S r  )rô   r   r   )rd   Úlstr�   rÙ   Úders        r!   Ú_unjelly_dereferencez_Unjellier._unjelly_dereferenceá  sF   € Ø�A‘ˆØ�O‰O×Ñ Ó&ˆØˆ=ØˆHÜ˜5Ó!ˆØ!$ˆ�‰˜ÑØˆ
r#   c                 ó  — |d   }|d   }| j                  |«      }| j                  j                  |«      }|€|| j                  |<   |S t        |t        «      r"|j                  |«       || j                  |<   |S J d«       ‚)Nr   r[   z!Multiple references with same ID!)r\   rô   r   r   r   ÚresolveDependants)rd   r)  r�   r  r÷   Úrefs         r!   Ú_unjelly_referencez_Unjellier._unjelly_referenceê  sŒ   € Ø�A‘ˆØ�!‰fˆØ�L‰L˜ÓˆØ�o‰o×!Ñ! %Ó(ˆØˆ;Ø%&ˆD�O‰O˜EÑ"ð ˆô ˜œXÔ&Ø×!Ñ! !Ô$Ø%&ˆD�O‰O˜EÑ"ð ˆð :Ð9Ó9�1r#   c           	      óÌ   — t        t        t        |«      «      «      }d}|D ])  }t        | j	                  ||||   «      t
        «      sŒ(d}Œ+ |rt        |«      S t        |«      S )Nr[   r   )rÃ   ÚrangeÚlenr   r'  r   rÆ   r   )rd   r)  ÚlÚfinishedÚelems        r!   Ú_unjelly_tuplez_Unjellier._unjelly_tupleø  sb   € Ü””s˜3“x“Ó!ˆØˆØò 	ˆDÜ˜$×*Ñ*¨1¨d°C¸±IÓ>ÄÕIØ‘ð	ñ Ü˜“8ˆOä˜!“9Ðr#   c                 óz   — t        t        t        |«      «      «      }|D ]  }| j                  ||||   «       Œ |S r&   )rÃ   r1  r2  r'  )rd   r)  r3  r5  s       r!   Ú_unjelly_listz_Unjellier._unjelly_list  s>   € Ü””s˜3“x“Ó!ˆØò 	1ˆDØ×Ñ˜Q  c¨$¡iÕ0ð	1àˆr#   c                 óÌ   — t        t        t        |«      «      «      }d}|D ]+  }| j                  ||||   «      }t	        |t
        «      sŒ*d}Œ- |st        ||«      S  ||«      S )z¾
        Helper method to unjelly set or frozenset.

        @param lst: the content of the set.
        @type lst: C{list}

        @param containerType: the type of C{set} to use.
        TF)rÃ   r1  r2  r'  r   r   r   )rd   r)  ÚcontainerTyper3  r4  r5  Údatas          r!   Ú_unjellySetOrFrozensetz!_Unjellier._unjellySetOrFrozenset	  sn   € ô ””s˜3“x“Ó!ˆØˆØò 	!ˆDØ×#Ñ# A t¨S°©YÓ7ˆDÜ˜$¤Õ)Ø ‘ð	!ñ Ü˜a Ó/Ð/á  Ó#Ð#r#   c                 ó.   — | j                  |t        «      S )z7
        Unjelly set using the C{set} builtin.
        )r<  rÌ   ©rd   r)  s     r!   Ú_unjelly_setz_Unjellier._unjelly_set  s   € ð ×*Ñ*¨3´Ó4Ð4r#   c                 ó.   — | j                  |t        «      S )zC
        Unjelly frozenset using the C{frozenset} builtin.
        )r<  rÎ   r>  s     r!   Ú_unjelly_frozensetz_Unjellier._unjelly_frozenset#  s   € ð ×*Ñ*¨3´	Ó:Ð:r#   c                 ó€   — i }|D ]6  \  }}t        |«      }| j                  |d|«       | j                  |d|«       Œ8 |S )Nr   r[   )r	   r'  )rd   r)  ré   ÚkÚvÚkvds         r!   Ú_unjelly_dictionaryz_Unjellier._unjelly_dictionary)  sO   € ØˆØò 	(‰DˆAˆqÜ" 1Ó%ˆCØ×Ñ˜S ! QÔ'Ø×Ñ˜S ! QÕ'ð	(ð ˆr#   c                 óÊ   — t        |d   «      }t        |«      t        k7  rt        d«      ‚| j                  j                  |«      st        d|›�«      ‚t        |i i d«      }|S )Nr   z5Attempted to unjelly a module with a non-string name.z"Attempted to unjelly module named rÙ   )r   r   rn   rÓ   r€   r  Ú
__import__)rd   ÚrestÚ
moduleNameÚmods       r!   Ú_unjelly_modulez_Unjellier._unjelly_module1  sc   € Ü! $ q¡'Ó*ˆ
Ü�
ÓœsÒ"ÜÐ WÓXÐXØ�{‰{×*Ñ*¨:Ô6ÜÐ"DÀZÀNÐ SÓTÐTÜ˜ R¨¨SÓ1ˆØˆ
r#   c                 ó¤  — t        |d   «      }|j                  t        d«      «      }t        d«      j                  |d d «      }| j                  j	                  |«      st        d|z  «      ‚t        |«      }t        |«      }|t        urt        d|›d|›�«      ‚| j                  j                  |«      st        dt        |«      z  «      ‚|S )Nr   rœ   rÿ   zmodule %s not allowedzclass z, unjellied to something that isn't a class: zclass not allowed: %s)
r   r  r²   r€   r  rÓ   r   r   rÑ   r   )rd   rI  ÚcnameÚclistr  ÚklausrÕ   s          r!   Ú_unjelly_classz_Unjellier._unjelly_class:  sÁ   € Ü˜T !™WÓ%ˆØ—‘œL¨Ó-Ó.ˆÜ˜sÓ#×(Ñ(¨¨s°¨Ó4ˆØ�{‰{×*Ñ*¨7Ô3ÜÐ 7¸'Ñ AÓBÐBÜ˜EÓ"ˆÜ�u“+ˆØœ$ÑÝâ™%ð!óð ð �{‰{×)Ñ)¨%Ô0ÜÐ 7¼$¸u»+Ñ EÓFÐFØˆr#   c                 óø   — t        |d   «      }|j                  t        d«      «      }t        d«      j                  |d d «      }| j                  j	                  |«      st        d|z  «      ‚t        |«      }|S )Nr   rœ   rÿ   zModule not allowed: %s)r   r  r²   r€   r  rÓ   r   )rd   rI  ÚfnameÚmodSplitr  Úfunctions         r!   Ú_unjelly_functionz_Unjellier._unjelly_functionK  so   € Ü˜T !™WÓ%ˆØ—;‘;œ|¨CÓ0Ó1ˆÜ˜sÓ#×(Ñ(¨°#°2¨Ó7ˆØ�{‰{×*Ñ*¨7Ô3ÜÐ 8¸7Ñ BÓCÐCä˜E“?ˆØˆr#   c                 ó^   — | j                   r| j                  |d   | «      }|S t        d«      S )Nr   zPersistent callback not found)ró   ra   )rd   rI  Úploads      r!   Ú_unjelly_persistentz_Unjellier._unjelly_persistentU  s2   € Ø×ÒØ×'Ñ'¨¨Q©°Ó6ˆEØˆLä Ð!@ÓAÐAr#   c                 óŽ   — t        j                  dt        dd¬«       | j                  |d   «      }| j	                  ||d   «      S )zÙ
        (internal) Unjelly an instance.

        Called to handle the deprecated I{instance} token.

        @param rest: The s-expression representing the instance.

        @return: The unjellied instance.
        ztUnjelly support for the instance atom is deprecated since Twisted 15.0.0.  Upgrade peer for modern instance support.Ú r   )ÚcategoryÚfilenameÚlinenor[   )ÚwarningsÚwarn_explicitÚDeprecationWarningr\   r  )rd   rI  r  s      r!   Ú_unjelly_instancez_Unjellier._unjelly_instance\  sL   € ô 	×ÑðIä'ØØõ	
ð �l‰l˜4 ™7Ó#ˆØ×#Ñ# C¨¨a©Ó1Ð1r#   c                 ó$   — t        d|d   › �«      S )NzUnpersistable data: r   )ra   )rd   rI  s     r!   Ú_unjelly_unpersistablez!_Unjellier._unjelly_unpersistableq  s   € ÜÐ3°D¸±G°9Ð=Ó>Ð>r#   c                 óv  — |d   }| j                  |d   «      }| j                  |d   «      }t        |t        «      st        d«      ‚||j                  v rY|€t        ||«      }|S t        |t        «      rt        |||«      }|S t        j                  |j                  |   |g|gdz  ¢­Ž }|S t        d«      ‚)z.
        (internal) Unjelly a method.
        r   r[   r“   z"Method found with non-class class.Fzinstance method changed)r\   r   r   rÓ   r(   r-   r   r
   r¨   r©   rF   )rd   rI  Úim_nameÚim_selfÚim_classÚims         r!   Ú_unjelly_methodz_Unjellier._unjelly_methodt  sÔ   € ð �q‘'ˆØ—,‘,˜t A™wÓ'ˆØ—<‘<  Q¡Ó(ˆÜ˜(¤DÔ)ÜÐ DÓEÐEØ�h×'Ñ'Ñ'ØˆÜ˜X wÓ/�ð ˆ	ô ˜G¤XÔ.Ü$ W¨g°xÓ@�ð ˆ	ô ×%Ñ%Ø×%Ñ% gÑ.°ðØ<D¸:ÈÑ;Oò�ð
 ˆ	ô Ð5Ó6Ð6r#   N) rC   rk   rl   re   rù   rý   r\   r  r  r  r  r  r  r  r   r"  r'  r+  r/  r6  r8  r<  r?  rA  rF  rL  rQ  rV  rY  rb  rd  rj  ro   r#   r!   rñ   rñ   l  s–   „ òòòò5ò<Nò"ò$ò7ò!ò<ò8ò8òYòòòò	òò$ò(5ò;òòòò"òBò2ò*?ór#   rñ   c                   ó   — e Zd ZdZy)rÓ   z�
    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'
    N)rC   rk   rl   rm   ro   r#   r!   rÓ   rÓ   Ž  s   „ òr#   rÓ   c                   ó"   — e Zd ZdZd„ Zd„ Zd„ Zy)ÚDummySecurityOptionsz{
    DummySecurityOptions() -> insecure security options
    Dummy security options -- this class will allow anything.
    c                  ó   — y)z�
        DummySecurityOptions.isModuleAllowed(moduleName) -> boolean
        returns 1 if a module by that name is allowed, 0 otherwise
        r[   ro   ©rd   rJ  s     r!   r  z$DummySecurityOptions.isModuleAllowed›  ó   € ð
 r#   c                  ó   — y)z»
        DummySecurityOptions.isClassAllowed(class) -> boolean
        Assumes the module has already been allowed.  Returns 1 if the given
        class is allowed, 0 otherwise.
        r[   ro   ©rd   Úklasss     r!   rÑ   z#DummySecurityOptions.isClassAllowed¢  s   € ð r#   c                  ó   — y)z†
        DummySecurityOptions.isTypeAllowed(typeName) -> boolean
        Returns 1 if the given type is allowed, 0 otherwise.
        r[   ro   ©rd   ÚtypeNames     r!   r¥   z"DummySecurityOptions.isTypeAllowedª  rp  r#   N)rC   rk   rl   rm   r  rÑ   r¥   ro   r#   r!   rm  rm  •  s   „ ñò
òór#   rm  c                   óH   — e Zd ZdZg d¢Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zy)ÚSecurityOptionszF
    This will by default disallow everything, except for 'none'.
    )
Ú
dictionaryrÃ   rÆ   Ú	referenceÚdereferencerÒ   rÝ   Úlong_intÚlongr'   c                 óŽ   — i dd“dd“dd“dd“dd“dd“dd“d	d“d
d“dd“dd“dd“dd“dd“dd“dd“| _         i | _        i | _        y)z/
        SecurityOptions() initialize.
        r   r[   s   boolr�   s   strings   strs   ints   floatr    r¢   r£   r¤   s   NoneTyperš   rç   r   r   N)ÚallowedTypesÚallowedModulesÚallowedClassesri   s    r!   re   zSecurityOptions.__init__Ä  sÚ   € ð
Ø�Qð
à�Qð
ð ˜ð
ð �qð	
ð
 �Að
ð �Að
ð �að
ð ˜ð
ð �Qð
ð �Qð
ð ˜!ð
ð ˜ð
ð ˜ð
ð ˜ð
ð �Að
ð  ˜!ð!
ˆÔð$ !ˆÔØ ˆÕr#   c                 ó6   —  | j                   | j                  Ž  y)zz
        Allow all `basic' types.  (Dictionary and list.  Int, string, and float
        are implicitly allowed.)
        N)r:   Ú
basicTypesri   s    r!   ÚallowBasicTypeszSecurityOptions.allowBasicTypesß  s   € ð
 	ˆ�‰˜Ÿ™Ò)r#   c                 ó¨   — |D ]M  }t        |t        «      r|j                  d«      }t        |t        «      st	        |«      }d| j
                  |<   ŒO y)zg
        SecurityOptions.allowTypes(typeString): Allow a particular type, by its
        name.
        r1   r[   N)r   rn   r3   r2   r   r  )rd   r¨   Útyps      r!   r:   zSecurityOptions.allowTypesæ  sN   € ð
 ò 	'ˆCÜ˜#œsÔ#Ø—j‘j Ó)�Ü˜c¤5Ô)Ü˜3“i�Ø%&ˆD×Ñ˜cÒ"ñ	'r#   c                 óâ   — | j                  «        | j                  dddd«       |D ]F  }| j                  t        |«      «       | j                  |j                  «       d| j
                  |<   ŒH y)a  
        SecurityOptions.allowInstances(klass, klass, ...): allow instances
        of the specified classes

        This will also allow the 'instance', 'class' (renamed 'classobj' in
        Python 2.3), and 'module' types, as well as basic types.
        r*   ÚclassÚclassobjrG   r[   N)r„  r:   r   ÚallowModulesrk   r�  )rd   Úclassesrs  s      r!   ÚallowInstancesOfz SecurityOptions.allowInstancesOfò  se   € ð 	×ÑÔØ�‰˜
 G¨Z¸ÔBØò 	+ˆEØ�O‰OœD ›KÔ(Ø×Ñ˜e×.Ñ.Ô/Ø)*ˆD×Ñ Ò&ñ	+r#   c                 óÂ   — |D ]Z  }t        |«      t        j                  k(  r|j                  }t	        |t
        «      s|j                  d«      }d| j                  |<   Œ\ y)z‹
        SecurityOptions.allowModules(module, module, ...): allow modules by
        name. This will also allow the 'module' type.
        r1   r[   N)r   r¨   r­   rC   r   r2   r3   r€  )rd   ÚmodulesrG   s      r!   rŠ  zSecurityOptions.allowModules  sV   € ð
 ò 	,ˆFÜ�F‹|œu×/Ñ/Ò/ØŸ™�ä˜f¤eÔ,ØŸ™ wÓ/�à*+ˆD×Ñ Ò'ñ	,r#   c                 ó`   — t        |t        «      s|j                  d«      }|| j                  v S )z‹
        SecurityOptions.isModuleAllowed(moduleName) -> boolean
        returns 1 if a module by that name is allowed, 0 otherwise
        r1   )r   r2   r3   r€  ro  s     r!   r  zSecurityOptions.isModuleAllowed  s/   € ô
 ˜*¤eÔ,Ø#×*Ñ*¨7Ó3ˆJà˜T×0Ñ0Ð0Ð0r#   c                 ó   — || j                   v S )z¶
        SecurityOptions.isClassAllowed(class) -> boolean
        Assumes the module has already been allowed.  Returns 1 if the given
        class is allowed, 0 otherwise.
        )r�  rr  s     r!   rÑ   zSecurityOptions.isClassAllowed  s   € ð ˜×+Ñ+Ð+Ð+r#   c                 ól   — t        |t        «      s|j                  d«      }|| j                  v xs d|v S )z�
        SecurityOptions.isTypeAllowed(typeName) -> boolean
        Returns 1 if the given type is allowed, 0 otherwise.
        r1   ó   .)r   r2   r3   r  ru  s     r!   r¥   zSecurityOptions.isTypeAllowed!  s7   € ô
 ˜(¤EÔ*Ø—‘ wÓ/ˆHà˜4×,Ñ,Ð,Ò@°¸Ð0@Ð@r#   N)rC   rk   rl   rm   rƒ  re   r„  r:   rŒ  rŠ  r  rÑ   r¥   ro   r#   r!   rx  rx  ²  s7   „ ñò€Jò!ò6*ò
'ò+ò,ò1ò,óAr#   rx  c                 ó:   — t        |||«      j                  | «      S )zþ
    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.
    )r~   rT   )rŒ   r€   r…   r†   s       r!   rT   rT   0  s   € ô �F˜O¨WÓ5×;Ñ;¸FÓCÐCr#   c                 ó:   — t        |||«      j                  | «      S )aT  
    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.
    )rñ   rù   )r”   r€   ró   r†   s       r!   r\   r\   ;  s   € ô �f˜n¨gÓ6×BÑBÀ4ÓHÐHr#   r&   )Erm   r‰   r¯   rÀ   r¨   r_  Ú	functoolsr   Úzope.interfacer   Úincrementalr   Útwisted.persisted.crefutilr   r   r   r	   r
   r   Útwisted.python.compatr   Útwisted.python.deprecater   Útwisted.python.reflectr   r   r   Útwisted.spread.interfacesr   r   r'   rÈ   Ú	None_atomÚ
class_atomÚmodule_atomÚfunction_atomr‹   rÐ   rŠ   rÊ   rÅ   rÍ   rÇ   r   rÏ   rï   r8   r?   r"   r/   r6   r=   rA   rM   rY   r_   ra   rq   rx   r~   rñ   Ú	ExceptionrÓ   rm  rx  r9   r„  rT   r\   ro   r#   r!   ú<module>r¢     s¯  ðñ
8ót Û Û ó Û Ý å &å ÷÷ õ /Ý >ß >Ñ >ß >àˆG€	à€	à€
Ø€Ø€ð "Ð Ø€Ø€ð  €Ø€	Ø€ð €
Ø€Ø€ñ ÙˆI�r˜1˜aÓ Ø-ØØô	ð &Ð ØÐ ØÐ ò ò ò(	ò)ò2)ó(&BòR
'ò	÷7ñ 7ñ  ˆZÓ÷+ð +ó ð+ñ. ˆ\Ó÷ð ó ð÷(Lñ L÷^\ñ \ôD	�Iô ÷ñ ÷:wAñ wAñt !Ó"€Ø × Ñ Ô  ñ .Ó/ÀÈtó Dñ .Ó/ÀÈdô 	Ir#   