-
Notifications
You must be signed in to change notification settings - Fork 9
Add ty typechecker
#236
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
Add ty typechecker
#236
Changes from 4 commits
775ccdb
6435e71
481460c
1a25102
7e1ec80
7657ac7
3820453
b48b82b
d0af716
43791d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
edan-bainglass marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| def display( | ||
| *objs, | ||
| include=None, | ||
| exclude=None, | ||
| metadata=None, | ||
| transient=None, | ||
| display_id=None, | ||
| **kwargs, | ||
| ): ... | ||
|
|
||
| jupyter_notebook_url: str |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -354,7 +354,7 @@ def __init__(self, process=None, **kwargs): | |
|
|
||
| def generate_flat_mapping( | ||
| self, process: orm.ProcessNode | None = None | ||
| ) -> None | dict[str, str]: | ||
| ) -> dict[str, str] | None: | ||
| """Generate a dict of input to node uuid mapping. | ||
|
|
||
| If the input port is a namespace, it will further parse the namespace and attach the entity the | ||
|
|
@@ -384,7 +384,7 @@ def flatten(d, parent_key="", sep="."): | |
|
|
||
| return options_map | ||
|
|
||
| def show_selected_input(self, change=None): | ||
| def show_selected_input(self, change): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why drop the default?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess otherwise ty complained about line 392 and on. But this also means that
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, I've checked that we're not calling this function directly anywhere (and |
||
| """Function that displays process inputs selected in the `inputs` Dropdown widget.""" | ||
| with self.output: | ||
| self.info.value = "" | ||
|
|
@@ -506,8 +506,10 @@ def __init__(self, process=None, **kwargs): | |
| children=[ipw.HBox([outputs, self.info]), self.output], **kwargs | ||
| ) | ||
|
|
||
| def show_selected_output(self, change=None): | ||
| def show_selected_output(self, change): | ||
| """Function that displays process output selected in the `outputs` Dropdown widget.""" | ||
| if self.process is None: | ||
| return | ||
| with self.output: | ||
| self.info.value = "" | ||
| clear_output() | ||
|
|
@@ -598,6 +600,8 @@ def update(self): | |
|
|
||
| @property | ||
| def current_state(self): | ||
| if self.process is None or self.process.process_state is None: | ||
| return None | ||
| return self.process.process_state.value | ||
|
|
||
|
|
||
|
|
@@ -646,7 +650,7 @@ def update(self, _=None): | |
| process_state=self.process_states, | ||
| process_label=self.process_label, | ||
| exit_status=None, | ||
| failed=None, | ||
| failed=False, | ||
| ) | ||
| relationships = {} | ||
| if self.incoming_node: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,5 +74,5 @@ def multiply_add_completed_workchain(aiida_local_code_bash): | |
| "z": orm.Int(3), | ||
| "code": aiida_local_code_bash, | ||
| } | ||
| _, process = engine.run_get_node(MultiplyAddWorkChain, **inputs) | ||
| _, process = engine.run_get_node(MultiplyAddWorkChain, **inputs) # ty: ignore[invalid-argument-type] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, |
||
| return process | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1036,7 +1036,7 @@ def test_optional_new_code_setup_widget(): | |
| assert not hasattr(widget, "btn_setup_new_code") | ||
| assert not hasattr(widget, "_setup_new_code_output") | ||
| assert not hasattr(widget, "resource_setup") | ||
| selection_row = widget.children[0] # type: ignore | ||
| selection_row = widget.children[0] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this showing the power of ty? I recall mypy would complain about indexing children. Or did ipywidgets fix their types for children in v8?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure, I think |
||
| assert len(selection_row.children) == 1 # no new code setup button | ||
|
|
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.