Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/python/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/python/roots.pyc


[XMc@sdZddlZddlmZdefdYZdddYZddd	YZd
ddYZde	fd
YZ
defdYZdefdYZdefdYZ
dS(sf
Twisted Python Roots: an abstract hierarchy representation for Twisted.

Maintainer: Glyph Lefkowitz
iN(treflecttNotSupportedErrorcBseZdZRS(sv
    An exception meaning that the tree-manipulation operation
    you're attempting to perform is not supported.
    (t__name__t
__module__t__doc__(((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyRstRequestcBs&eZdZdZdZdZRS(sI 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().
    cCs tdtj|jdS(s7Add some data to the response to this request.
        s%s.writeN(tNotImplementedErrorRtqualt	__class__(tselftdata((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pytwrite scCs tdtj|jdS(sXThe response to this request is finished; flush all data to the network stream.
        s	%s.finishN(RRRR(R	((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pytfinish%sN(RRRtNonetwireProtocolRR(((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyRs	tEntitycBseZdZdZRS(sZI 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.
    cCs tdtj|jdS(sw
        I produce a stream of bytes for the request, by calling request.write()
        and request.finish().
        s	%s.renderN(RRRR(R	trequest((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pytrender5s(RRRR(((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyR+s	t
CollectioncBseZdZddZdZdZdZdZdZ	dZ
dZd	Zd
Z
dZdZd
ZdZRS(sI represent a static collection of entities.

    I contain methods designed to represent collections that can be dynamically
    created.
    cCs%|dk	r||_n	i|_dS(sInitialize me.
        N(R
tentities(R	R((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyt__init__DscCs|jj|S(sqGet an entity that was added to me using putEntity.

        This method will return 'None' if it fails.
        (Rtget(R	tname((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pytgetStaticEntityLscCsdS(snSubclass this to generate an entity on demand.

        This method should return 'None' if it fails.
        N((R	RR((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pytgetDynamicEntitySscCsE|j|}|dk	r|S|j||}|dk	rA|SdS(sRetrieve 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(RR
R(R	RRtent((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyt	getEntityYs	cCs||j|<dS(slStore a static reference on 'name' for 'entity'.

        Raises a KeyError if the operation fails.
        N(R(R	Rtentity((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyt	putEntityjscCs|j|=dS(saRemove a static reference for 'name'.

        Raises a KeyError if the operation fails.
        N(R(R	R((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyt	delEntityqscCs tdtj|jdS(sGStore an entity for 'name', based on the content of 'request'.
        s%s.storeEntityN(RRRR(R	RR((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pytstoreEntityxscCs tdtj|jdS(sHRemove an entity for 'name', based on the content of 'request'.
        s%s.removeEntityN(RRRR(R	RR((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pytremoveEntity}scCs
|jjS(slRetrieve a list of all name, entity pairs that I store references to.

        See getStaticEntity.
        (Rtitems(R	((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pytlistStaticEntitiesscCsgS(saA list of all name, entity that I can generate on demand.

        See getDynamicEntity.
        ((R	R((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pytlistDynamicEntitiesscCs|j|j|S(sURetrieve a list of all name, entity pairs I contain.

        See getEntity.
        (R!R"(R	R((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pytlistEntitiesscCs
|jjS(skRetrieve a list of the names of entities that I store references to.

        See getStaticEntity.
        (Rtkeys(R	((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pytlistStaticNamesscCsgS(slRetrieve a list of the names of entities that I store references to.

        See getDynamicEntity.
        ((R	((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pytlistDynamicNamesscCs
|jS(sZRetrieve a list of all names for entities that I contain.

        See getEntity.
        (R%(R	R((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyt	listNamessN(RRRR
RRRRRRRRR!R"R#R%R&R'(((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyR=s												tConstraintViolationcBseZdZRS(s7An exception raised when a constraint is violated.
    (RRR(((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyR(stConstrainedcBs2eZdZdZdZdZdZRS(s?A collection that has constraints on its names and/or entities.cCsdS(sA 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.
        i((R	R((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pytnameConstraintscCsdS(sA 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.
        i((R	R((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pytentityConstraintscCstj|||dS(N(RR(R	RR((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pytreallyPutEntityscCsP|j|r@|j|r1|j||qLtdntddS(sfStore an entity if it meets both constraints.

        Otherwise raise a ConstraintViolation.
        sEntity constraint violated.sName constraint violated.N(R*R+R,R((R	RR((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyRs
(RRRR*R+R,R(((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyR)s
			tLockedcBs&eZdZdZdZdZRS(s5A collection that can be locked from adding entities.icCs
d|_dS(Ni(tlocked(R	((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pytlockscCs|jS(N(R.(R	R((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyR+s(RRRR.R/R+(((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyR-s	t
HomogenouscBs2eZdZejZdZdZdZRS(sA homogenous collection of entities.

    I will only contain entities that are an instance of the class or type
    specified by my 'entityType' attribute.
    cCs3t||jrdStd||jfdS(Nis%s of incorrect type (%s)(t
isinstancet
entityTypeR((R	R((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyR+scCsdS(NtName((R	((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pytgetNameTypescCs
|jjS(N(R2R(R	((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyt
getEntityTypes(	RRRttypestInstanceTypeR2R+R4R5(((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyR0s
			((((RR6ttwisted.pythonRRRRRRt	ExceptionR(R)R-R0(((s8/usr/lib/python2.7/dist-packages/twisted/python/roots.pyt<module>	sr$