Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 7, 2024
1 parent 7a6a6c1 commit a5aad2f
Show file tree
Hide file tree
Showing 6 changed files with 213 additions and 155 deletions.
17 changes: 11 additions & 6 deletions notebooks/eln_import.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,15 @@
"metadata": {},
"outputs": [],
"source": [
"from aiidalab_widgets_base import AiidaNodeViewWidget, OpenAiidaNodeInAppWidget, ElnImportWidget\n",
"import urllib.parse as urlparse\n",
"from aiidalab_widgets_base import viewer\n",
"from traitlets import dlink"
"\n",
"from traitlets import dlink\n",
"\n",
"from aiidalab_widgets_base import (\n",
" AiidaNodeViewWidget,\n",
" ElnImportWidget,\n",
" OpenAiidaNodeInAppWidget,\n",
")"
]
},
{
Expand All @@ -57,7 +62,7 @@
"source": [
"url = urlparse.urlsplit(jupyter_notebook_url)\n",
"parsed_url = urlparse.parse_qs(url.query)\n",
"params = {key:value[0] for key, value in parsed_url.items()}\n",
"params = {key: value[0] for key, value in parsed_url.items()}\n",
"eln_widget = ElnImportWidget(**params)"
]
},
Expand All @@ -71,8 +76,8 @@
"object_displayed = AiidaNodeViewWidget()\n",
"open_in_app = OpenAiidaNodeInAppWidget()\n",
"\n",
"_ = dlink((eln_widget, 'node'), (object_displayed, 'node'))\n",
"_ = dlink((eln_widget, 'node'), (open_in_app, 'node'))"
"_ = dlink((eln_widget, \"node\"), (object_displayed, \"node\"))\n",
"_ = dlink((eln_widget, \"node\"), (open_in_app, \"node\"))"
]
},
{
Expand Down
31 changes: 22 additions & 9 deletions notebooks/process.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,19 @@
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as ipw\n",
"from IPython.display import clear_output\n",
"from aiida.cmdline.utils.ascii_vis import format_call_graph\n",
"import urllib.parse as urlparse\n",
"\n",
"from aiida.orm import load_node\n",
"from aiidalab_widgets_base import ProcessFollowerWidget, ProgressBarWidget, ProcessReportWidget\n",
"from aiidalab_widgets_base import ProcessInputsWidget, ProcessOutputsWidget, ProcessCallStackWidget, RunningCalcJobOutputWidget"
"\n",
"from aiidalab_widgets_base import (\n",
" ProcessCallStackWidget,\n",
" ProcessFollowerWidget,\n",
" ProcessInputsWidget,\n",
" ProcessOutputsWidget,\n",
" ProcessReportWidget,\n",
" ProgressBarWidget,\n",
" RunningCalcJobOutputWidget,\n",
")"
]
},
{
Expand All @@ -54,8 +60,8 @@
"source": [
"url = urlparse.urlsplit(jupyter_notebook_url)\n",
"url_dict = urlparse.parse_qs(url.query)\n",
"if 'id' in url_dict:\n",
" pk = int(url_dict['id'][0])\n",
"if \"id\" in url_dict:\n",
" pk = int(url_dict[\"id\"][0])\n",
" process = load_node(pk)\n",
"else:\n",
" process = None"
Expand Down Expand Up @@ -101,8 +107,15 @@
"source": [
"follower = ProcessFollowerWidget(\n",
" process,\n",
" followers=[ProgressBarWidget(), ProcessReportWidget(), ProcessCallStackWidget(), RunningCalcJobOutputWidget()], path_to_root=\"../../\", \n",
" update_interval=2)\n",
" followers=[\n",
" ProgressBarWidget(),\n",
" ProcessReportWidget(),\n",
" ProcessCallStackWidget(),\n",
" RunningCalcJobOutputWidget(),\n",
" ],\n",
" path_to_root=\"../../\",\n",
" update_interval=2,\n",
")\n",
"display(follower)\n",
"follower.follow(detach=True)"
]
Expand Down
82 changes: 44 additions & 38 deletions notebooks/process_list.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
"outputs": [],
"source": [
"import ipywidgets as ipw\n",
"from aiidalab_widgets_base import ProcessListWidget\n",
"from plumpy import ProcessState\n",
"from traitlets import dlink\n",
"from plumpy import ProcessState"
"\n",
"from aiidalab_widgets_base import ProcessListWidget"
]
},
{
Expand All @@ -51,63 +52,68 @@
"source": [
"process_list = ProcessListWidget(path_to_root=\"../../\")\n",
"\n",
"past_days_widget = ipw.IntText(value=7, description='Past days:')\n",
"dlink((past_days_widget, 'value'), (process_list, 'past_days'))\n",
"past_days_widget = ipw.IntText(value=7, description=\"Past days:\")\n",
"dlink((past_days_widget, \"value\"), (process_list, \"past_days\"))\n",
"\n",
"\n",
"all_days_checkbox = ipw.Checkbox(description=\"All days\", value=False)\n",
"dlink((all_days_checkbox, 'value'), (past_days_widget, 'disabled'))\n",
"dlink((all_days_checkbox, 'value'), (process_list, 'past_days'), transform=lambda v: -1 if v else past_days_widget.value)\n",
"dlink((all_days_checkbox, \"value\"), (past_days_widget, \"disabled\"))\n",
"dlink(\n",
" (all_days_checkbox, \"value\"),\n",
" (process_list, \"past_days\"),\n",
" transform=lambda v: -1 if v else past_days_widget.value,\n",
")\n",
"\n",
"incoming_node_widget = ipw.Text(\n",
" description='Incoming node:',\n",
" style={'description_width': 'initial'}\n",
" description=\"Incoming node:\", style={\"description_width\": \"initial\"}\n",
")\n",
"dlink((incoming_node_widget, 'value'), (process_list, 'incoming_node'))\n",
"dlink((incoming_node_widget, \"value\"), (process_list, \"incoming_node\"))\n",
"\n",
"\n",
"outgoing_node_widget = ipw.Text(\n",
" description='Outgoing node:',\n",
" style={'description_width': 'initial'}\n",
" description=\"Outgoing node:\", style={\"description_width\": \"initial\"}\n",
")\n",
"dlink((outgoing_node_widget, 'value'), (process_list, 'outgoing_node'))\n",
"dlink((outgoing_node_widget, \"value\"), (process_list, \"outgoing_node\"))\n",
"\n",
"\n",
"available_states = [state.value for state in ProcessState]\n",
"process_state_widget = ipw.SelectMultiple(options=available_states,\n",
" value=available_states,\n",
" description='Process State:',\n",
" style={'description_width': 'initial'},\n",
" disabled=False)\n",
"dlink((process_state_widget, 'value'), (process_list, 'process_states'))\n",
"process_state_widget = ipw.SelectMultiple(\n",
" options=available_states,\n",
" value=available_states,\n",
" description=\"Process State:\",\n",
" style={\"description_width\": \"initial\"},\n",
" disabled=False,\n",
")\n",
"dlink((process_state_widget, \"value\"), (process_list, \"process_states\"))\n",
"\n",
"process_label_widget = ipw.Text(\n",
" description='Process label:',\n",
" style={'description_width': 'initial'}\n",
" description=\"Process label:\", style={\"description_width\": \"initial\"}\n",
")\n",
"dlink((process_label_widget, 'value'), (process_list, 'process_label'))\n",
"dlink((process_label_widget, \"value\"), (process_list, \"process_label\"))\n",
"\n",
"description_contains_widget = ipw.Text(\n",
" description='Description contains:',\n",
" style={'description_width': 'initial'}\n",
" description=\"Description contains:\", style={\"description_width\": \"initial\"}\n",
")\n",
"dlink((description_contains_widget, 'value'), (process_list, 'description_contains'))\n",
"dlink((description_contains_widget, \"value\"), (process_list, \"description_contains\"))\n",
"\n",
"display(\n",
" ipw.HBox([\n",
" ipw.VBox([past_days_widget, process_state_widget]),\n",
" ipw.VBox(\n",
" [\n",
" all_days_checkbox,\n",
" incoming_node_widget,\n",
" outgoing_node_widget,\n",
" process_label_widget,\n",
" description_contains_widget\n",
" ],\n",
" layout={'margin': '0px 0px 0px 40px'}\n",
" )\n",
" ]),\n",
" process_list)"
" ipw.HBox(\n",
" [\n",
" ipw.VBox([past_days_widget, process_state_widget]),\n",
" ipw.VBox(\n",
" [\n",
" all_days_checkbox,\n",
" incoming_node_widget,\n",
" outgoing_node_widget,\n",
" process_label_widget,\n",
" description_contains_widget,\n",
" ],\n",
" layout={\"margin\": \"0px 0px 0px 40px\"},\n",
" ),\n",
" ]\n",
" ),\n",
" process_list,\n",
")"
]
},
{
Expand Down
7 changes: 4 additions & 3 deletions notebooks/structures.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@
" title=\"From Examples\",\n",
" examples=[\n",
" (\"Silicon oxide\", \"../miscellaneous/structures/SiO2.xyz\"),\n",
" (\"Silicon\", \"../miscellaneous/structures/Si.xyz\")\n",
" ]),\n",
" (\"Silicon\", \"../miscellaneous/structures/Si.xyz\"),\n",
" ],\n",
" ),\n",
" ],\n",
" editors = [\n",
" editors=[\n",
" awb.BasicStructureEditor(title=\"Basic Editor\"),\n",
" awb.BasicCellEditor(title=\"Basic Cell Editor\"),\n",
" ],\n",
Expand Down
Loading

0 comments on commit a5aad2f

Please sign in to comment.