Ϫf dZddlmZGddeZGddZGddZGd d ZGd d eZ Gd deZ Gdde Z Gdde Z y)zf Twisted Python Roots: an abstract hierarchy representation for Twisted. Maintainer: Glyph Lefkowitz )reflectceZdZdZy)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.pyrrsr rc eZdZdZdZdZdZy)RequestzI 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(). NcXtdtj|jz)z.Add some data to the response to this request.z%s.writeNotImplementedErrorrqual __class__)selfdatas r writez Request.write"s!*w||DNN/K"KLLr cXtdtj|jz)zOThe response to this request is finished; flush all data to the network stream.z %s.finishrrs r finishzRequest.finish&s!+ T^^0L"LMMr )rrr r wireProtocolrrr r r rrsLMNr rceZdZdZdZy)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. cXtdtj|jz)zw I produce a stream of bytes for the request, by calling request.write() and request.finish(). z %s.renderrrrequests r renderz Entity.render6s! "+ T^^0L"LMMr N)rrr r r!r r r rr+s Nr rcfeZdZdZddZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZy) CollectionzI represent a static collection of entities. I contain methods designed to represent collections that can be dynamically created. Nc&|||_yi|_y)zInitialize me.Nentities)rr&s r __init__zCollection.__init__Es  $DMDMr c8|jj|S)zqGet an entity that was added to me using putEntity. This method will return 'None' if it fails. )r&getrnames r getStaticEntityzCollection.getStaticEntityLs }}  &&r cy)znSubclass this to generate an entity on demand. This method should return 'None' if it fails. Nr rr+r s r getDynamicEntityzCollection.getDynamicEntitySsr cZ|j|}||S|j||}||Sy)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+r ents r getEntityzCollection.getEntityYs=""4( ?J##D'2 ?Jr c"||j|<y)zlStore a static reference on 'name' for 'entity'. Raises a KeyError if the operation fails. Nr%rr+entitys r putEntityzCollection.putEntityjs % dr c|j|=y)zaRemove a static reference for 'name'. Raises a KeyError if the operation fails. Nr%r*s r delEntityzCollection.delEntityqs MM$ r cXtdtj|jz)z>Store an entity for 'name', based on the content of 'request'.z%s.storeEntityrrrrr.s r storeEntityzCollection.storeEntityxs  07<<3O OPPr cXtdtj|jz)z?Remove an entity for 'name', based on the content of 'request'.z%s.removeEntityr:r.s r removeEntityzCollection.removeEntity|s  1GLL4P PQQr c6|jjS)zlRetrieve a list of all name, entity pairs that I store references to. See getStaticEntity. )r&itemsrs r listStaticEntitieszCollection.listStaticEntitiess }}""$$r cgS)zaA list of all name, entity that I can generate on demand. See getDynamicEntity. r rs r listDynamicEntitieszCollection.listDynamicEntities  r cF|j|j|zS)zURetrieve a list of all name, entity pairs I contain. See getEntity. )r@rBrs r listEntitieszCollection.listEntitiess# &&(4+C+CG+LLLr c6|jjS)zkRetrieve a list of the names of entities that I store references to. See getStaticEntity. )r&keysrs r listStaticNameszCollection.listStaticNamess }}!!##r cgS)zlRetrieve a list of the names of entities that I store references to. See getDynamicEntity. r rs r listDynamicNameszCollection.listDynamicNamesrCr c"|jS)zZRetrieve a list of all names for entities that I contain. See getEntity. )rHrs r listNameszCollection.listNamess ##%%r N)rrr r r'r,r/r2r6r8r;r=r@rBrErHrJrLr r r r#r#>sP ' "% QR%M$&r r#ceZdZdZy)ConstraintViolationz2An exception raised when a constraint is violated.Nrr r r rOrOsrqst #+NN*NN&j&j&Z=)=!C*!CH [ ((r