Skip to content

Commit 60cb8ea

Browse files
authored
Add Range (#66)
* Add Range function Work all done by @sudo-panda
1 parent 6576cbe commit 60cb8ea

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

func_adl/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@
1010

1111
# Dataset accessors
1212
from .event_dataset import EventDataset, find_EventDataset # NOQA
13+
14+
from .functions import Range

func_adl/functions.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import ast
2+
3+
from .object_stream import ObjectStream
4+
5+
from typing import Union, cast
6+
7+
def Range(lower_bound: Union[str, int, ast.AST], upper_bound: Union[str, int, ast.AST]) -> ObjectStream:
8+
r"""
9+
Given the lower and upper bound return an object with the range of numbers, similar to python range
10+
11+
Arguments:
12+
13+
lower_bound The start of the range
14+
upper_bound The end of the range
15+
16+
Return:
17+
18+
A new ObjectStream that contains the range of numbers
19+
20+
"""
21+
22+
return ObjectStream(function_call("Range",
23+
[cast(ast.AST, as_ast(lower_bound)),
24+
cast(ast.AST, as_ast(upper_bound))]))

0 commit comments

Comments
 (0)