Ë
    ÌiP
  ã                   ó    — d dl mZ g fd„Zd„ Zy)é    )ÚTablec                 óŠ  — ddl m} g }t        | j                  d   |«      r¨| j	                  «       D ]@  \  }}t        ||«      \  }}}}	|D ]%  }
|
j                  d|«       |j                  |
«       Œ' ŒB j                  d| j                  «       j                  d| j                  «       	j                  d| j                  «       nõ| j                  g}| j                  g}| j                  g}	|D ]@  \  }}|j                  |«       |j                  |j                  | j                  «      «       ŒB | j	                  «       D ]   \  }}|D ]  \  }}|j                  |«       Œ Œ" | j	                  «       D ]C  \  }}|g}|D ]%  \  }}|j                  |j                  |«      «       Œ' |j                  |«       ŒE ||||	fS )z\
    Recursive aggregation allowing for TableSet's to be nested inside
    one another.
    r   )ÚTableSet)Úagate.tablesetr   Ú
isinstanceÚ_valuesÚitemsÚ
_aggregateÚinsertÚappendÚ	_key_nameÚ	_key_typeÚget_aggregate_data_typeÚ_sample_tableÚvalidateÚrun)ÚselfÚaggregationsr   ÚoutputÚkeyÚnested_tablesetÚcolumn_namesÚcolumn_typesÚnested_outputÚrow_name_columnsÚrowÚnew_column_nameÚaggregationÚnameÚtableÚnew_rows                   úY/var/www/html/strategist-ai/venv/lib/python3.12/site-packages/agate/tableset/aggregate.pyr
   r
      sË  € õ
 (à€Fô �$—,‘,˜q‘/ 8Ô,Ø$(§J¡J£Lò 	#Ñ ˆC�ÜJTÐUdÐfrÓJsÑGˆL˜,¨Ð7Gà$ò #�Ø—
‘
˜1˜cÔ"à—‘˜cÕ"ñ#ð	#ð 	×Ñ˜A˜tŸ~™~Ô.Ø×Ñ˜A˜tŸ~™~Ô.Ø×Ñ  4§>¡>Õ2ð Ÿ™Ð'ˆØŸ™Ð'ˆØ ŸN™NÐ+Ðà,8ò 	YÑ(ˆO˜[Ø×Ñ Ô0Ø×Ñ × CÑ CÀD×DVÑDVÓ WÕXð	Yð  Ÿ:™:›<ò 	,‰KˆD�%Ø0<ò ,Ñ,� Ø×$Ñ$ UÕ+ñ,ð	,ð  Ÿ:™:›<ò 	#‰KˆD�%Ø�fˆGà0<ò 7Ñ,� Ø—‘˜{Ÿ™¨uÓ5Õ6ð7ð �M‰M˜'Õ"ð	#ð ˜ vÐ/?Ð?Ð?ó    c                 óv   ‡— t        | |«      \  }}}Št        ‰«      dk(  r‰d   }nˆfd„}t        ||||¬«      S )aà  
    Aggregate data from the tables in this set by performing some
    set of column operations on the groups and coalescing the results into
    a new :class:`.Table`.

    :code:`aggregations` must be a sequence of tuples, where each has two
    parts: a :code:`new_column_name` and a :class:`.Aggregation` instance.

    The resulting table will have the keys from this :class:`TableSet` (and
    any nested TableSets) set as its :code:`row_names`. See
    :meth:`.Table.__init__` for more details.

    :param aggregations:
        A list of tuples in the format :code:`(new_column_name, aggregation)`,
        where each :code:`aggregation` is an instance of :class:`.Aggregation`.
    :returns:
        A new :class:`.Table`.
    é   r   c                 ó.   •‡ — t        ˆ fd„‰D «       «      S )Nc              3   ó(   •K  — | ]	  }‰|   –— Œ y ­w)N© )Ú.0ÚnÚrs     €r"   ú	<genexpr>z/aggregate.<locals>.row_names.<locals>.<genexpr>L   s   øè ø€ Ò8 !˜˜1�Ñ8ùs   ƒ)Útuple)r+   r   s   `€r"   Ú	row_nameszaggregate.<locals>.row_namesK   s   ù€ ÜÓ8Ð'7Ô8Ó8Ð8r#   )r.   )r
   Úlenr   )r   r   r   r   r   r.   r   s         @r"   Ú	aggregater0   3   sL   ø€ ô& <FÀdÈLÓ;YÑ8€L�, Ð(8ä
ÐÓ Ò!Ø$ QÑ'‰	ô	9ô �˜ |¸yÔIÐIr#   N)Úagate.tabler   r
   r0   r(   r#   r"   ú<module>r2      s   ðÝ ð #%ó ,@ó^Jr#   