Ϫfp<dZddlmZGddZGddZy)z6 Generic sentence handling tools: hopefully reusable. )SetcXeZdZUdZeZeeed<dZ e dZ dZ defdZ y) _BaseSentencea- A base sentence class for a particular protocol. Using this base class, specific sentence classes can almost automatically be created for a particular protocol. To do this, fill the ALLOWED_ATTRIBUTES class attribute using the C{getSentenceAttributes} class method of the producer:: class FooSentence(BaseSentence): """ A sentence for integalactic transmodulator sentences. @ivar transmogrificationConstant: The value used in the transmogrifier while producing this sentence, corrected for gravitational fields. @type transmogrificationConstant: C{Tummy} """ ALLOWED_ATTRIBUTES = FooProtocol.getSentenceAttributes() @ivar presentAttributes: An iterable containing the names of the attributes that are present in this sentence. @type presentAttributes: iterable of C{str} @cvar ALLOWED_ATTRIBUTES: A set of attributes that are allowed in this sentence. @type ALLOWED_ATTRIBUTES: C{set} of C{str} ALLOWED_ATTRIBUTESc||_y)z Initializes a sentence with parsed sentence data. @param sentenceData: The parsed sentence data. @type sentenceData: C{dict} (C{str} -> C{str} or L{None}) N) _sentenceData)self sentenceDatas ?/usr/lib/python3/dist-packages/twisted/positioning/_sentence.py__init__z_BaseSentence.__init__(s *c,t|jS)z An iterable containing the names of the attributes that are present in this sentence. @return: The iterable of names of present attributes. @rtype: iterable of C{str} )iterr)r s r presentAttributesz_BaseSentence.presentAttributes1sD&&''r c||jvr|jj|dS|jj}|d|d}t |)z5 Gets an attribute of this sentence. Nz sentences have no z attributes)rrget __class____name__AttributeError)r name classNamemsgs r __getattr__z_BaseSentence.__getattr__<sX 4** *%%))$5 5//IK24& DC % %r returnc6|jj}t|Dcgc]\}}|dk7s |d|}}}dj|}|jj dxsd}|j j }d|d|d|dScc}}w) z Returns a textual representation of this sentence. @return: A textual representation of this sentence. @rtype: C{str} typez: z, z unknown type)ritemssortedjoinrrr)r rkvdatadataReprtypeReprrs r __repr__z_BaseSentence.__repr__Gs""((*(.u E1f1#Rs EE99T?%%))&1C^NN++ 9+RzhZs;; Fs B BN)r __module__ __qualname____doc__setrrstr__annotations__r propertyrrr&r r rr sD8$'5C(*(( &<#r<s&L<L<^r