HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/root/usr/lib/python3/dist-packages/twisted/python/__pycache__/roots.cpython-38.pyc
U


W[��@s�dZddlmZmZddlmZddlmZGdd�de�Z	eGdd�d��Z
eGd	d
�d
��ZeGdd�d��ZGd
d�de
�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)zf
Twisted Python Roots: an abstract hierarchy representation for Twisted.

Maintainer: Glyph Lefkowitz
�)�absolute_import�division)�reflect)�	_oldStylec@seZdZdZdS)�NotSupportedErrorzv
    An exception meaning that the tree-manipulation operation
    you're attempting to perform is not supported.
    N��__name__�
__module__�__qualname__�__doc__�rr�6/usr/lib/python3/dist-packages/twisted/python/roots.pyrsrc@s$eZdZdZdZdd�Zdd�ZdS)�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().
    NcCstdt�|j���dS)z7Add some data to the response to this request.
        z%s.writeN��NotImplementedErrorr�qual�	__class__)�self�datarrr
�write%sz
Request.writecCstdt�|j���dS)zXThe response to this request is finished; flush all data to the network stream.
        z	%s.finishNr�rrrr
�finish*szRequest.finish)rr	r
rZwireProtocolrrrrrr
rsrc@seZdZdZdd�ZdS)�EntityaZI 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.
    cCstdt�|j���dS)zw
        I produce a stream of bytes for the request, by calling request.write()
        and request.finish().
        z	%s.renderNr�r�requestrrr
�render<sz
Entity.renderN)rr	r
rrrrrr
r1s	rc@s�eZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS) �
Collectionz�I represent a static collection of entities.

    I contain methods designed to represent collections that can be dynamically
    created.
    NcCs|dk	r||_ni|_dS)zInitialize me.
        N��entities)rrrrr
�__init__MszCollection.__init__cCs|j�|�S)zqGet an entity that was added to me using putEntity.

        This method will return 'None' if it fails.
        )r�get�r�namerrr
�getStaticEntityUszCollection.getStaticEntitycCsdS)znSubclass this to generate an entity on demand.

        This method should return 'None' if it fails.
        Nr�rr"rrrr
�getDynamicEntity\szCollection.getDynamicEntitycCs2|�|�}|dk	r|S|�||�}|dk	r.|SdS)aRetrieve 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%)rr"rZentrrr
�	getEntitybs	
zCollection.getEntitycCs||j|<dS)zlStore a static reference on 'name' for 'entity'.

        Raises a KeyError if the operation fails.
        Nr�rr"�entityrrr
�	putEntitysszCollection.putEntitycCs|j|=dS)zaRemove a static reference for 'name'.

        Raises a KeyError if the operation fails.
        Nrr!rrr
�	delEntityzszCollection.delEntitycCstdt�|j���dS)zGStore an entity for 'name', based on the content of 'request'.
        z%s.storeEntityN�rrrrr$rrr
�storeEntity�szCollection.storeEntitycCstdt�|j���dS)zHRemove an entity for 'name', based on the content of 'request'.
        z%s.removeEntityNr+r$rrr
�removeEntity�szCollection.removeEntitycCs
|j��S)zlRetrieve a list of all name, entity pairs that I store references to.

        See getStaticEntity.
        )r�itemsrrrr
�listStaticEntities�szCollection.listStaticEntitiescCsgS)zaA list of all name, entity that I can generate on demand.

        See getDynamicEntity.
        rrrrr
�listDynamicEntities�szCollection.listDynamicEntitiescCs|��|�|�S)zURetrieve a list of all name, entity pairs I contain.

        See getEntity.
        )r/r0rrrr
�listEntities�szCollection.listEntitiescCs
|j��S)zkRetrieve a list of the names of entities that I store references to.

        See getStaticEntity.
        )r�keysrrrr
�listStaticNames�szCollection.listStaticNamescCsgS)zlRetrieve a list of the names of entities that I store references to.

        See getDynamicEntity.
        rrrrr
�listDynamicNames�szCollection.listDynamicNamescCs|��S)zZRetrieve a list of all names for entities that I contain.

        See getEntity.
        )r3rrrr
�	listNames�szCollection.listNames)N)rr	r
rrr#r%r&r)r*r,r-r/r0r1r3r4r5rrrr
rEs
rc@seZdZdZdS)�ConstraintViolationz7An exception raised when a constraint is violated.
    Nrrrrr
r6�sr6c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�Constrainedz?A collection that has constraints on its names and/or entities.cCsdS)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!rrr
�nameConstraint�szConstrained.nameConstraintcCsdS)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.
        r8r�rr(rrr
�entityConstraint�szConstrained.entityConstraintcCst�|||�dS�N)rr)r'rrr
�reallyPutEntity�szConstrained.reallyPutEntitycCs8|�|�r,|�|�r"|�||�q4td��ntd��dS)zfStore an entity if it meets both constraints.

        Otherwise raise a ConstraintViolation.
        zEntity constraint violated.zName constraint violated.N)r9r;r=r6r'rrr
r)�s



zConstrained.putEntityN)rr	r
rr9r;r=r)rrrr
r7�s
r7c@s$eZdZdZdZdd�Zdd�ZdS)�Lockedz5A collection that can be locked from adding entities.rcCs
d|_dS)Nr8��lockedrrrr
�lock�szLocked.lockcCs|jSr<r?r:rrr
r;�szLocked.entityConstraintN)rr	r
rr@rAr;rrrr
r>�sr>c@s,eZdZdZeZdd�Zdd�Zdd�ZdS)	�
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.
    cCs&t||j�rdStd||jf��dS)Nr8z%s of incorrect type (%s))�
isinstance�
entityTyper6r:rrr
r;�s
�zHomogenous.entityConstraintcCsdS)N�Namerrrrr
�getNameType�szHomogenous.getNameTypecCs|jjSr<)rDrrrrr
�
getEntityTypeszHomogenous.getEntityTypeN)	rr	r
r�objectrDr;rFrGrrrr
rB�s
rBN)rZ
__future__rrZtwisted.pythonrZtwisted.python._oldstylerrrrrr�	Exceptionr6r7r>rBrrrr
�<module>sr$