Skip to content

Commit

Permalink
fix jupyter notebook write
Browse files Browse the repository at this point in the history
Signed-off-by: Lance-Drane <[email protected]>
  • Loading branch information
Lance-Drane committed Oct 21, 2024
1 parent 4aaf61d commit 4c0f725
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions ipsframework/_jupyter/initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def _jupyter_notebook_api_code() -> bytes:
"cell_type": "markdown",
"metadata": {},
"source": [
"## IPS workstation\n",
"\n",
"## IPS workstation\\n",
"\\n",
"You can use this notebook to quickly generate a tarfile with desired runids for download. "
]
},
Expand All @@ -68,35 +68,35 @@ def _jupyter_notebook_api_code() -> bytes:
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"\n",
"import api_v1\n",
"from IPython.display import display\n",
"from ipywidgets import HTML, Button, Layout, Textarea\n",
"\n",
"widget1 = Textarea(\n",
" value='',\n",
" placeholder='Enter runids you want to download, delimited by either spaces or newlines',\n",
" description='Enter runids you want to download, delimited by either spaces or newlines',\n",
" layout=Layout(width='50%', display='flex', flex_flow='column')\n",
")\n",
"\n",
"widget2 = Button(\n",
" description='Generate tar from input',\n",
" layout=Layout(width='300px')\n",
")\n",
"\n",
"def generate_tarfile(_button_widget):\n",
" runids = [int(v) for v in widget1.value.split()]\n",
" display(f'Generating tar file from runids: {runids}')\n",
" \n",
" file = Path(api_v1.generate_tar_from_runids(runids))\n",
" display(f'Generated tar file {file.name} in directory {file.parent}, right click the file in the file browser to download it')\n",
"\n",
"widget2.on_click(generate_tarfile)\n",
"\n",
"display(widget1,widget2,HTML('''<style>\n",
" .widget-label { width: unset !important; }\n",
"from pathlib import Path\\n",
"\\n",
"import api_v1\\n",
"from IPython.display import display\\n",
"from ipywidgets import HTML, Button, Layout, Textarea\\n",
"\\n",
"widget1 = Textarea(\\n",
" value='',\\n",
" placeholder='Enter runids you want to download, delimited by either spaces or newlines',\\n",
" description='Enter runids you want to download, delimited by either spaces or newlines',\\n",
" layout=Layout(width='50%', display='flex', flex_flow='column')\\n",
")\\n",
"\\n",
"widget2 = Button(\\n",
" description='Generate tar from input',\\n",
" layout=Layout(width='300px')\\n",
")\\n",
"\\n",
"def generate_tarfile(_button_widget):\\n",
" runids = [int(v) for v in widget1.value.split()]\\n",
" display(f'Generating tar file from runids: {runids}')\\n",
" \\n",
" file = Path(api_v1.generate_tar_from_runids(runids))\\n",
" display(f'Generated tar file {file.name} in directory {file.parent}, right click the file in the file browser to download it')\\n",
"\\n",
"widget2.on_click(generate_tarfile)\\n",
"\\n",
"display(widget1,widget2,HTML('''<style>\\n",
" .widget-label { width: unset !important; }\\n",
"</style>'''))"
]
}
Expand Down

0 comments on commit 4c0f725

Please sign in to comment.