Ë
    ÌiC  ã                   óB   — d dl mZ d dlmZmZmZmZ  G d„ d«      Zd„ Zy)é    )ÚDataType)ÚDIMENSION_NAMESÚDatumÚXÚYc                   óR   — e Zd ZdZdd„Zd„ Zd„ Zed„ «       Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zy)ÚSeriesaî  
    A series of data and its associated metadata.

    Series object does not modify the data it is passed.

    :param data:
        A sequence (rows) of sequences (columns), a.k.a. :func:`csv.reader`
        format. If the :code:`x` and :code:`y` are not specified then the first
        column is used as the X values and the second column is used for Y.

        Or, a sequence of (rows) of dicts (columns), a.k.a.
        :class:`csv.DictReader` format. If this format is used then :code:`x`
        and :code:`y` arguments must specify the columns to be charted.

        Or, a custom data format, in which case :code:`x` and :code:`y` must
        specify :func:`.key_function`.
    :param x:
        If using sequence row data, then this may be either an integer index
        identifying the X column, or a :func:`.key_function`.

        If using dict row data, then this may be either a key name identifying
        the X column, or a :func:`.key_function`.

        If using a custom data format, then this must be a
        :func:`.key_function`.`
    :param y:
        See :code:`x`.
    :param name:
        An optional name to be used in labeling this series. This will be
        used as the chart title if rendered in a :class:`.Lattice`.
    Nc                 óì   — || _         || _        | j                  |�|nt        «      | j                  |�|nt        «      g| _        | j                  t        «      | j                  t        «      g| _        y ©N)Ú_dataÚ_nameÚ	_make_keyr   r   Ú_keysÚ_infer_typeÚ_types)ÚselfÚdataÚxÚyÚnames        úT/var/www/html/strategist-ai/venv/lib/python3.12/site-packages/leather/series/base.pyÚ__init__zSeries.__init__%   sf   € ØˆŒ
ØˆŒ
ð �N‰N  ™1´1Ó5Ø�N‰N  ™1´1Ó5ð
ˆŒ
ð ×ÑœQÓØ×ÑœQÓð
ˆ�ó    c                 ó(   ‡— t        ‰«      r‰S ˆfd„S )zX
        Process a user-specified data key and convert to a function if needed.
        c                 ó   •— | ‰   S r   © )ÚrowÚindexÚkeys     €r   ú<lambda>z"Series._make_key.<locals>.<lambda>9   s   ø€  # c¡(€ r   )Úcallable)r   r   s    `r   r   zSeries._make_key3   s   ø€ ô �CŒ=ØˆJÛ*Ð*r   c                 óÌ   — | j                   |   }t        | j                  «      D ]  \  }} |||«      }|€Œ n €t        dt        |   z  «      ‚t        j                  |«      S )zI
        Infer the datatype of this column by sampling the data.
        z$All values in %s dimension are null.)r   Ú	enumerater   Ú
ValueErrorr   r   Úinfer)r   Ú	dimensionr   Úir   Úvs         r   r   zSeries._infer_type;   sn   € ð �j‰j˜Ñ#ˆä §
¡
Ó+ò 	‰FˆAˆsÙ�C˜“ˆAà‰}Ùð		ð ˆ9ÜÐCÄoÐV_ÑF`Ñ`ÓaÐaä�~‰~˜aÓ Ð r   c                 ó   — | j                   S r   )r   )r   s    r   r   zSeries.nameL   s   € à�z‰zÐr   c                 ó    — | j                   |   S )zF
        Return the data type for a dimension of this series.
        )r   ©r   r&   s     r   Ú	data_typezSeries.data_typeP   s   € ð �{‰{˜9Ñ%Ð%r   c           	   #   óÐ   K  — | j                   t           }| j                   t           }t        | j                  «      D ]$  \  }}t        | |||«       |||«      d|«      –— Œ& y­w)z.
        Return data for this series.
        N)r   r   r   r#   r   r   )r   r   r   r'   r   s        r   r   zSeries.dataV   s]   è ø€ ð �J‰J”q‰MˆØ�J‰J”q‰Mˆä §
¡
Ó+ò 	<‰FˆAˆsÜ˜™1˜S !›9¡a¨¨Q£i°°sÓ;Ó;ñ	<ùs   ‚A$A&c                 óŠ   — | j                   |   }t        | j                  «      D ��cg c]  \  }} |||«      ‘Œ c}}S c c}}w )zS
        Get a flattened list of values for a given dimension of the data.
        )r   r#   r   )r   r&   r   r'   r   s        r   ÚvalueszSeries.values`   s9   € ð �j‰j˜Ñ#ˆä*3°D·J±JÓ*?×@¡  3‘�C˜•Ó@Ð@ùÓ@s   ¨?c                 óD   — t        d„ | j                  |«      D «       «      S )úA
        Compute the minimum value of a given dimension.
        c              3   ó&   K  — | ]	  }|€Œ|–— Œ y ­wr   r   ©Ú.0r(   s     r   ú	<genexpr>zSeries.min.<locals>.<genexpr>l   ó   è ø€ ÒF˜¸¹”1ÑFùó   ‚Š)Úminr/   r+   s     r   r8   z
Series.minh   ó   € ô ÑF˜dŸk™k¨)Ó4ÔFÓFÐFr   c                 óD   — t        d„ | j                  |«      D «       «      S )r1   c              3   ó&   K  — | ]	  }|€Œ|–— Œ y ­wr   r   r3   s     r   r5   zSeries.max.<locals>.<genexpr>r   r6   r7   )Úmaxr/   r+   s     r   r<   z
Series.maxn   r9   r   )NNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   Úpropertyr   r,   r   r/   r8   r<   r   r   r   r	   r	      sF   „ ñó>
ò+ò!ð" ñó ðò&ò<òAòGóGr   r	   c                  ó   — y)a…  
    This example shows how to define a function to extract X and Y values
    from custom data.

    :param row:
        The function will be called with the row data, in whatever format it
        was provided to the :class:`.Series`.
    :param index:
        The row index in the series data will also be provided.
    :returns:
        The function must return a chartable value.
    Nr   )r   r   s     r   Úkey_functionrC   u   s   € ð 	r   N)	Úleather.data_typesr   Úleather.utilsr   r   r   r   r	   rC   r   r   r   ú<module>rF      s"   ðÝ 'ß 6Ó 6÷mGñ mGó`	r   