-
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 support for config option compose-node-name
#84
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
This comment was marked as outdated.
This comment was marked as outdated.
c7f30d0
to
3a5f5ac
Compare
This comment was marked as outdated.
This comment was marked as outdated.
3a5f5ac
to
784a5e0
Compare
This comment was marked as outdated.
This comment was marked as outdated.
784a5e0
to
6951e43
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
e8b68b5
to
3a6d26c
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
6a32cdd
to
f01746d
Compare
This comment was marked as outdated.
This comment was marked as outdated.
6d4cd9e
to
0e93687
Compare
f01746d
to
e8eed26
Compare
This comment was marked as outdated.
This comment was marked as outdated.
064a524
to
2eab4a3
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
2eab4a3
to
c827bac
Compare
This comment was marked as outdated.
This comment was marked as outdated.
c827bac
to
178c9f3
Compare
This comment was marked as outdated.
This comment was marked as outdated.
0e93687
to
7d7e934
Compare
6 tasks
178c9f3
to
523cabb
Compare
This comment was marked as outdated.
This comment was marked as outdated.
523cabb
to
f41dfca
Compare
This comment was marked as outdated.
This comment was marked as outdated.
HappyTetrahedron
approved these changes
Feb 13, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really ought to learn rust.
When enabled, this option allows users to define nodes in nested directories in `nodes_path`. Node names are constructed the same way as class names, by replacing directory separators with dots. This commit implements support for compose-node-name in such a way that the resulting node metadata is compatible with Python reclass.
…bled Python reclass discards literal dots in node filepaths when compose-node-name is enabled, resulting in incorrect node metadata for nodes which have literal dots in their filename (e.g. node `a.1` in the `test/inventory-compose-node-name` inventory). This commit implements compatibility flag `ComposeNodeNameLiteralDots`. When set, this flag tells reclass-rs to generate node metadata which matches Python reclass when compose-node-name is enabled. By default (i.e. without the compatibility flag), reclass-rs preserves literal dots in node names when compose-node-name is enabled. To implement the new default behavior, we additionally track the node's path in `nodes_path` in `NodeInfoMeta`, so that we can ensure that literal dots are preserved when generating the node's metadata.
PyO3's getters return a clone of the field, so we can't directly operate on `Reclass.config.compatflags`. Instead we introduce methods `set_compat_flag()`, `unset_compat_flag()` and `clear_compat_flags()` on class `Reclass` to modify compatibility flags from Python.
In particular, test compat flag
The compose-node-name feature in Python Reclass treats nodes whose path in `nodes_path` starts with a `_` as top-level nodes. We extend our implementation of compose-node-name and the test inventory for compose-node-name to handle such nodes the same way as Python reclass.
f41dfca
to
0537541
Compare
Benchmark for ef2f3fbClick to view benchmark
|
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 adds support for the Reclass option
compose-node-name
.Additionally, we implement support for compatibility flags (including helpers to set/unset/clear flags from Python), and introduce a first flag
ComposeNodeNameLiteralDots
. This flag configures reclass-rs to generate node metadata which matches Python reclass whencompose-node-name
is enabled.The compatibility flag is required because Python reclass discards literal dots in node filepaths when
compose-node-name
is enabled, resulting in incorrect node metadata for nodes which have literal dots in their filename (e.g. nodea.1
in thetest/inventory-compose-node-name
inventory).By default, reclass-rs will preserve literal dots in the node metadata (
path
, andpart
) for node names whencompose-node-name
is enabled.Checklist
bug
,enhancement
,documentation
,change
,breaking
,dependency
,internal
as they show up in the changelog