-
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
fix: usage_of_deprecated_method #24
Conversation
self.translate has been deprecated for a while and remove from ovos-workshop base class similar to OpenVoiceOS/skill-ovos-date-time#56
WalkthroughThe changes primarily focus on the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
__init__.py (2)
699-706
: Consider refactoring dialog construction for better maintainability.The current approach of building dialog messages through string concatenation could be refactored into a dedicated method. This would improve readability and make the code more maintainable.
Consider this approach:
- if data["name"]: - dialog = f"{data['name']} -" - if "repeat" in data: - dialog = f"{dialog} {self.resources.render_dialog('repeating_every', data)}" - if alert_type == AlertType.TIMER: - dialog = f"{dialog} {self.resources.render_dialog('in_time', data)}\n" - else: - dialog = f"{dialog} {self.resources.render_dialog('at_time', data)}\n" + dialog = self._build_alert_dialog(data, alert_type)And add a new method:
def _build_alert_dialog(self, data: dict, alert_type: AlertType) -> str: """Build the dialog string for an alert.""" parts = [] if data["name"]: parts.append(f"{data['name']} -") if "repeat" in data: parts.append(self.resources.render_dialog('repeating_every', data)) time_dialog = 'in_time' if alert_type == AlertType.TIMER else 'at_time' parts.append(self.resources.render_dialog(time_dialog, data)) return " ".join(parts) + "\n"
Line range hint
673-707
: Consider breaking down the method for better maintainability.The
handle_list_all_alerts
method handles multiple responsibilities and contains nested loops and conditions. Consider breaking it down into smaller, focused methods to improve readability and maintainability.Suggested structure:
- Split alert filtering and grouping into a separate method
- Create dedicated methods for handling different alert types
- Move dialog construction logic to a separate method (as suggested earlier)
This would make the code more modular and easier to test and maintain.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
__init__.py
(1 hunks)
🔇 Additional comments (1)
__init__.py (1)
701-705
: LGTM! Successfully migrated from deprecated translate method.
The changes correctly replace the deprecated self.translate
method with self.resources.render_dialog
for rendering dialog strings, maintaining the same functionality while using the recommended API.
self.translate has been deprecated for a while and remove from ovos-workshop base class
similar to OpenVoiceOS/skill-ovos-date-time#56
Summary by CodeRabbit
New Features
Bug Fixes