
    h #                       S SK Jr  S SKrS SKJrJr  S SKJr  S SK	J
r
  S SKJrJr  S SKJr  S SKJr  \R$                  " \5         S SKJr  SSS5        \(       a  S S	KJr  S S
KJrJrJr  S SKJrJr  \   SSSS.           SS jjj5       r\   SSS.           SS jjj5       r\   SSS.           SS jjj5       r   S \SS.           SS jjjr\   SSSS.           SS jjj5       r\   SSS.           SS jjj5       r\   SSS.           SS jjj5       r   S \SS.           SS jjjr\   SSSS.           S!S jjj5       r \   SSS.           S"S jjj5       r \   SSS.           S#S jjj5       r    S \SS.           S#S jjjr g! , (       d  f       GN= f)$    )annotationsN)TYPE_CHECKINGoverload)	functions)parse_into_expression)	wrap_exprwrap_s)Int64)parse_into_datatype_expr)Literal)DataTypeExprExprSeries)IntoExprColumnPolarsIntegerType.dtypeeagerc                   g N startendstepr   r   s        Z/home/james-whalen/.local/lib/python3.13/site-packages/polars/functions/range/int_range.pyaranger               )r   c                   g r   r   r   s        r   r   r   !        r   c                   g r   r   r   s        r   r   r   ,        r   Fc                   [        XX#US9$ )a  
Generate a range of integers.

Alias for :func:`int_range`.

Parameters
----------
start
    Lower bound of the range (inclusive).
end
    Upper bound of the range (exclusive).
step
    Step size of the range.
dtype
    Data type of the range. Defaults to `Int64`.
eager
    Evaluate immediately and return a `Series`.
    If set to `False` (default), return an expression instead.

Returns
-------
Expr or Series
    Column of integer data type `dtype`.

See Also
--------
int_range : Generate a range of integers.
int_ranges : Generate a range of integers for each row of the input columns.

Examples
--------
>>> pl.arange(0, 3, eager=True)
shape: (3,)
Series: 'literal' [i64]
[
        0
        1
        2
]
r   )	int_ranger   s        r   r   r   7   s    ` U%@@r   c                   g r   r   r   s        r   r%   r%   j   r   r   c                   g r   r   r   s        r   r%   r%   u   r!   r   c                   g r   r   r   s        r   r%   r%      r#   r   c                  Uc  U nSn [        U5      n[        U [        5      (       aF  [        U[        5      (       a1  U(       a*  [        [        R
                  " XX%R                  5      5      $ [        U 5      n[        U5      n[        [        R                  " XgX%R                  5      5      nU(       a$  [        R                  " U5      R                  5       $ U$ )u  
Generate a range of integers.

Parameters
----------
start
    Start of the range (inclusive). Defaults to 0.
end
    End of the range (exclusive). If set to `None` (default),
    the value of `start` is used and `start` is set to `0`.
step
    Step size of the range.
dtype
    Data type of the range.
eager
    Evaluate immediately and return a `Series`.
    If set to `False` (default), return an expression instead.

Returns
-------
Expr or Series
    Column of integer data type `dtype`.

See Also
--------
int_ranges : Generate a range of integers for each row of the input columns.

Examples
--------
>>> pl.int_range(0, 3, eager=True)
shape: (3,)
Series: 'literal' [i64]
[
        0
        1
        2
]

`end` can be omitted for a shorter syntax.

>>> pl.int_range(3, eager=True)
shape: (3,)
Series: 'literal' [i64]
[
        0
        1
        2
]

Generate an index column by using `int_range` in conjunction with :func:`len`.

>>> df = pl.DataFrame({"a": [1, 3, 5], "b": [2, 4, 6]})
>>> df.select(
...     pl.int_range(pl.len(), dtype=pl.UInt32).alias("index"),
...     pl.all(),
... )
shape: (3, 3)
┌───────┬─────┬─────┐
│ index ┆ a   ┆ b   │
│ ---   ┆ --- ┆ --- │
│ u32   ┆ i64 ┆ i64 │
╞═══════╪═════╪═════╡
│ 0     ┆ 1   ┆ 2   │
│ 1     ┆ 3   ┆ 4   │
│ 2     ┆ 5   ┆ 6   │
└───────┴─────┴─────┘
r   )r   
isinstanceintr	   plreager_int_range_pydatatype_exprr   r   r%   Fselect	to_series)	r   r   r   r   r   
dtype_exprstart_pyexpr
end_pyexprresults	            r   r%   r%      s    V {)%0J%*S#"6"65D2M2MN
 	
 )/L&s+Jl6Q6QRF xx))++Mr   c                   g r   r   r   s        r   
int_rangesr7      r   r   c                   g r   r   r   s        r   r7   r7      r!   r   c                   g r   r   r   s        r   r7   r7     r#   r   c                  Uc  U nSn [        U5      n[        U 5      n[        U5      n[        U5      n[        [        R                  " XgXR
                  5      5      n	U(       a$  [        R                  " U	5      R                  5       $ U	$ )u_  
Generate a range of integers for each row of the input columns.

Parameters
----------
start
    Start of the range (inclusive). Defaults to 0.
end
    End of the range (exclusive). If set to `None` (default),
    the value of `start` is used and `start` is set to `0`.
step
    Step size of the range.
dtype
    Integer data type of the ranges. Defaults to `Int64`.
eager
    Evaluate immediately and return a `Series`.
    If set to `False` (default), return an expression instead.

Returns
-------
Expr or Series
    Column of data type `List(dtype)`.

See Also
--------
int_range : Generate a single range of integers.

Examples
--------
>>> df = pl.DataFrame({"start": [1, -1], "end": [3, 2]})
>>> df.with_columns(int_range=pl.int_ranges("start", "end"))
shape: (2, 3)
┌───────┬─────┬────────────┐
│ start ┆ end ┆ int_range  │
│ ---   ┆ --- ┆ ---        │
│ i64   ┆ i64 ┆ list[i64]  │
╞═══════╪═════╪════════════╡
│ 1     ┆ 3   ┆ [1, 2]     │
│ -1    ┆ 2   ┆ [-1, 0, 1] │
└───────┴─────┴────────────┘

`end` can be omitted for a shorter syntax.

>>> df.select("end", int_range=pl.int_ranges("end"))
shape: (2, 2)
┌─────┬───────────┐
│ end ┆ int_range │
│ --- ┆ ---       │
│ i64 ┆ list[i64] │
╞═════╪═══════════╡
│ 3   ┆ [0, 1, 2] │
│ 2   ┆ [0, 1]    │
└─────┴───────────┘
r   )	r   r   r   r,   r7   r.   r/   r0   r1   )
r   r   r   r   r   r2   r3   r4   step_pyexprr5   s
             r   r7   r7     s    | {)%0J(/L&s+J'-Kk3N3N	
F xx))++Mr   )...)r   int | IntoExprColumnr   int | IntoExprColumn | Noner   r+   r    PolarsIntegerType | DataTypeExprr   Literal[False]returnr   )r   r<   r   r=   r   r+   r   r>   r   Literal[True]r@   r   )r   r<   r   r=   r   r+   r   r>   r   boolr@   Expr | Series)r   N   )r   r<   r   r=   r   r<   r   r>   r   r?   r@   r   )r   r<   r   r=   r   r<   r   r>   r   rA   r@   r   )r   r<   r   r=   r   r<   r   r>   r   rB   r@   rC   )!
__future__r   
contextlibtypingr   r   polarsr   r/   polars._utils.parser   polars._utils.wrapr   r	   polars.datatypesr
   polars.datatypes._parser   suppressImportErrorpolars._plr_plrr,   r   r   r   r   polars._typingr   r   r   r%   r7   r   r   r   <module>rR      s   "  * ! 5 0 " <% & 11@ 
"%'*
 /2	$ 
 ,  
 
 
"%'*
 /2	$ 
 ,   
 
"%'*
 /2	$ 
 ,   
 #$'+0A
 /40A0A	$0A 0A
 ,0A 0A 0Af 
"%'*
 /2	$ 
 ,  
 
 
"%'*
 /2	$ 
 ,   
 
"%'*
 /2	$ 
 ,   
 #$'+^
 /4^^	$^ ^
 ,^ ^ ^B 
"%'*!$
 /2	$ 
 ,  
 
 
"%'*!$
 /2	$ 
 ,   
 
"%'*!$
 /2	$ 
 ,   
 #$'+!"O
 /4OO	$O O
 ,O O OC &%s   G
G"