Environment
- Operating System: Linux
- Python Version: 3.10
- How did you install pyforest: pip install pyforest
Description of Issue
- What did you expect to happen?
Lazy loading of a library should not produce blank lines in the output.
- What happened instead?
A line break occurs when executing an instruction that must load the referenced library.
Reproduction Steps
- Run code
from pyforest import LazyImport
pd = LazyImport("import pandas as pd")
def prueba(df: pd.DataFrame) -> None:
pass
What steps have you taken to resolve this already?
I think the problem is in this code block of _importable.py
If statements arrives empty, it will print the "\n".
Anything else?
A possible solution would be not to call the display function if there are no elements in statements.
if len(statements) > 0:
display(
Javascript(
"""
if (window._pyforest_update_imports_cell) {{ window._pyforest_update_imports_cell({!r}); }}
""".format(
"\n".join(statements)
)
)
)
Environment
Description of Issue
Lazy loading of a library should not produce blank lines in the output.
A line break occurs when executing an instruction that must load the referenced library.
Reproduction Steps
What steps have you taken to resolve this already?
I think the problem is in this code block of _importable.py
If statements arrives empty, it will print the "\n".
Anything else?
A possible solution would be not to call the display function if there are no elements in statements.