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

Silence warning #647

Merged
merged 1 commit into from
Dec 21, 2024
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
7 changes: 7 additions & 0 deletions aiidalab_widgets_base/computational_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,13 @@ def _observe_code_setup(self, _=None):
for key, value in self.code_setup.items():
if hasattr(self, key):
if key == "default_calc_job_plugin":
if "None" in value:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the type of value? Somewhat surprising if it would be list for tuple?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A string. It's an entry point. Like quantumespresso.pw. But if you don't associate a default calcjob plugin, when you select the Quantum ESPRESSO code from the code selector in the resource setup widget, the value somehow ends up being quantumespresso.None. So I check if the string None is in the entry point string. But yes, need to investigate why this happens.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay, that definitely needs an explanatory comment in the code, because "None" in value looks suuuper weird 😄

# NOTE: Using this widget through the `_ResourceSetupBaseWidget`
# without an explicit `default_calc_job_plugin` causes `value`
# to be "<plugin>.None", which is not a valid plugin name.
# HACK to avoid the warning message
# TODO see https://github.com/aiidalab/aiidalab-widgets-base/issues/648
return
try:
self.default_calc_job_plugin.value = value
except tl.TraitError:
Expand Down
Loading