Ë
    èlÖiÏ  ã                   óB   — d Z ddlmZ ddlmZ ddlmZ  G d„ de«      Zy)zµ
This module contains the :class:`MappedSequence` class that forms the foundation
for agate's :class:`.Row` and :class:`.Column` as well as for named sequences of
rows and columns.
é    )ÚOrderedDict)ÚSequence)Úmemoizec                   ó¦   — e Zd ZdZddgZdd„Zd„ Zd„ Zd„ Zd	„ Z	d
„ Z
d„ Zd„ Zd„ Zed„ «       Zd„ Zd„ Zd„ Zd„ Zd„ Zed„ «       Zdd„Zed„ «       Zy)ÚMappedSequencea¯  
    A generic container for immutable data that can be accessed either by
    numeric index or by key. This is similar to an
    :class:`collections.OrderedDict` except that the keys are optional and
    iteration over it returns the values instead of keys.

    This is the base class for both :class:`.Column` and :class:`.Row`.

    :param values:
        A sequence of values.
    :param keys:
        A sequence of keys.
    Ú_valuesÚ_keysNc                 óF   — t        |«      | _        |�|| _        y d | _        y ©N)Útupler   r	   )ÚselfÚvaluesÚkeyss      úZ/var/www/html/strategist-ai/venv_dbt/lib/python3.12/site-packages/agate/mapped_sequence.pyÚ__init__zMappedSequence.__init__   s!   € Ü˜V“}ˆŒàÐØˆD�JàˆD�Jó    c                 ó4   — | j                   | j                  dœS )zz
        Return state values to be pickled.

        This is necessary on Python2.7 when using :code:`__slots__`.
        ©r   r	   r   ©r   s    r   Ú__getstate__zMappedSequence.__getstate__%   s   € ð —|‘|Ø—Z‘Zñ
ð 	
r   c                 ó,   — |d   | _         |d   | _        y)zn
        Restore pickled state.

        This is necessary on Python2.7 when using :code:`__slots__`.
        r   r	   Nr   )r   Údatas     r   Ú__setstate__zMappedSequence.__setstate__0   s   € ð ˜I‘ˆŒØ˜'‘]ˆ�
r   c                 ó²   — dj                  d„ | j                  «       dd D «       «      }t        | «      dkD  rd|z  }dt        | «      j                  › d|› d�S )	zJ
        Print a unicode sample of the contents of this sequence.
        z, c              3   ó2   K  — | ]  }t        |«      –— Œ y ­wr   )Úrepr)Ú.0Úds     r   ú	<genexpr>z-MappedSequence.__unicode__.<locals>.<genexpr>=   s   è ø€ Ò> qœ4 Ÿ7Ñ>ùs   ‚Né   z%s, ...z<agate.z: (z)>)Újoinr   ÚlenÚtypeÚ__name__)r   Úsamples     r   Ú__unicode__zMappedSequence.__unicode__9   sZ   € ð —‘Ñ>¨D¯K©K«M¸"¸1Ð,=Ô>Ó>ˆäˆt‹9�qŠ=Ø Ñ'ˆFàœ˜d›×,Ñ,Ð-¨S°°¸Ð;Ð;r   c                 ó4   — t        | j                  «       «      S )zI
        Print an ascii sample of the contents of this sequence.
        )Ústrr&   r   s    r   Ú__str__zMappedSequence.__str__D   s   € ô �4×#Ñ#Ó%Ó&Ð&r   c                 ó"   — | j                  «       S r   )r)   r   s    r   Ú__repr__zMappedSequence.__repr__J   s   € Ø�|‰|‹~Ðr   c                 ó  ‡— t        |t        «      rDt        |j                  t	        | «      «      Ž }| j                  «       Št        ˆfd„|D «       «      S t        |«      t        u r| j                  «       |   S | j                  «       |   S )zI
        Retrieve values from this array by index, slice or key.
        c              3   ó(   •K  — | ]	  }‰|   –— Œ y ­wr   © )r   Úir   s     €r   r   z-MappedSequence.__getitem__.<locals>.<genexpr>T   s   øè ø€ Ò4 q˜ �Ñ4ùs   ƒ)
Ú
isinstanceÚsliceÚrangeÚindicesr"   r   r   r#   ÚintÚdict)r   Úkeyr3   r   s      @r   Ú__getitem__zMappedSequence.__getitem__M   sp   ø€ ô �cœ5Ô!Ü˜SŸ[™[¬¨T«Ó3Ð4ˆGØ—[‘[“]ˆFÜÓ4¨GÔ4Ó4Ð4ä�#‹Yœ#ÑØ—;‘;“= Ñ%Ð%Ø�y‰y‹{˜3ÑÐr   c                 ó   — t        d«      ‚)zD
        Set values by index, which we want to fail loudly.
        zYRows and columns can not be modified directly. You probably need to compute a new column.)Ú	TypeError)r   r6   Úvalues      r   Ú__setitem__zMappedSequence.__setitem__Z   s   € ô ÐsÓtÐtr   c                 ó4   — t        | j                  «       «      S )z&
        Iterate over values.
        )Úiterr   r   s    r   Ú__iter__zMappedSequence.__iter__`   s   € ô �D—K‘K“MÓ"Ð"r   c                 ó4   — t        | j                  «       «      S r   )r"   r   r   s    r   Ú__len__zMappedSequence.__len__f   s   € ä�4—;‘;“=Ó!Ð!r   c                 ó\   — t        |t        «      sy| j                  «       t        |«      k(  S )z5
        Equality test with other sequences.
        F)r0   r   r   r   ©r   Úothers     r   Ú__eq__zMappedSequence.__eq__j   s&   € ô ˜%¤Ô*Øà�{‰{‹}¤ e£Ñ,Ð,r   c                 ó&   — | j                  |«       S )z7
        Inequality test with other sequences.
        )rD   rB   s     r   Ú__ne__zMappedSequence.__ne__s   s   € ð —;‘;˜uÓ%Ð%Ð%r   c                 ó@   — | j                  «       j                  |«      S r   )r   Ú__contains__)r   r:   s     r   rH   zMappedSequence.__contains__y   s   € Ø�{‰{‹}×)Ñ)¨%Ó0Ð0r   c                 ó   — | j                   S )zE
        Equivalent to :meth:`collections.OrderedDict.keys`.
        )r	   r   s    r   r   zMappedSequence.keys|   s   € ð �z‰zÐr   c                 ó   — | j                   S )zG
        Equivalent to :meth:`collections.OrderedDict.values`.
        )r   r   s    r   r   zMappedSequence.values‚   s   € ð �|‰|Ðr   c                 ód   — t        t        | j                  «       | j                  «       «      «      S )zF
        Equivalent to :meth:`collections.OrderedDict.items`.
        )r   Úzipr   r   r   s    r   ÚitemszMappedSequence.itemsˆ   s"   € ô
 ”S˜Ÿ™› d§k¡k£mÓ4Ó5Ð5r   c                 óT   — 	 | j                  «       |   S # t        $ r	 |r|cY S Y yw xY w)zD
        Equivalent to :meth:`collections.OrderedDict.get`.
        N)r5   ÚKeyError)r   r6   Údefaults      r   ÚgetzMappedSequence.get�   s2   € ð	Ø—9‘9“;˜sÑ#Ð#øÜò 	ÙØ’Ùð	ús   ‚ •'¦'c                 ó`   — | j                  «       €t        ‚t        | j                  «       «      S )zh
        Retrieve the contents of this sequence as an
        :class:`collections.OrderedDict`.
        )r   rO   r   rM   r   s    r   r5   zMappedSequence.dictš   s&   € ð �9‰9‹;ÐÜˆNä˜4Ÿ:™:›<Ó(Ð(r   r   )r$   Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   r   r&   r)   r+   r7   r;   r>   r   r@   rD   rF   rH   r   r   rM   rQ   r5   r.   r   r   r   r      s›   „ ñð ˜GÐ$€Ióò	
ò#ò	<ò'òò òuò#ð ñ"ó ð"ò-ò&ò1òòð ñ6ó ð6ó	ð ñ)ó ñ)r   r   N)rU   Úcollectionsr   Úcollections.abcr   Úagate.utilsr   r   r.   r   r   ú<module>rZ      s#   ðñõ $Ý $å ôV)�Xõ V)r   