pyiron / pyiron_workflow

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

[minor] Be direct instead of using weird creator classes #278

Closed liamhuber closed 2 months ago

liamhuber commented 2 months ago

Per @pmrv's comment, the Function and Macro classes that overrode __new__ to return children of AbstractFunction and AbstractMacro we an unnecessary complication -- we can do the same thing with a plain old function. Here we transform those creators back into functions, and then give the base classes back their original names of Function and Macro.

@pmrv the main thing I want review on is to see if you have any better ideas for naming. Right now (class, decorator -> class, creator -> instance) are (Function, as_function_node, function_node) and (Macro, as_macro_node, macro_node). I also re-named Creator.wrap_as to Creator.wrap; so before/after goes like Workflow.create.Function/Workflow.create.function_node, Workflow.wrap_as.function_node/Workflow.wrap.as_function_node, etc..

review-notebook-app[bot] commented 2 months ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

github-actions[bot] commented 2 months ago

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

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: 72.07%
Coverage variation details | | Coverable lines | Covered lines | Coverage | | ------------- | ------------- | ------------- | ------------- | | Common ancestor commit (adf3bed79e57469a218d2da1fd1e3493571ccb87) | 3453 | 3009 | 87.14% | | | Head commit (0f33bec9c0a9ce3f40820b3b1b15847f3c4806be) | 3447 (-6) | 3003 (-6) | 87.12% (**-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 (#278) | 111 | 80 | **72.07%** | **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

You may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation