-
Notifications
You must be signed in to change notification settings - Fork 94
Implement __repr__ for MatchResult
#2353
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
Conversation
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.
Pull Request Overview
Adds a __repr__ method to the MatchResult class to improve its debug-friendly string representation.
- Implements
__repr__to showsuccess,reason, andnodesattributes - Handles an (unlikely) empty
_partial_matchescase - Provides a concise one-line representation for readability
Comments suppressed due to low confidence (2)
onnxscript/rewriter/_basics.py:41
- The new
__repr__implementation isn't covered by existing tests. Adding unit tests for various match states (success/failure, with and without nodes) will help catch regressions.
def __repr__(self) -> str:
onnxscript/rewriter/_basics.py:43
- The condition
if not self._partial_matcheswill never be true because the constructor always initializes_partial_matcheswith onePartialMatchResult. Consider removing or revising this branch to reflect a valid empty-state scenario.
if not self._partial_matches:
❌ 3 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
gramalingam
left a comment
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.
This pull request adds a `__repr__` method to the `MatchResult` class in `onnxscript/rewriter/_basics.py`. The new method provides a string representation of the match result, improving debugging and readability.
This pull request adds a
__repr__method to theMatchResultclass inonnxscript/rewriter/_basics.py. The new method provides a string representation of the match result, improving debugging and readability.