Ë
    oj
  ã                   ó¾   — d Z ddlmZ  G d„ de«      Z G d„ d«      Z G d„ d«      Z G d	„ d
«      Z G d„ de«      Z	 G d„ de«      Z
 G d„ de
«      Z G d„ de
«      Zy)zf
Twisted Python Roots: an abstract hierarchy representation for Twisted.

Maintainer: Glyph Lefkowitz
é    )Úreflectc                   ó   — e Zd ZdZy)ÚNotSupportedErrorzv
    An exception meaning that the tree-manipulation operation
    you're attempting to perform is not supported.
    N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    ú6/usr/lib/python3/dist-packages/twisted/python/roots.pyr   r      s   „ òr   r   c                   ó    — e Zd ZdZdZd„ Zd„ Zy)ÚRequestzãI am an abstract representation of a request for an entity.

    I also function as the response.  The request is responded to by calling
    self.write(data) until there is no data left and then calling
    self.finish().
    Nc                 óX   — t        dt        j                  | j                  «      z  «      ‚)z.Add some data to the response to this request.z%s.write©ÚNotImplementedErrorr   ÚqualÚ	__class__)ÚselfÚdatas     r   ÚwritezRequest.write"   s   € ä! *¬w¯|©|¸D¿N¹NÓ/KÑ"KÓLÐLr   c                 óX   — t        dt        j                  | j                  «      z  «      ‚)zOThe response to this request is finished; flush all data to the network stream.z	%s.finishr   ©r   s    r   ÚfinishzRequest.finish&   s   € ä! +´·±¸T¿^¹^Ó0LÑ"LÓMÐMr   )r   r   r	   r
   ÚwireProtocolr   r   r   r   r   r   r      s   „ ñð €LòMóNr   r   c                   ó   — e Zd ZdZd„ Zy)ÚEntityaZ  I am a terminal object in a hierarchy, with no children.

    I represent a null interface; certain non-instance objects (strings and
    integers, notably) are Entities.

    Methods on this class are suggested to be implemented, but are not
    required, and will be emulated on a per-protocol basis for types which do
    not handle them.
    c                 óX   — t        dt        j                  | j                  «      z  «      ‚)zw
        I produce a stream of bytes for the request, by calling request.write()
        and request.finish().
        z	%s.renderr   ©r   Úrequests     r   ÚrenderzEntity.render6   s!   € ô
 " +´·±¸T¿^¹^Ó0LÑ"LÓMÐMr   N)r   r   r	   r
   r!   r   r   r   r   r   +   s   „ ñóNr   r   c                   óf   — e Zd ZdZd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)Ú
Collectionz�I represent a static collection of entities.

    I contain methods designed to represent collections that can be dynamically
    created.
    Nc                 ó&   — |�|| _         yi | _         y)zInitialize me.N©Úentities)r   r&   s     r   Ú__init__zCollection.__init__E   s   € àÐØ$ˆD�MàˆD�Mr   c                 ó8   — | j                   j                  |«      S )zqGet an entity that was added to me using putEntity.

        This method will return 'None' if it fails.
        )r&   Úget©r   Únames     r   ÚgetStaticEntityzCollection.getStaticEntityL   s   € ð
 �}‰}× Ñ  Ó&Ð&r   c                  ó   — y)znSubclass this to generate an entity on demand.

        This method should return 'None' if it fails.
        Nr   ©r   r+   r    s      r   ÚgetDynamicEntityzCollection.getDynamicEntityS   s   � r   c                 óZ   — | j                  |«      }|�|S | j                  ||«      }|�|S y)a  Retrieve an entity from me.

        I will first attempt to retrieve an entity statically; static entities
        will obscure dynamic ones.  If that fails, I will retrieve the entity
        dynamically.

        If I cannot retrieve an entity, I will return 'None'.
        N)r,   r/   )r   r+   r    Úents       r   Ú	getEntityzCollection.getEntityY   s=   € ð ×"Ñ" 4Ó(ˆØˆ?ØˆJØ×#Ñ# D¨'Ó2ˆØˆ?ØˆJØr   c                 ó"   — || j                   |<   y)zlStore a static reference on 'name' for 'entity'.

        Raises a KeyError if the operation fails.
        Nr%   ©r   r+   Úentitys      r   Ú	putEntityzCollection.putEntityj   s   € ð
 %ˆ�‰�dÒr   c                 ó   — | j                   |= y)zaRemove a static reference for 'name'.

        Raises a KeyError if the operation fails.
        Nr%   r*   s     r   Ú	delEntityzCollection.delEntityq   s   € ð
 �M‰M˜$Ñr   c                 óX   — t        dt        j                  | j                  «      z  «      ‚)z>Store an entity for 'name', based on the content of 'request'.z%s.storeEntity©r   r   r   r   r.   s      r   ÚstoreEntityzCollection.storeEntityx   s    € äÐ 0´7·<±<ÀÇÁÓ3OÑ OÓPÐPr   c                 óX   — t        dt        j                  | j                  «      z  «      ‚)z?Remove an entity for 'name', based on the content of 'request'.z%s.removeEntityr:   r.   s      r   ÚremoveEntityzCollection.removeEntity|   s    € äÐ 1´G·L±LÀÇÁÓ4PÑ PÓQÐQr   c                 ó6   — | j                   j                  «       S )zlRetrieve a list of all name, entity pairs that I store references to.

        See getStaticEntity.
        )r&   Úitemsr   s    r   ÚlistStaticEntitieszCollection.listStaticEntities€   s   € ð
 �}‰}×"Ñ"Ó$Ð$r   c                 ó   — g S )zaA list of all name, entity that I can generate on demand.

        See getDynamicEntity.
        r   r   s     r   ÚlistDynamicEntitieszCollection.listDynamicEntities‡   ó	   € ð
 ˆ	r   c                 óF   — | j                  «       | j                  |«      z   S )zURetrieve a list of all name, entity pairs I contain.

        See getEntity.
        )r@   rB   r   s     r   ÚlistEntitieszCollection.listEntitiesŽ   s#   € ð
 ×&Ñ&Ó(¨4×+CÑ+CÀGÓ+LÑLÐLr   c                 ó6   — | j                   j                  «       S )zkRetrieve a list of the names of entities that I store references to.

        See getStaticEntity.
        )r&   Úkeysr   s    r   ÚlistStaticNameszCollection.listStaticNames•   s   € ð
 �}‰}×!Ñ!Ó#Ð#r   c                 ó   — g S )zlRetrieve a list of the names of entities that I store references to.

        See getDynamicEntity.
        r   r   s    r   ÚlistDynamicNameszCollection.listDynamicNamesœ   rC   r   c                 ó"   — | j                  «       S )zZRetrieve a list of all names for entities that I contain.

        See getEntity.
        )rH   r   s     r   Ú	listNameszCollection.listNames£   s   € ð
 ×#Ñ#Ó%Ð%r   ©N)r   r   r	   r
   r'   r,   r/   r2   r6   r8   r;   r=   r@   rB   rE   rH   rJ   rL   r   r   r   r#   r#   >   sP   „ ñóò'òòò"%ò òQòRò%òòMò$òó&r   r#   c                   ó   — e Zd ZdZy)ÚConstraintViolationz2An exception raised when a constraint is violated.Nr   r   r   r   rO   rO   «   s   „ Ú<r   rO   c                   ó(   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zy)ÚConstrainedz?A collection that has constraints on its names and/or entities.c                  ó   — y)zôA method that determines whether an entity may be added to me with a given name.

        If the constraint is satisfied, return 1; if the constraint is not
        satisfied, either return 0 or raise a descriptive ConstraintViolation.
        é   r   r*   s     r   ÚnameConstraintzConstrained.nameConstraint²   ó   € ð r   c                  ó   — y)zâA method that determines whether an entity may be added to me.

        If the constraint is satisfied, return 1; if the constraint is not
        satisfied, either return 0 or raise a descriptive ConstraintViolation.
        rS   r   ©r   r5   s     r   ÚentityConstraintzConstrained.entityConstraintº   rU   r   c                 ó2   — t         j                  | ||«       y rM   )r#   r6   r4   s      r   ÚreallyPutEntityzConstrained.reallyPutEntityÂ   s   € Ü×Ñ˜T 4¨Õ0r   c                 ó˜   — | j                  |«      r/| j                  |«      r| j                  ||«       yt        d«      ‚t        d«      ‚)zfStore an entity if it meets both constraints.

        Otherwise raise a ConstraintViolation.
        zEntity constraint violated.zName constraint violated.N)rT   rX   rZ   rO   r4   s      r   r6   zConstrained.putEntityÅ   sH   € ð
 ×Ñ˜tÔ$Ø×$Ñ$ VÔ,Ø×$Ñ$ T¨6Õ2ä)Ð*GÓHÐHä%Ð&AÓBÐBr   N)r   r   r	   r
   rT   rX   rZ   r6   r   r   r   rQ   rQ   ¯   s   „ ÙIòòò1óCr   rQ   c                   ó    — e Zd ZdZdZd„ Zd„ Zy)ÚLockedz5A collection that can be locked from adding entities.r   c                 ó   — d| _         y )NrS   ©Úlockedr   s    r   ÚlockzLocked.lockØ   s	   € Øˆ�r   c                 ó   — | j                    S rM   r_   rW   s     r   rX   zLocked.entityConstraintÛ   s   € Ø—;‘;ˆÐr   N)r   r   r	   r
   r`   ra   rX   r   r   r   r]   r]   Ó   s   „ Ù?à€Fòór   r]   c                   ó&   — e Zd ZdZeZd„ Zd„ Zd„ Zy)Ú
Homogenousz¡A homogenous collection of entities.

    I will only contain entities that are an instance of the class or type
    specified by my 'entityType' attribute.
    c                 óf   — t        || j                  «      ryt        |› d| j                  › d�«      ‚)NrS   z of incorrect type (ú))Ú
isinstanceÚ
entityTyperO   rW   s     r   rX   zHomogenous.entityConstraintè   s2   € Ü�f˜dŸo™oÔ.Øä%¨¨Ð0DÀTÇ_Á_ÐDUÐUVÐ&WÓXÐXr   c                  ó   — y)NÚNamer   r   s    r   ÚgetNameTypezHomogenous.getNameTypeî   s   € Ør   c                 ó.   — | j                   j                  S rM   )rh   r   r   s    r   ÚgetEntityTypezHomogenous.getEntityTypeñ   s   € Ø�‰×'Ñ'Ð'r   N)	r   r   r	   r
   Úobjectrh   rX   rk   rm   r   r   r   rd   rd   ß   s   „ ñð €JòYòó(r   rd   N)r
   Útwisted.pythonr   r   r   r   r   r#   Ú	ExceptionrO   rQ   r]   rd   r   r   r   ú<module>rq      st   ðñ
õ #ôÐ+ô ÷Nñ N÷*Nñ N÷&j&ñ j&ôZ=˜)ô =ô!C�*ô !CôH	ˆ[ô 	ô(�õ (r   