o
    $&]iE	                     @  s   d dl mZ d dlmZmZ d dlmZ er8d dlmZm	Z	 d dl
mZ d dlmZ d dlmZmZ d dlmZ G d	d
 d
ZG dd dZdS )    )annotations)TYPE_CHECKINGcast)is_sequence_of)IteratorSequence)GroupBy)LazyGroupBy)PolarsDataFramePolarsLazyFrame)
PolarsExprc                   @  sJ   e Zd ZU ded< ded< edddZdddZdddZdddZdS )PolarsGroupByr
   _compliant_frameNativeGroupBy_groupedreturnc                 C     | j S Nr   self r   W/var/www/html/IGF-ODF-V3/venv/lib/python3.10/site-packages/narwhals/_polars/group_by.py	compliant      zPolarsGroupBy.compliantdfkeys$Sequence[PolarsExpr] | Sequence[str]drop_null_keysboolNonec               C  Z   t || _|r||n|| _t|tr| jj|| _	d S | jjdd |D | _	d S )Nc                 s      | ]}|j V  qd S r   native.0argr   r   r   	<genexpr>&       z)PolarsGroupBy.__init__.<locals>.<genexpr>
list_keys
drop_nullsr   r   strr   r$   group_byr   r   r   r   r   r   r   r   __init__      
zPolarsGroupBy.__init__aggsr   c                 G  "   | j dd |D }| j|S )Nc                 s  r"   r   r#   r%   r   r   r   r(   *   r)   z$PolarsGroupBy.agg.<locals>.<genexpr>r   aggr   _with_nativer   r3   
agg_resultr   r   r   r6   )      zPolarsGroupBy.agg1Iterator[tuple[tuple[str, ...], PolarsDataFrame]]c                 c  s2    | j D ]\}}ttd|| j|fV  qd S )Nr.   )r   tupler   r   r7   )r   keyr   r   r   r   __iter__-   s   zPolarsGroupBy.__iter__N)r   r
   )r   r
   r   r   r   r   r   r    )r3   r   r   r
   )r   r;   )	__name__
__module____qualname____annotations__propertyr   r1   r6   r>   r   r   r   r   r      s   
 

r   c                   @  s@   e Zd ZU ded< ded< edddZdddZdddZdS )PolarsLazyGroupByr   r   NativeLazyGroupByr   r   c                 C  r   r   r   r   r   r   r   r   6   r   zPolarsLazyGroupBy.compliantr   r   r   r   r   r    c               C  r!   )Nc                 s  r"   r   r#   r%   r   r   r   r(   G   r)   z-PolarsLazyGroupBy.__init__.<locals>.<genexpr>r*   r0   r   r   r   r1   :   r2   zPolarsLazyGroupBy.__init__r3   r   c                 G  r4   )Nc                 s  r"   r   r#   r%   r   r   r   r(   K   r)   z(PolarsLazyGroupBy.agg.<locals>.<genexpr>r5   r8   r   r   r   r6   J   r:   zPolarsLazyGroupBy.aggN)r   r   )r   r   r   r   r   r   r   r    )r3   r   r   r   )r?   r@   rA   rB   rC   r   r1   r6   r   r   r   r   rD   2   s   
 
rD   N)
__future__r   typingr   r   narwhals._utilsr   collections.abcr   r   polars.dataframe.group_byr   r   polars.lazyframe.group_byr	   rE   narwhals._polars.dataframer
   r   narwhals._polars.exprr   r   rD   r   r   r   r   <module>   s    !