Ë
    Ìi!  ã                   ó@   — d Z ddlmZ ddlmZmZ d„ Z G d„ de«      Zy)a;  
This module contains the :class:`Column` class, which defines a "vertical"
array of tabular data. Whereas :class:`.Row` instances are independent of their
parent :class:`.Table`, columns depend on knowledge of both their position in
the parent (column name, data type) as well as the rows that contain their data.
é    )ÚMappedSequence)Ú	NullOrderÚmemoizec                 ó   — | €
t        «       S | S )z1
    Key method for sorting nulls correctly.
    )r   )Úks    úN/var/www/html/strategist-ai/venv/lib/python3.12/site-packages/agate/columns.pyÚnull_handlerr	      s   € ð 	€yÜ‹{Ðà€Hó    c                   ó¬   — e Zd ZdZg d¢Zdd„Zd„ Zd„ Zed„ «       Z	ed„ «       Z
ed	„ «       Zed
„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zy)ÚColumnaÄ  
    Proxy access to column data. Instances of :class:`Column` should
    not be constructed directly. They are created by :class:`.Table`
    instances and are unique to them.

    Columns are implemented as subclass of :class:`.MappedSequence`. They
    deviate from the underlying implementation in that loading of their data
    is deferred until it is needed.

    :param name:
        The name of this column.
    :param data_type:
        An instance of :class:`.DataType`.
    :param rows:
        A :class:`.MappedSequence` that contains the :class:`.Row` instances
        containing the data for this column.
    :param row_names:
        An optional list of row names (keys) for this column.
    )Ú_indexÚ_nameÚ
_data_typeÚ_rowsÚ
_row_namesNc                 óJ   — || _         || _        || _        || _        || _        y ©N©r   r   r   r   Ú_keys)ÚselfÚindexÚnameÚ	data_typeÚrowsÚ	row_namess         r   Ú__init__zColumn.__init__,   s%   € ØˆŒØˆŒ
Ø#ˆŒØˆŒ
Øˆ�
r
   c                 óv   — | j                   | j                  | j                  | j                  | j                  dœS )zz
        Return state values to be pickled.

        This is necessary on Python2.7 when using :code:`__slots__`.
        r   r   ©r   s    r   Ú__getstate__zColumn.__getstate__3   s1   € ð —k‘kØ—Z‘ZØŸ/™/Ø—Z‘ZØ—Z‘Zñ
ð 	
r
   c                 óh   — |d   | _         |d   | _        |d   | _        |d   | _        |d   | _        y)zn
        Restore pickled state.

        This is necessary on Python2.7 when using :code:`__slots__`.
        r   r   r   r   r   Nr   )r   Údatas     r   Ú__setstate__zColumn.__setstate__A   s<   € ð ˜8‘nˆŒØ˜'‘]ˆŒ
Ø˜|Ñ,ˆŒØ˜'‘]ˆŒ
Ø˜'‘]ˆ�
r
   c                 ó   — | j                   S )z&
        This column's index.
        ©r   r   s    r   r   zColumn.indexM   s   € ð
 �{‰{Ðr
   c                 ó   — | j                   S )z%
        This column's name.
        )r   r   s    r   r   zColumn.nameT   s   € ð
 �z‰zÐr
   c                 ó   — | j                   S )z*
        This column's data type.
        )r   r   s    r   r   zColumn.data_type[   s   € ð
 �‰Ðr
   c                 ó@   ‡ — t        ˆ fd„‰ j                  D «       «      S )z<
        Get the values in this column, as a tuple.
        c              3   ó<   •K  — | ]  }|‰j                      –— Œ y ­wr   r$   )Ú.0Úrowr   s     €r   ú	<genexpr>z Column.values.<locals>.<genexpr>g   s   øè ø€ Ò<¨#�S˜Ÿ™Õ%Ñ<ùs   ƒ)Útupler   r   s   `r   ÚvalueszColumn.valuesb   s   ø€ ô
 Ó<°·±Ô<Ó<Ð<r
   c                 óF   — t        t        | j                  «       «      «      S )zE
        Get the distinct values in this column, as a tuple.
        )r,   Úsetr-   r   s    r   Úvalues_distinctzColumn.values_distincti   s   € ô
 ”S˜Ÿ™›Ó'Ó(Ð(r
   c                 óB   — t        d„ | j                  «       D «       «      S )zM
        Get the values in this column with any null values removed.
        c              3   ó&   K  — | ]	  }|€Œ|–— Œ y ­wr   © )r)   Úds     r   r+   z.Column.values_without_nulls.<locals>.<genexpr>u   s   è ø€ Ò?˜1°±”QÑ?ùs   ‚Š)r,   r-   r   s    r   Úvalues_without_nullszColumn.values_without_nullsp   s   € ô
 Ñ? §¡£Ô?Ó?Ð?r
   c                 ó@   — t        | j                  «       t        ¬«      S )z7
        Get the values in this column sorted.
        ©Úkey)Úsortedr-   r	   r   s    r   Úvalues_sortedzColumn.values_sortedw   s   € ô
 �d—k‘k“m¬Ô6Ð6r
   c                 ó@   — t        | j                  «       t        ¬«      S )zX
        Get the values in this column with any null values removed and sorted.
        r7   )r9   r5   r	   r   s    r   Úvalues_without_nulls_sortedz"Column.values_without_nulls_sorted~   s   € ô
 �d×/Ñ/Ó1´|ÔDÐDr
   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   r"   Úpropertyr   r   r   r   r-   r0   r5   r:   r<   r3   r
   r   r   r      sÂ   „ ñò& I€Ióò
ò
#ð ñó ðð ñó ðð ñó ðð ñ=ó ð=ð ñ)ó ð)ð ñ@ó ð@ð ñ7ó ð7ð ñEó ñEr
   r   N)r@   Úagate.mapped_sequencer   Úagate.utilsr   r   r	   r   r3   r
   r   ú<module>rE      s'   ðñõ 1ß *òômEˆ^õ mEr
   