§
    Ètºf
  ã                   óð   — 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dS )zf
Twisted Python Roots: an abstract hierarchy representation for Twisted.

Maintainer: Glyph Lefkowitz
é    )Úreflectc                   ó   — e Zd ZdZdS )ÚNotSupportedErrorzv
    An exception meaning that the tree-manipulation operation
    you're attempting to perform is not supported.
    N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úS/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/python/roots.pyr   r      s   € € € € € ðð ð ð r   r   c                   ó"   — e Zd ZdZdZd„ Zd„ ZdS )Ú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                 óT   — 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Ñ/KÔ/KÑ"KÑLÔLÐLr   c                 óT   — 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Ô0LÑ"LÑMÔMÐMr   )r   r   r	   r
   ÚwireProtocolr   r   r   r   r   r   r      sK   € € € € € ðð ð €LðMð Mð MðNð Nð Nð Nð Nr   r   c                   ó   — e Zd ZdZd„ ZdS )Ú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                 óT   — 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Ô0LÑ"LÑMÔMÐMr   N)r   r   r	   r
   r!   r   r   r   r   r   +   s2   € € € € € ðð ðNð Nð Nð Nð Nr   r   c                   óh   — 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dS )Ú
Collectionz�I represent a static collection of entities.

    I contain methods designed to represent collections that can be dynamically
    created.
    Nc                 ó*   — |�	|| _         dS i | _         dS )zInitialize me.N©Úentities)r   r&   s     r   Ú__init__zCollection.__init__E   s   € àÐØ$ˆDŒMˆMˆMàˆDŒMˆMˆMr   c                 ó6   — | 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                 ó   — dS )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                 ól   — |                       |¦  «        }|�|S |                      ||¦  «        }|�|S dS )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   sE   € ð ×"Ò" 4Ñ(Ô(ˆØˆ?ØˆJØ×#Ò# D¨'Ñ2Ô2ˆØˆ?ØˆJØˆtr   c                 ó   — || j         |<   dS )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         |= dS )zaRemove a static reference for 'name'.

        Raises a KeyError if the operation fails.
        Nr%   r*   s     r   Ú	delEntityzCollection.delEntityq   s   € ð
 ŒM˜$ÐÐÐr   c                 óT   — 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Ô3OÑ OÑPÔPÐPr   c                 óT   — 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ÀÄÑ4PÔ4PÑ PÑQÔQÐQr   c                 ó4   — | 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                 óV   — |                       ¦   «         |                      |¦  «        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ÑLÐLr   c                 ó4   — | 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                 ó*   — |                       ¦   «         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#   >   sþ   € € € € € ðð ðð ð ð ð'ð 'ð 'ðð ð ðð ð ð"%ð %ð %ð ð  ð  ðQð Qð QðRð Rð Rð%ð %ð %ðð ð ðMð Mð Mð$ð $ð $ðð ð ð&ð &ð &ð &ð &r   r#   c                   ó   — e Zd ZdZdS )Ú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dS )ÚConstrainedz?A collection that has constraints on its names and/or entities.c                 ó   — dS )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²   ó	   € ð ˆqr   c                 ó   — dS )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                 ó>   — t                                | ||¦  «         d S rM   )r#   r6   r4   s      r   ÚreallyPutEntityzConstrained.reallyPutEntityÂ   s    € Ý×Ò˜T 4¨Ñ0Ô0Ð0Ð0Ð0r   c                 óÂ   — |                       |¦  «        r<|                      |¦  «        r|                      ||¦  «         dS 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Å   sl   € ð
 ×Ò˜tÑ$Ô$ð 	CØ×$Ò$ VÑ,Ô,ð IØ×$Ò$ T¨6Ñ2Ô2Ð2Ð2Ð2å)Ð*GÑHÔHÐHå%Ð&AÑBÔBÐBr   N)r   r   r	   r
   rT   rX   rZ   r6   r   r   r   rQ   rQ   ¯   s[   € € € € € ØIÐIðð ð ðð ð ð1ð 1ð 1ðCð Cð Cð Cð Cr   rQ   c                   ó"   — e Zd ZdZdZd„ Zd„ ZdS )ÚLockedz5A collection that can be locked from adding entities.r   c                 ó   — d| _         d S )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dS )Ú
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                 ód   — t          || j        ¦  «        rdS t          |› d| j        › d�¦  «        ‚)NrS   z of incorrect type (ú))Ú
isinstanceÚ
entityTyperO   rW   s     r   rX   zHomogenous.entityConstraintè   s=   € Ý�f˜dœoÑ.Ô.ð 	YØ�1å%¨Ð&WÐ&WÀTÄ_Ð&WÐ&WÐ&WÑXÔXÐXr   c                 ó   — dS )NÚNamer   r   s    r   ÚgetNameTypezHomogenous.getNameTypeî   s   € Øˆvr   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   ß   sU   € € € € € ðð ð €JðYð Yð Yðð ð ð(ð (ð (ð (ð (r   rd   N)r
   Útwisted.pythonr   r   r   r   r   r#   Ú	ExceptionrO   rQ   r]   rd   r   r   r   ú<module>rq      sš  ðð
ð ð #Ð "Ð "Ð "Ð "Ð "ðð ð ð ð Ð+ñ ô ð ðNð Nð Nð Nð Nñ Nô Nð Nð*Nð Nð Nð Nð Nñ Nô Nð Nð&j&ð j&ð j&ð j&ð j&ñ j&ô j&ð j&ðZ=ð =ð =ð =ð =˜)ñ =ô =ð =ð!Cð !Cð !Cð !Cð !C�*ñ !Cô !Cð !CðH	ð 	ð 	ð 	ð 	ˆ[ñ 	ô 	ð 	ð(ð (ð (ð (ð (�ñ (ô (ð (ð (ð (r   