Skip to content

Commit

Permalink
feat: handle retrofitting adapt imports
Browse files Browse the repository at this point in the history
closes #15
  • Loading branch information
mikejgray committed Jan 17, 2024
1 parent 15c7019 commit 9b222f2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/files/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from ovos_utils.intents import IntentBuilder
from ovos_utils.process_utils import RuntimeRequirements
from ovos_workshop.decorators import intent_handler
# from ovos_workshop.intents import IntentHandler # Uncomment to use Adapt intents
from ovos_workshop.skills import OVOSSkill

# Optional - if you want to populate settings.json with default values, do so here
Expand Down
9 changes: 5 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,17 @@ from ovos_bus_client.message import Message`;
if (line.startsWith('from mycroft')) {
skillFileArray[index] = `# TODO: Remove all Mycroft imports\n# ${line}`;
}
// Replace Adapt IntentBuilder import
if (line.startsWith('from adapt.intent import IntentBuilder')) {
skillFileArray[index] = `# TODO: Replace Adapt IntentBuilder import\n# ${line}`;
}
// Best practices for super().__init__
if (line.includes('super().__init__') && line.includes('name=')) {
skillFileArray[index] = `# TODO: Remove name= parameter from super().__init__
# TODO: Replace args with *args, **kwargs
${line}`;
}
// Deprecated initialize() and create_skill()
if (line.includes('def initialize()')) {
skillFileArray[index] = `# TODO: Remove initialize() and move to __init__() after the super call\n${line}`;
}
// Deprecated create_skill()
if (line.includes('def create_skill(')) {
skillFileArray[index] = `# TODO: Remove create_skill() function\n${line}`;
}
Expand Down
1 change: 1 addition & 0 deletions test/__snapshots__/OVOSSkillProject.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9b222f2

Please sign in to comment.