Fix foreach on routine where the inputs provided are not valid (#5373)

* Fix foreach on routine where the inputs provided are not valid

* fix nixtla req + fix lint

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>
This commit is contained in:
DidierRLopes
2023-08-25 10:54:45 -05:00
committed by GitHub
parent 1036308f35
commit fc6137c86b
5 changed files with 39 additions and 28 deletions

View File

@@ -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:

8
poetry.lock generated vendored
View File

@@ -5004,13 +5004,13 @@ pandas = ">=1.1"
[[package]]
name = "nixtlats"
version = "0.1.9"
version = "0.1.11"
description = "Nixtla SDK"
optional = false
python-versions = ">=3.7"
files = [
{file = "nixtlats-0.1.9-py3-none-any.whl", hash = "sha256:e74a24d19db6e96450da6c2299b59a3d2b2d86769b399279761c7b796d80a10a"},
{file = "nixtlats-0.1.9.tar.gz", hash = "sha256:7c7ef1e0f74ebc33a8541d381c23663a73d483a4821ebdc74ffafa5d1cf91294"},
{file = "nixtlats-0.1.11-py3-none-any.whl", hash = "sha256:f2ddda8e23aa58e7f771892186176b687d2302e445ff762dcf699d1cea06b75d"},
{file = "nixtlats-0.1.11.tar.gz", hash = "sha256:778c340fddf02f3b6a11bd69ccd797a83fab1c67177b85f11bc61ceb6c41f1c3"},
]
[package.dependencies]
@@ -10558,4 +10558,4 @@ optimization = ["Riskfolio-Lib"]
[metadata]
lock-version = "2.0"
python-versions = "^3.8.1,<3.11, !=3.9.7"
content-hash = "314f243f7ee421064d98724dc97cf090f570694941e570afb4fa5bdcdae5cac1"
content-hash = "1852494c8df358b3c3631c50ee1d081b113b9b2f6c2c728f1570e8ecae8a3fea"

2
pyproject.toml vendored
View File

@@ -122,7 +122,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

18
requirements-full.txt vendored
View File

@@ -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"
@@ -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"
@@ -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"
@@ -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"
@@ -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"
@@ -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"

18
requirements.txt vendored
View File

@@ -8,7 +8,7 @@ altair==5.0.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7
ansiwrap==0.8.4 ; 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"
@@ -80,13 +80,14 @@ future==0.18.3 ; python_full_version >= "3.8.1" and python_full_version != "3.9.
gitdb==4.0.10 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
gitpython==3.1.32 ; 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"
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"
idna==3.4 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
importlib-metadata==6.8.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
importlib-resources==6.0.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.10"
@@ -121,10 +122,10 @@ 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"
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"
loguru==0.7.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
lxml==4.9.3 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
markupsafe==2.1.3 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
@@ -145,7 +146,8 @@ nbclient==0.6.8 ; python_full_version >= "3.8.1" and python_full_version != "3.9
nbconvert==7.7.2 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
nbformat==5.9.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
nest-asyncio==1.5.6 ; 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"
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"
numexpr==2.8.4 ; python_full_version >= "3.8.1" and python_version < "3.11" and python_full_version != "3.9.7"
@@ -179,7 +181,7 @@ prompt-toolkit==3.0.39 ; python_full_version >= "3.8.1" and python_full_version
property-cached==1.6.4 ; 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"
pyarrow==12.0.1 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
pyasn1==0.5.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
@@ -293,7 +295,7 @@ wrapt==1.15.0 ; python_full_version >= "3.8.1" and python_version < "3.11" and p
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"
zipp==3.16.2 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"
zope-interface==6.0 ; python_full_version >= "3.8.1" and python_full_version != "3.9.7" and python_version < "3.11"