Skip to content

Commit

Permalink
Fix foreach on routine where the inputs provided are not valid (#5373)
Browse files Browse the repository at this point in the history
* Fix foreach on routine where the inputs provided are not valid

* fix nixtla req + fix lint

---------

Co-authored-by: James Maslek <[email protected]>
  • Loading branch information
2 people authored and the-praxs committed Sep 4, 2023
1 parent e11c5c8 commit cf0b32e
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 28 deletions.
21 changes: 14 additions & 7 deletions openbb_terminal/routine_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,22 @@ def parse_openbb_script( # noqa: PLR0911,PLR0912
)
slicing_tuple += ")"

templine = templine.replace(
match[0],
",".join(
eval( # noqa: S307
f'ROUTINE_VARS["{VAR_NAME}"][{slicing_tuple}]'
)
),
vars_to_loop = eval( # noqa: S307
f'ROUTINE_VARS["{VAR_NAME}"][{slicing_tuple}]'
)

# Check whether the slicing was successful or not
if vars_to_loop:
templine = templine.replace(
match[0],
",".join(vars_to_loop),
)
else:
return (
f"[red]The foreach loop cannot run with input: {match[0]}.[/red]",
"",
)

# Just replace value without slicing or list
else:
if VAR_SLICE:
Expand Down
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ ffn = "0.3.6"
jupyter-client = "7.4.1"
jupyter-server = "1.23.6"
python-jose = "^3.3.0"
nixtlats = "0.1.9" # Pinning for stability
nixtlats = "^0.1.11" # Pinning for stability
nltk = "^3.8.1" # Is a dependence for llama index


Expand Down
18 changes: 10 additions & 8 deletions requirements-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ansiwrap==0.8.4 ; python_full_version >= "3.8.1" and python_full_version != "3.9
antlr4-python3-runtime==4.11.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
anyio==3.7.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
appdirs==1.4.4 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
appnope==0.1.3 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" and sys_platform == "darwin" or python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" and platform_system == "Darwin"
appnope==0.1.3 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" and (sys_platform == "darwin" or platform_system == "Darwin")
arch==5.6.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
argon2-cffi-bindings==21.2.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
argon2-cffi==21.3.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
Expand Down Expand Up @@ -122,13 +122,14 @@ google-auth-oauthlib==1.0.0 ; python_full_version >= "3.8.1" and python_full_ver
google-auth==2.22.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
graphlib-backport==1.0.3 ; python_full_version >= "3.8.1" and python_version < "3.9"
graphviz==0.20.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
greenlet==2.0.2 ; python_full_version >= "3.8.1" and platform_machine == "aarch64" and python_full_version != "3.9.7" and python_version < "3.11" or python_full_version >= "3.8.1" and platform_machine == "ppc64le" and python_full_version != "3.9.7" and python_version < "3.11" or python_full_version >= "3.8.1" and platform_machine == "x86_64" and python_full_version != "3.9.7" and python_version < "3.11" or python_full_version >= "3.8.1" and platform_machine == "amd64" and python_full_version != "3.9.7" and python_version < "3.11" or python_full_version >= "3.8.1" and platform_machine == "AMD64" and python_full_version != "3.9.7" and python_version < "3.11" or python_full_version >= "3.8.1" and platform_machine == "win32" and python_full_version != "3.9.7" and python_version < "3.11" or python_full_version >= "3.8.1" and platform_machine == "WIN32" and python_full_version != "3.9.7" and python_version < "3.11"
greenlet==2.0.2 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" and (platform_machine == "win32" or platform_machine == "WIN32" or platform_machine == "AMD64" or platform_machine == "amd64" or platform_machine == "x86_64" or platform_machine == "ppc64le" or platform_machine == "aarch64")
grpcio==1.56.2 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
h11==0.14.0 ; python_full_version >= "3.8.1" and python_version < "3.11" and python_full_version != "3.9.7"
hijri-converter==2.3.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
holidays==0.14.2 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
html5lib==1.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
httpcore==0.17.3 ; python_full_version >= "3.8.1" and python_version < "3.11" and python_full_version != "3.9.7"
httpx==0.24.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
huggingface-hub==0.16.4 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
identify==2.5.25 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
idna==3.4 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
Expand Down Expand Up @@ -170,13 +171,13 @@ jupyterlab-widgets==3.0.8 ; python_full_version >= "3.8.1" and python_full_versi
jupyterlab==3.6.5 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
kiwisolver==1.4.4 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
korean-lunar-calendar==0.3.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
langchain==0.0.237 ; python_full_version >= "3.8.1" and python_version < "3.11" and python_full_version != "3.9.7"
langsmith==0.0.10 ; python_full_version >= "3.8.1" and python_version < "3.11" and python_full_version != "3.9.7"
langchain==0.0.266 ; python_full_version >= "3.8.1" and python_version < "3.11" and python_full_version != "3.9.7"
langsmith==0.0.26 ; python_full_version >= "3.8.1" and python_version < "3.11" and python_full_version != "3.9.7"
lazy-object-proxy==1.9.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
lightgbm==3.3.5 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
lightning-utilities==0.9.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
linearmodels==4.31 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
llama-index==0.7.11 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
llama-index==0.8.8 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
llvmlite==0.40.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
loguru==0.7.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
lunarcalendar==0.0.9 ; python_full_version >= "3.8.1" and python_version < "3.11" and python_full_version != "3.9.7"
Expand Down Expand Up @@ -210,7 +211,8 @@ nbmake==1.4.1 ; python_full_version >= "3.8.1" and python_version < "3.11" and p
nest-asyncio==1.5.6 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
networkx==3.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
nfoursid==1.0.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
nixtlats==0.1.4 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
nixtlats==0.1.11 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
nltk==3.8.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
nodeenv==1.8.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
notebook-shim==0.2.3 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
notebook==6.5.4 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
Expand Down Expand Up @@ -258,7 +260,7 @@ property-cached==1.6.4 ; python_full_version >= "3.8.1" and python_full_version
prophet==1.1.3 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
protobuf==3.20.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
psutil==5.9.5 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
ptyprocess==0.7.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" and sys_platform != "win32" or python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" and os_name != "nt"
ptyprocess==0.7.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11" and (sys_platform != "win32" or os_name != "nt")
pure-eval==0.2.2 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
py==1.11.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
pyarrow==12.0.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
Expand Down Expand Up @@ -438,7 +440,7 @@ xlsxwriter==3.1.2 ; python_full_version >= "3.8.1" and python_full_version != "3
y-py==0.6.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
yahooquery==2.3.2 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
yarl==1.9.2 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
yfinance==0.2.25 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
yfinance==0.2.28 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
ypy-websocket==0.8.4 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
yt-dlp==2023.7.6 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
zipp==3.16.2 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
Expand Down
Loading

0 comments on commit cf0b32e

Please sign in to comment.