§
    ­-Ph|  ã                  ó|   — d dl mZ d dlmZmZmZmZ erd dlmZ  edd¬¦  «        Z	 G d„ dee	         ¦  «        Z
d	S )
é    )Úannotations)ÚTYPE_CHECKINGÚCallableÚGenericÚTypeVar)ÚExprÚExprTr   )Úboundc                  óF   — e Zd Zdd„Zdd„Zdd	„Zdd„Zdd„Zdd„Zdd„Z	dS )ÚExprNameNamespaceÚexprr	   ÚreturnÚNonec                ó   — || _         d S ©N)Ú_expr)Úselfr   s     úR/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/narwhals/expr_name.pyÚ__init__zExprNameNamespace.__init__   s   € ØˆŒ
ˆ
ˆ
ó    c                ó>   ‡ — ‰ j                              ˆ fd„¦  «        S )a²  Keep the original root name of the expression.

        Returns:
            A new expression.

        Notes:
            This will undo any previous renaming operations on the expression.
            Due to implementation constraints, this method can only be called as the last
            expression in a chain. Only one name operation per expression will work.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"foo": [1, 2], "BAR": [4, 5]})
            >>> df = nw.from_native(df_native)
            >>> df.select(nw.col("foo").alias("alias_for_foo").name.keep()).columns
            ['foo']
        c                óf   •— ‰j                              | ¦  «        j                             ¦   «         S r   )r   Ú_to_compliant_exprÚnameÚkeep©Úplxr   s    €r   ú<lambda>z(ExprNameNamespace.keep.<locals>.<lambda>#   s&   ø€ ˜œ
×5Ò5°cÑ:Ô:Ô?×DÒDÑFÔF€ r   ©r   Ú_with_elementwise_op©r   s   `r   r   zExprNameNamespace.keep   s+   ø€ ð& Œz×.Ò.ØFÐFÐFÐFñ
ô 
ð 	
r   ÚfunctionúCallable[[str], str]c                óB   ‡ ‡— ‰ j                              ˆˆ fd„¦  «        S )at  Rename the output of an expression by mapping a function over the root name.

        Arguments:
            function: Function that maps a root name to a new name.

        Returns:
            A new expression.

        Notes:
            This will undo any previous renaming operations on the expression.
            Due to implementation constraints, this method can only be called as the last
            expression in a chain. Only one name operation per expression will work.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"foo": [1, 2], "BAR": [4, 5]})
            >>> df = nw.from_native(df_native)
            >>> renaming_func = lambda s: s[::-1]  # reverse column name
            >>> df.select(nw.col("foo", "BAR").name.map(renaming_func)).columns
            ['oof', 'RAB']
        c                óh   •— ‰j                              | ¦  «        j                             ‰¦  «        S r   )r   r   r   Úmap)r   r"   r   s    €€r   r   z'ExprNameNamespace.map.<locals>.<lambda>>   s(   ø€ ˜œ
×5Ò5°cÑ:Ô:Ô?×CÒCÀHÑMÔM€ r   r   )r   r"   s   ``r   r&   zExprNameNamespace.map&   s/   øø€ ð. Œz×.Ò.ØMÐMÐMÐMÐMñ
ô 
ð 	
r   ÚprefixÚstrc                óB   ‡ ‡— ‰ j                              ˆˆ fd„¦  «        S )a&  Add a prefix to the root column name of the expression.

        Arguments:
            prefix: Prefix to add to the root column name.

        Returns:
            A new expression.

        Notes:
            This will undo any previous renaming operations on the expression.
            Due to implementation constraints, this method can only be called as the last
            expression in a chain. Only one name operation per expression will work.

        Examples:
            >>> import polars as pl
            >>> import narwhals as nw
            >>> df_native = pl.DataFrame({"foo": [1, 2], "BAR": [4, 5]})
            >>> df = nw.from_native(df_native)
            >>> df.select(nw.col("foo", "BAR").name.prefix("with_prefix")).columns
            ['with_prefixfoo', 'with_prefixBAR']
        c                óh   •— ‰j                              | ¦  «        j                             ‰¦  «        S r   )r   r   r   r'   )r   r'   r   s    €€r   r   z*ExprNameNamespace.prefix.<locals>.<lambda>X   ó(   ø€ ˜œ
×5Ò5°cÑ:Ô:Ô?×FÒFÀvÑNÔN€ r   r   )r   r'   s   ``r   r'   zExprNameNamespace.prefixA   ó/   øø€ ð, Œz×.Ò.ØNÐNÐNÐNÐNñ
ô 
ð 	
r   Úsuffixc                óB   ‡ ‡— ‰ j                              ˆ ˆfd„¦  «        S )a)  Add a suffix to the root column name of the expression.

        Arguments:
            suffix: Suffix to add to the root column name.

        Returns:
            A new expression.

        Notes:
            This will undo any previous renaming operations on the expression.
            Due to implementation constraints, this method can only be called as the last
            expression in a chain. Only one name operation per expression will work.

        Examples:
            >>> import polars as pl
            >>> import narwhals as nw
            >>> df_native = pl.DataFrame({"foo": [1, 2], "BAR": [4, 5]})
            >>> df = nw.from_native(df_native)
            >>> df.select(nw.col("foo", "BAR").name.suffix("_with_suffix")).columns
            ['foo_with_suffix', 'BAR_with_suffix']
        c                óh   •— ‰j                              | ¦  «        j                             ‰¦  «        S r   )r   r   r   r-   )r   r   r-   s    €€r   r   z*ExprNameNamespace.suffix.<locals>.<lambda>r   r+   r   r   )r   r-   s   ``r   r-   zExprNameNamespace.suffix[   r,   r   c                ó>   ‡ — ‰ j                              ˆ fd„¦  «        S )a¤  Make the root column name lowercase.

        Returns:
            A new expression.

        Notes:
            This will undo any previous renaming operations on the expression.
            Due to implementation constraints, this method can only be called as the last
            expression in a chain. Only one name operation per expression will work.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"foo": [1, 2], "BAR": [4, 5]})
            >>> df = nw.from_native(df_native)
            >>> df.select(nw.col("foo", "BAR").name.to_lowercase()).columns
            ['foo', 'bar']
        c                óf   •— ‰j                              | ¦  «        j                             ¦   «         S r   )r   r   r   Úto_lowercaser   s    €r   r   z0ExprNameNamespace.to_lowercase.<locals>.<lambda>‰   ó&   ø€ ˜œ
×5Ò5°cÑ:Ô:Ô?×LÒLÑNÔN€ r   r   r!   s   `r   r2   zExprNameNamespace.to_lowercaseu   ó+   ø€ ð& Œz×.Ò.ØNÐNÐNÐNñ
ô 
ð 	
r   c                ó>   ‡ — ‰ j                              ˆ fd„¦  «        S )a¤  Make the root column name uppercase.

        Returns:
            A new expression.

        Notes:
            This will undo any previous renaming operations on the expression.
            Due to implementation constraints, this method can only be called as the last
            expression in a chain. Only one name operation per expression will work.

        Examples:
            >>> import pyarrow as pa
            >>> import narwhals as nw
            >>> df_native = pa.table({"foo": [1, 2], "BAR": [4, 5]})
            >>> df = nw.from_native(df_native)
            >>> df.select(nw.col("foo", "BAR").name.to_uppercase()).columns
            ['FOO', 'BAR']
        c                óf   •— ‰j                              | ¦  «        j                             ¦   «         S r   )r   r   r   Úto_uppercaser   s    €r   r   z0ExprNameNamespace.to_uppercase.<locals>.<lambda>    r3   r   r   r!   s   `r   r7   zExprNameNamespace.to_uppercaseŒ   r4   r   N)r   r	   r   r   )r   r	   )r"   r#   r   r	   )r'   r(   r   r	   )r-   r(   r   r	   )
Ú__name__Ú
__module__Ú__qualname__r   r   r&   r'   r-   r2   r7   © r   r   r   r      s    € € € € € ðð ð ð ð
ð 
ð 
ð 
ð.
ð 
ð 
ð 
ð6
ð 
ð 
ð 
ð4
ð 
ð 
ð 
ð4
ð 
ð 
ð 
ð.
ð 
ð 
ð 
ð 
ð 
r   r   N)Ú
__future__r   Útypingr   r   r   r   Únarwhals.exprr   r	   r   r;   r   r   ú<module>r?      s«   ðØ "Ð "Ð "Ð "Ð "Ð "à <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <àð #Ø"Ð"Ð"Ð"Ð"Ð"àˆ˜vÐ&Ñ&Ô&€ðV
ð V
ð V
ð V
ð V
˜ œñ V
ô V
ð V
ð V
ð V
r   