Skip to content

Commit

Permalink
Remove mycroft imports (#111)
Browse files Browse the repository at this point in the history
* Refactor to remove `mycroft` module imports
Ensure all dependencies are listed in `requirements.txt`

* Update skill.json

* Fix `intent_handler` import path

* Update tests to resolve failure

* Update tests to resolve failure

* Update tests to resolve failure

---------

Co-authored-by: Daniel McKnight <[email protected]>
Co-authored-by: NeonDaniel <[email protected]>
  • Loading branch information
3 people authored May 10, 2024
1 parent 0e97658 commit c9de0f9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
16 changes: 8 additions & 8 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
from ovos_utils import classproperty
from ovos_utils.log import LOG
from ovos_utils.process_utils import RuntimeRequirements
from mycroft.skills.core import intent_handler, intent_file_handler
from mycroft.util.parse import extract_datetime
from ovos_workshop.decorators import intent_handler
from lingua_franca.parse import extract_datetime


class UserSettingsSkill(NeonSkill):
Expand Down Expand Up @@ -413,7 +413,7 @@ def handle_change_dialog_mode(self, message: Message):

@intent_handler(IntentBuilder("SayMyName").require("tell_me_my")
.require("name").build())
@intent_file_handler("who_am_i.intent")
@intent_handler("who_am_i.intent")
def handle_say_my_name(self, message: Message):
"""
Handle a request to read back a user's name
Expand Down Expand Up @@ -493,7 +493,7 @@ def handle_say_my_email(self, message: Message):

@intent_handler(IntentBuilder("SayMyLocation").require("tell_me_my")
.require("location").build())
@intent_file_handler("where_am_i.intent")
@intent_handler("where_am_i.intent")
def handle_say_my_location(self, message: Message):
"""
Handle a request to read back the user's location
Expand All @@ -520,7 +520,7 @@ def handle_say_my_location(self, message: Message):

@intent_handler(IntentBuilder("SayMyBirthday").require("tell_me_my")
.require("birthday").build())
@intent_file_handler("when_is_my_birthday.intent")
@intent_handler("when_is_my_birthday.intent")
def handle_say_my_birthday(self, message: Message):
"""
Handle a request to read back the user's birthday
Expand Down Expand Up @@ -762,7 +762,7 @@ def handle_set_my_name(self, message: Message):
@intent_handler(IntentBuilder("SayMyLanguageSettings")
.require("tell_me_my").require("language_settings")
.build())
@intent_file_handler("language_settings.intent")
@intent_handler("language_settings.intent")
def handle_say_my_language_settings(self, message: Message):
"""
Handle a request to read back the user's language settings
Expand Down Expand Up @@ -793,7 +793,7 @@ def handle_say_my_language_settings(self, message: Message):
@intent_handler(IntentBuilder("SetSTTLanguage").require("change")
.optionally("my").require("language_stt")
.require("language").require("rx_language").build())
@intent_file_handler("language_stt.intent")
@intent_handler("language_stt.intent")
def handle_set_stt_language(self, message: Message):
"""
Handle a request to change the language spoken by the user
Expand Down Expand Up @@ -837,7 +837,7 @@ def handle_set_stt_language(self, message: Message):
@intent_handler(IntentBuilder("SetTTSLanguage").require("change")
.optionally("my").require("language_tts")
.require("language").require("rx_language").build())
@intent_file_handler("language_tts.intent")
@intent_handler("language_tts.intent")
def handle_set_tts_language(self, message: Message):
"""
Handle a request to change the language spoken to the user
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
neon-utils[network]~=1.4
ovos-utils~=0.0, >=0.0.32
ovos-bus-client~=0.0.3
ovos-workshop~=0.0.15
adapt-parser<2.0,>=0.5
ovos-lingua-franca~=0.4
5 changes: 4 additions & 1 deletion skill.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@
"systemDeps": false,
"requirements": {
"python": [
"adapt-parser<2.0,>=0.5",
"neon-utils[network]~=1.4",
"ovos-bus-client~=0.0.3",
"ovos-utils~=0.0, >=0.0.32"
"ovos-lingua-franca~=0.4",
"ovos-utils~=0.0, >=0.0.32",
"ovos-workshop~=0.0.15"
],
"system": {},
"skill": []
Expand Down
8 changes: 4 additions & 4 deletions test/test_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,8 @@ def _init_test_message(voc, location):
test_profile["location"][setting])
self.assertEqual(profile["location"]["city"], "New York")
self.assertEqual(profile["location"]["state"], "New York")
self.assertAlmostEqual(profile["location"]["lat"], 40.7127281, 5)
self.assertAlmostEqual(profile["location"]["lng"], -74.0060152, 5)
self.assertAlmostEqual(profile["location"]["lat"], 40.7127281, 3)
self.assertAlmostEqual(profile["location"]["lng"], -74.0060152, 3)
self.skill.ask_yesno.reset_mock()
self.skill.speak_dialog.reset_mock()

Expand Down Expand Up @@ -480,8 +480,8 @@ def _init_test_message(voc, location):

self.assertEqual(profile["location"]["city"], "Phoenix")
self.assertEqual(profile["location"]["state"], "Arizona")
self.assertAlmostEqual(profile["location"]["lat"], 33.4484367, 5)
self.assertAlmostEqual(profile["location"]["lng"], -112.074141, 5)
self.assertAlmostEqual(profile["location"]["lat"], 33.4484367, 3)
self.assertAlmostEqual(profile["location"]["lng"], -112.074141, 3)
self.assertEqual(profile["location"]["tz"], "America/Phoenix")
self.assertEqual(profile["location"]["utc"], -7.0)

Expand Down

0 comments on commit c9de0f9

Please sign in to comment.