-
Notifications
You must be signed in to change notification settings - Fork 0
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 Node::render()
to load and merge classes into the target node
#15
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
984aaa9
to
e1bbcea
Compare
0126f28
to
779e5b9
Compare
e1bbcea
to
ff24a14
Compare
b30d9cb
to
59294b4
Compare
ff24a14
to
8bf75f9
Compare
59294b4
to
b644744
Compare
b644744
to
cc6cbab
Compare
bastjan
approved these changes
Sep 8, 2023
1b2774b
to
93dc801
Compare
2b7cd26
to
fc05daf
Compare
Also update Python tests to be able to handle the exception raised by the `Reclass` constructor, and adjust all existing tests to use the existing test inventory unless we want to test the error handling.
We add a method which loads classes from `Reclass::classes_path` and returns them as `Node` structs. This will be used in the method which loads and merges included classes into a node.
We implement `Node::render()` as the rough equivalent of Python reclass's `_node_entity()` with `render_impl()` loosely matching `_recurse_entity()`. We also update the classes included by node `n1` in the test inventory to have some parameters which will get merged into the node's parameters.
We add node `n2` in the test inventory which includes class `nested.cls1`. That class includes `.cls2` which should resolve to `nested.cls2`.
Also update the Python tests to reflect the new functionality.
fc05daf
to
dd45fd2
Compare
bastjan
approved these changes
Sep 11, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes use of the methods introduced in #13 and #14 to provide method
Node::render()
which iteratively and recursively loads all classes which are transitively included by the Node and merges the contents of those classes into the node, flattening anyValueList
entries which are created by merging theparameters
mappings provided in each individual class.Additionally, this PR introduces method
Node::load_class()
which loads classes fromReclass::classes_path
and returns them asNode
structs.The PR also updates
Reclass::nodeinfo()
to callNode::render()
.Finally, the PR updates the classes included by node
n1
in the test inventory to have some parameters which will get merged into the node's parameters, and add a new noden2
in the test inventory which uses a relative class include in a nested class.With this PR, our implementation should match the results of Python Reclass for nodes which don't use any parameter references. Note that we don't support most of the Python Reclass configuration options yet, the only option which is implemented is
ignore_class_notfound
.Checklist
bug
,enhancement
,documentation
,change
,breaking
,dependency
,internal
as they show up in the changelog