Ë
    ojp  ã                   ó<   — d Z ddlmZ  G d„ d«      Z G d„ d«      Zy)z6
Generic sentence handling tools: hopefully reusable.
é    )ÚSetc                   óX   — e Zd ZU dZ e«       Zee   ed<   d„ Z	e
d„ «       Zd„ Zdefd„Z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        | j                  «      S )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.presentAttributes1   s   € ô �D×&Ñ&Ó'Ð'r   c                 ó¨   — || j                   v r| j                  j                  |d«      S | j                  j                  }|› d|› d�}t        |«      ‚)z5
        Gets an attribute of this sentence.
        Nz sentences have no z attributes)r   r   ÚgetÚ	__class__Ú__name__ÚAttributeError)r	   ÚnameÚ	classNameÚmsgs       r   Ú__getattr__z_BaseSentence.__getattr__<   sX   € ð �4×*Ñ*Ñ*Ø×%Ñ%×)Ñ)¨$°Ó5Ð5àŸ™×/Ñ/ˆIØ�KÐ2°4°&¸ÐDˆCÜ  Ó%Ð%r   Úreturnc                 ó6  — | j                   j                  «       }t        |«      D ��cg c]  \  }}|dk7  sŒ|› d|› �‘Œ }}}dj                  |«      }| j                   j	                  d«      xs d}| j
                  j                  }d|› d|› d|› d�S c c}}w )	z˜
        Returns a textual representation of this sentence.

        @return: A textual representation of this sentence.
        @rtype: C{str}
        Útypez: z, zunknown typeú<z (z) {z}>)r   ÚitemsÚsortedÚjoinr   r   r   )r	   r   ÚkÚvÚdataÚdataReprÚtypeReprr   s           r   Ú__repr__z_BaseSentence.__repr__G   s›   € ð ×"Ñ"×(Ñ(Ó*ˆÜ(.¨u«×E¡  1¸¸f»�1�#�R˜�s’ÐEˆÑEØ—9‘9˜T“?ˆà×%Ñ%×)Ñ)¨&Ó1ÒC°^ˆØ—N‘N×+Ñ+ˆ	à�9�+˜R ˜z¨¨h¨Z°sÐ;Ð;ùó Fs
   ©B·	BN)r   Ú
__module__Ú__qualname__Ú__doc__Úsetr   r   ÚstrÚ__annotations__r   Úpropertyr   r   r&   © r   r   r   r   	   sD   … ññ8 $'£5Ð˜˜C™Ó(ò*ð ñ(ó ð(ò	&ð<˜#ô <r   r   c                   ó    — e Zd ZdZed„ «       Zy)Ú!_PositioningSentenceProducerMixina©  
    A mixin for certain protocols that produce positioning sentences.

    This mixin helps protocols that store the layout of sentences that they
    consume in a C{_SENTENCE_CONTENTS} class variable provide all sentence
    attributes that can ever occur. It does this by providing a class method,
    C{getSentenceAttributes}, which iterates over all sentence types and
    collects the possible sentence attributes.
    c                 ó€   — dh}| j                   j                  «       D ]  }|D ]  }|€Œ|j                  |«       Œ Œ |S )aR  
        Returns a set of all attributes that might be found in the sentences
        produced by this protocol.

        This is basically a set of all the attributes of all the sentences that
        this protocol can produce.

        @return: The set of all possible sentence attribute names.
        @rtype: C{set} of C{str}
        r   )Ú_SENTENCE_CONTENTSÚvaluesÚadd)ÚclsÚ
attributesÚattributeListÚ	attributes       r   ÚgetSentenceAttributesz7_PositioningSentenceProducerMixin.getSentenceAttributesc   sU   € ð �Xˆ
Ø ×3Ñ3×:Ñ:Ó<ò 	*ˆMØ*ò *�	ØÐ$ØØ—‘˜yÕ)ñ*ð	*ð Ðr   N)r   r'   r(   r)   Úclassmethodr9   r.   r   r   r0   r0   X   s   „ ñð ñó ñr   r0   N)r)   Útypingr   r   r0   r.   r   r   ú<module>r<      s&   ðñõ ÷L<ñ L<÷^ò r   