-
Notifications
You must be signed in to change notification settings - Fork 9
Create add
methods on initializers and attributes
#33
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
Merged
Conversation
This file contains hidden or 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
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #33 +/- ##
==========================================
+ Coverage 81.75% 82.23% +0.48%
==========================================
Files 57 57
Lines 6965 7110 +145
Branches 948 958 +10
==========================================
+ Hits 5694 5847 +153
+ Misses 905 902 -3
+ Partials 366 361 -5 ☔ View full report in Codecov by Sentry. |
9c32b3c
to
4f538be
Compare
add
methods on initializers and attributes
justinchuby
commented
May 30, 2025
- Also allow attributes to be initialized with a dictionary Signed-off-by: Justin Chu <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
2b3d340
to
7496efb
Compare
Signed-off-by: Justin Chu <[email protected]>
justinchuby
commented
May 30, 2025
Signed-off-by: Justin Chu <[email protected]>
8528f85
to
a98e2e5
Compare
Signed-off-by: Justin Chu <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
titaiwangms
reviewed
Jun 2, 2025
Signed-off-by: Justin Chu <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
f81143c
to
6859ed6
Compare
justinchuby
commented
Jun 2, 2025
Signed-off-by: Justin Chu <[email protected]>
titaiwangms
approved these changes
Jun 2, 2025
titaiwangms
pushed a commit
to titaiwangms/ir-py
that referenced
this pull request
Jun 2, 2025
1. It's now possible to do `node.attributes.add(ir.Attr(...))` to avoid having to get the name as a redundant step. 2. Also allow node attributes to be initialized with a dictionary - This way users do not have to use ```py ir.Node(attributes=node.attributes.values()) ``` when copying the node. Instead, it is possible to ```py ir.Node(attributes=node.attributes) ``` 3. Implement get_* methods on attributes to make getting default attributes easier. Before ```py attr = node.attributes.get("attr") if attr is not None: value = attr.as_int() else: value = 42 ``` now ```py value = node.attributes.get_int("attr", 42) ``` --------- Signed-off-by: Justin Chu <[email protected]> Signed-off-by: Ti-Tai Wang <[email protected]>
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.
It's now possible to do
node.attributes.add(ir.Attr(...))
to avoid having to get the name as a redundant step.Also allow node attributes to be initialized with a dictionary
when copying the node. Instead, it is possible to
Implement get_* methods on attributes to make getting default attributes easier.
Before
now