o
    $&]i                     @  sh   d dl mZ d dlmZmZmZmZ d dlmZm	Z	 er"d dl
mZ edddZG dd	 d	ee Zd
S )    )annotations)TYPE_CHECKINGCallableGenericTypeVar)ExprKindExprNode)ExprExprTr	   )boundc                   @  sR   e Zd ZdddZdddZdddZdddZdddZdddZdddZ	dS )ExprNameNamespaceexprr
   returnNonec                 C  s
   || _ d S )N)_expr)selfr    r   P/var/www/html/IGF-ODF-V3/venv/lib/python3.10/site-packages/narwhals/expr_name.py__init__   s   
zExprNameNamespace.__init__c                 C     | j ttjdS )a  Keep the original root name of the expression.

        Notes:
            For Polars versions prior to 1.32, this will undo any previous renaming operations on the expression.

        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']
        z	name.keepr   _append_noder   r   ELEMENTWISEr   r   r   r   keep   s   zExprNameNamespace.keepfunctionCallable[[str], str]c                 C     | j ttjd|dS )a  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.

        Notes:
            For Polars versions prior to 1.32, this will undo any previous renaming operations on the expression.

        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']
        zname.map)r   r   )r   r   r   r   r   map!   s   zExprNameNamespace.mapprefixstrc                 C  r   )aj  Add a prefix to the root column name of the expression.

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

        Notes:
            For Polars versions prior to 1.32, this will undo any previous renaming operations on the expression.

        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']
        zname.prefix)r   r   )r   r   r   r   r   r   7      zExprNameNamespace.prefixsuffixc                 C  r   )am  Add a suffix to the root column name of the expression.

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

        Notes:
            For Polars versions prior to 1.32, this will undo any previous renaming operations on the expression.

        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']
        zname.suffix)r"   r   )r   r"   r   r   r   r"   L   r!   zExprNameNamespace.suffixc                 C  r   )a  Make the root column name lowercase.

        Notes:
            For Polars versions prior to 1.32, this will undo any previous renaming operations on the expression.

        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']
        zname.to_lowercaser   r   r   r   r   to_lowercasea      
zExprNameNamespace.to_lowercasec                 C  r   )a  Make the root column name uppercase.

        Notes:
            For Polars versions prior to 1.32, this will undo any previous renaming operations on the expression.

        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']
        zname.to_uppercaser   r   r   r   r   to_uppercases   r$   zExprNameNamespace.to_uppercaseN)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"   r#   r%   r   r   r   r   r      s    





r   N)
__future__r   typingr   r   r   r   narwhals._expression_parsingr   r   narwhals.exprr	   r
   r   r   r   r   r   <module>   s    