-
Notifications
You must be signed in to change notification settings - Fork 482
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
Implement str
and repr
magic methods for Event
s
#3601
Conversation
Reviewer's Guide by SourceryThis pull request implements the File-Level Changes
Tips
|
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.
Hey @ndonkoHenri - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
attrs = ", ".join( | ||
f"{k}={v!r}" | ||
for k, v in self.__dict__.items() | ||
if k not in ["control", "page", "target"] # ignore these keys |
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.
suggestion: Consider making ignored keys a class-level constant.
Defining the ignored keys as a class-level constant (e.g., IGNORED_KEYS = ["control", "page", "target"]
) can improve maintainability and readability.
if k not in ["control", "page", "target"] # ignore these keys | |
class YourClassName: | |
IGNORED_KEYS = ["control", "page", "target"] | |
def your_method(self): | |
attrs = ", ".join( | |
f"{k}={v!r}" | |
for k, v in self.__dict__.items() | |
if k not in self.IGNORED_KEYS | |
) | |
return f"{self.__class__.__name__}({attrs})" |
Summary by Sourcery
This pull request introduces string representation methods (
__str__
and__repr__
) for theEvent
class, improving debugging and logging capabilities. Additionally, it enhances theContainerControl
to supportonTapDown
events, expanding its interactivity.__str__
and__repr__
magic methods for theEvent
class to provide string representations.ContainerControl
to handleonTapDown
events in addition to existing event handlers.