Skip to content
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

port of the resource file handling refactor from mk2 #130

Merged
merged 2 commits into from Jun 3, 2022

Conversation

NeonJarbas
Copy link

@NeonJarbas NeonJarbas commented Jun 3, 2022

port of the resource file handling refactor https://github.com/MycroftAI/mycroft-core/blob/mark-ii/qa/mycroft/skills/skill_data.py

this PR increases compatibility with mark2 while remaining fully backwards compatible.
More mark2 exclusive skills will be able to run in ovos-core once this is merged

cherry picked commits from mark2:

  • add the logic for "template" resource files back in.
  • add regex file loading for skill into resources code
  • added support for .word files and fixed a regex bug
  • fixes a bug where the dialog data is not passed to the renderer
  • removed spurious print statements
  • another iteration of improving the resource file handling
  • update dialog renderer in the translator after all dialogs are loaded
  • Move resource file location and translation logic into skill_data.py

credits of the original refactor go to @chrisveilleux

ovos improvements:

  • port the lang dialect support code to the new style
  • refactor the skill dialog_renderer to live in the new SkillResources class
  • refactor generic resource file handling logic self.find_resource and move it to skill_data.py
  • add back multi lingual support
  • add "new style" helper class for core resource files
  • restore backwards compat, methods + arguments api
  • deprecate internal methods (lots of MycroftSkill private methods removed!)

@JarbasAl JarbasAl added refactor code refactor without functional changes mk2 ported from mark2 labels Jun 3, 2022
@JarbasAl JarbasAl changed the title add the logic for "template" resource files back in. port of the resource file handling refactor from mk2 Jun 3, 2022
@codecov
Copy link

codecov bot commented Jun 3, 2022

Codecov Report

Merging #130 (353f775) into dev (6ceb058) will increase coverage by 2.53%.
The diff coverage is 41.47%.

Current head 353f775 differs from pull request most recent head 876f0c1. Consider uploading reports for the commit 876f0c1 to get more accurate results

@@            Coverage Diff             @@
##              dev     #130      +/-   ##
==========================================
+ Coverage   50.35%   52.88%   +2.53%     
==========================================
  Files         119      150      +31     
  Lines       10077     9566     -511     
==========================================
- Hits         5074     5059      -15     
+ Misses       5003     4507     -496     
Impacted Files Coverage Δ
mycroft/audio/__main__.py 0.00% <0.00%> (ø)
mycroft/client/enclosure/__main__.py 0.00% <0.00%> (ø)
mycroft/client/enclosure/mark1/arduino.py 0.00% <0.00%> (ø)
mycroft/client/enclosure/mark1/eyes.py 0.00% <0.00%> (ø)
mycroft/client/enclosure/mark1/mouth.py 0.00% <0.00%> (ø)
mycroft/client/speech/__main__.py 0.00% <0.00%> (ø)
mycroft/client/speech/hotword_factory.py 0.00% <0.00%> (-88.89%) ⬇️
mycroft/client/speech/service.py 0.00% <0.00%> (ø)
mycroft/client/speech/silence.py 0.00% <0.00%> (-42.86%) ⬇️
mycroft/client/text/__init__.py 0.00% <0.00%> (ø)
... and 114 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4129817...876f0c1. Read the comment docs.

@JarbasAl JarbasAl marked this pull request as ready for review June 3, 2022 17:57
@JarbasAl JarbasAl requested a review from NeonDaniel June 3, 2022 17:57
@NeonJarbas NeonJarbas force-pushed the port/mk2_resource_handling branch 2 times, most recently from a48d0e0 to 62666ac Compare June 3, 2022 20:06
cherry-picked commits:

- add the logic for "template" resource files back in.
- add the logic for "template" resource files back in.
- add regex file loading for skill into resources code
- added support for .word files and fixed a regex bug
- fixes a bug where the dialog data is not passed to the renderer
- removed spurious print statements
- another iteration of improving the resource file handling
- update dialog renderer in the translator after all dialogs are loaded
- Move resource file location and translation logic into skill_data.py
increases compatibility with mark2 while remaining fully backwards compatible. More mark2 exclusive skills will be able to run

squashed commits:
- add CoreResources helper class
- move find_resource logic to skill_data.py
- cache resources per lang to avoid excessive file reads
- adapt compat
- move dialog_renderer to SkillResources
- add back multi lang support
- restore old methods for backwards compat
@JarbasAl JarbasAl merged commit cb26813 into OpenVoiceOS:dev Jun 3, 2022
4 of 5 checks passed
@JarbasAl JarbasAl mentioned this pull request Jun 4, 2022
@NeonJarbas NeonJarbas mentioned this pull request Jun 5, 2022
@NeonJarbas NeonJarbas deleted the port/mk2_resource_handling branch June 8, 2022 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mk2 ported from mark2 refactor code refactor without functional changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants