Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🪲 Deal with ipynb of different format #221

Merged
merged 2 commits into from
Jan 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pyflow/scene/from_ipynb_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@ def get_blocks_data(
else:
block_type: str = cell["cell_type"]

text: str = cell["source"]
text: List[str] = []

if isinstance(cell["source"], list):
text: str = cell["source"]
elif isinstance(cell["source"], str):
text = [line + "\n" for line in cell["source"].split("\n")]
else:
raise TypeError("A cell's source is not of the right type")

text_width = DEFAULT_TEXT_WIDTH
if use_theme_font:
Expand Down