Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#635)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.6.0 → v5.0.0](pre-commit/pre-commit-hooks@v4.6.0...v5.0.0)
- [github.com/astral-sh/ruff-pre-commit: v0.5.0 → v0.6.9](astral-sh/ruff-pre-commit@v0.5.0...v0.6.9)
- [github.com/sirosen/check-jsonschema: 0.28.6 → 0.29.3](python-jsonschema/check-jsonschema@0.28.6...0.29.3)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix lints in notebooks

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Daniel Hollas <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and danielhollas authored Oct 9, 2024
1 parent c697d27 commit 8be9a59
Show file tree
Hide file tree
Showing 7 changed files with 222 additions and 161 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-json
- id: check-yaml
Expand All @@ -13,7 +13,7 @@ repos:
exclude: miscellaneous/structures

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.0
rev: v0.6.9
hooks:
- id: ruff-format
exclude: ^docs/.*
Expand All @@ -27,7 +27,7 @@ repos:
args: [--preserve-quotes]

- repo: https://github.com/sirosen/check-jsonschema
rev: 0.28.6
rev: 0.29.3
hooks:
- id: check-github-workflows

Expand Down
19 changes: 12 additions & 7 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 @@ -55,9 +60,9 @@
"metadata": {},
"outputs": [],
"source": [
"url = urlparse.urlsplit(jupyter_notebook_url)\n",
"url = urlparse.urlsplit(jupyter_notebook_url) # noqa: F821\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
33 changes: 23 additions & 10 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 @@ -52,10 +58,10 @@
"metadata": {},
"outputs": [],
"source": [
"url = urlparse.urlsplit(jupyter_notebook_url)\n",
"url = urlparse.urlsplit(jupyter_notebook_url) # noqa: F821\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 8be9a59

Please sign in to comment.