pyiron / pyiron_workflow

Graph-and-node based workflows
BSD 3-Clause "New" or "Revised" License
14 stars 1 forks source link

Get close matches #468

Closed samwaseda closed 2 months ago

samwaseda commented 2 months ago
wf = Workflow("tesile")
wf.Composition = standard_nodes.UserInput("Aluminum")
wf.BoxSize = standard_nodes.UserInput(3 * [1.0e-5])
wf.Seeds = function_node(...)
wf.Grid = function_node(...)
wf.Elasticity = function_node(...)
wf.Plasticity = function_node(...)
wf.Phase = function_node(...)
wf.Homogenization = function_node(...)
wf.Material = function_node(generate_material, elements=wf.Compositions)

The previous error message in this situation was: Could not find attribute Compositions on tesile (Workflow) or among its children (dict_keys(['Composition', 'BoxSize', 'Seeds', 'Grid', 'Elasticity', 'Plasticity', 'Phase', 'Homogenization'])).. It was sort of difficult to figure out which one I wanted to say for this large number of possibilities. So I added get_close_matches to append the message: Did you mean 'Composition' and not 'Compositions'?

Also, in general I find the error messages in pyiron_workflow difficult to understand. It must be difficult for @liamhuber to figure it out alone so I'm gonna make suggestions in the upcoming weeks.

github-actions[bot] commented 2 months ago

Binder :point_left: Launch a binder notebook on branch _pyiron/pyiron_workflow/get_closematches

samwaseda commented 2 months ago

The same thing could be used also elsewhere (like io?)

codacy-production[bot] commented 2 months ago

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
:white_check_mark: +0.02% (target: -1.00%) :white_check_mark: 100.00%
Coverage variation details | | Coverable lines | Covered lines | Coverage | | ------------- | ------------- | ------------- | ------------- | | Common ancestor commit (e382ce2e17f7ac3537751e3d180ca2a84abd88e6) | 3279 | 2992 | 91.25% | | | Head commit (f85613212aaf965875eaa11901ac9e4aae91becb) | 3286 (+7) | 2999 (+7) | 91.27% (**+0.02%**) | **Coverage variation** is the difference between the coverage for the head and common ancestor commits of the pull request branch: ` - `
Diff coverage details | | Coverable lines | Covered lines | Diff coverage | | ------------- | ------------- | ------------- | ------------- | | Pull request (#468) | 8 | 8 | **100.00%** | **Diff coverage** is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: `/ * 100%`

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

coveralls commented 2 months ago

Pull Request Test Coverage Report for Build 10979287381

Details


Files with Coverage Reduction New Missed Lines %
mixin/semantics.py 6 96.69%
<!-- Total: 6 -->
Totals Coverage Status
Change from base Build 10969418713: 0.02%
Covered Lines: 2999
Relevant Lines: 3286

💛 - Coveralls
liamhuber commented 2 months ago

The same thing could be used also elsewhere (like io?)

Yes, I imagine there's a few places where it's useful, but I couldn't name them all off the top of my head. When it's used as here to strictly add to the information returned, I am totally behind this.