§
    Ètºfp  ã                   óJ   — d Z ddlmZ  G d„ d¦  «        Z G d„ d¦  «        ZdS )z6
Generic sentence handling tools: hopefully reusable.
é    )ÚSetc                   ól   — 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dS )	Ú_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                 ó   — || _         dS )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     ú\/var/www/surfInsights/venv3-11/lib/python3.11/site-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                             |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__<   sY   € ð �4Ô*Ð*Ð*ØÔ%×)Ò)¨$°Ñ5Ô5Ð5àœÔ/ˆIØÐDÐD°4ÐDÐDÐDˆCÝ  Ñ%Ô%Ð%r   Úreturnc                 óø   — | j                              ¦   «         }d„ t          |¦  «        D ¦   «         }d                     |¦  «        }| j                              d¦  «        pd}| j        j        }d|› d|› d|› d�S )	z˜
        Returns a textual representation of this sentence.

        @return: A textual representation of this sentence.
        @rtype: C{str}
        c                 ó.   — g | ]\  }}|d k    ¯|› d|› �‘ŒS )Útypez: © )Ú.0ÚkÚvs      r   ú
<listcomp>z*_BaseSentence.__repr__.<locals>.<listcomp>O   s+   € ÐEÐEÐE¡  1¸¸fº¸�1��˜��¸¸¸r   z, r   zunknown typeú<z (z) {z}>)r   ÚitemsÚsortedÚjoinr   r   r   )r	   r$   ÚdataÚdataReprÚtypeReprr   s         r   Ú__repr__z_BaseSentence.__repr__G   s†   € ð Ô"×(Ò(Ñ*Ô*ˆØEÐE­¨u©¬ÐEÑEÔEˆØ—9’9˜T‘?”?ˆàÔ%×)Ò)¨&Ñ1Ô1ÐC°^ˆØ”NÔ+ˆ	à;�9Ð;Ð; Ð;Ð;¨hÐ;Ð;Ð;Ð;r   N)r   Ú
__module__Ú__qualname__Ú__doc__Úsetr   r   ÚstrÚ__annotations__r   Úpropertyr   r   r*   r   r   r   r   r   	   s‘   € € € € € € ðð ð8 $' 3¡5¤5Ð˜˜CœÐ(Ð(Ñ(ð*ð *ð *ð ð(ð (ñ „Xð(ð	&ð 	&ð 	&ð<˜#ð <ð <ð <ð <ð <ð <r   r   c                   ó(   — e Zd ZdZed„ ¦   «         ZdS )Ú!_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                              ¦   «         D ]}|D ]}|€Œ|                     |¦  «         ŒŒ |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   sc   € ð �Xˆ
Ø Ô3×:Ò:Ñ<Ô<ð 	*ð 	*ˆMØ*ð *ð *�	ØÐ$ØØ—’˜yÑ)Ô)Ð)Ð)ð*ð
 Ðr   N)r   r+   r,   r-   Úclassmethodr<   r   r   r   r3   r3   X   s9   € € € € € ðð ð ðð ñ „[ðð ð r   r3   N)r-   Útypingr   r   r3   r   r   r   ú<module>r?      s†   ððð ð Ð Ð Ð Ð Ð ðL<ð L<ð L<ð L<ð L<ñ L<ô L<ð L<ð^ð ð ð ð ñ ô ð ð ð r   