Commit Graph

421 Commits (ef1a6e24c309c4a025a6d8c2a70c27d872c6b136)

Author SHA1 Message Date
Matthew D. Scholefield ef1a6e24c3 Upgrade padatious to fix travis build 2017-10-06 00:06:08 -05:00
Matthew D. Scholefield b6bc4ee482 Increment padatious version number to 0.3.3
This adds a bugfix for empty containers
2017-10-04 21:50:54 -05:00
Matthew D. Scholefield 43a59b0d88 Fix Padatious to load intents and entities
Doesn't make sense to add intents since no sample lines are provided
2017-10-04 21:45:21 -05:00
Åke 6acc0adb40 Merge pull request #1128 from MycroftAI/feature/to-apache-license
Change to Apache 2.0 license from GPLv3.0
2017-10-04 09:13:40 +02:00
penrods d49ec3616f Fixing PEP8 whitespace errors 2017-10-04 01:44:58 -05:00
penrods 8f2e5d9498 Change to Apache 2.0 license from GPLv3.0
This commit officially switches the mycroft-core repository from
GPLv3.0 licensing to Apache 2.0.  All dependencies on GPL'ed code
have been removed and we have contacted all previous contributors
with still-existing code in the repository to agree to this change.

Going forward, all contributors will sign a Contributor License
Agreement (CLA) by visiting https://mycroft.ai/cla, then they will
be included in the Mycroft Project's overall Contributor list,
found at: https://github.com/MycroftAI/contributors.  This cleanly
protects the project, the contributor and all who use the technology
to build upon.

Futher discussion can be found at this blog post:
https://mycroft.ai/blog/right-license/

This commit also removes all __author__="" from the code.  These
lines are painful to maintain and the etiquette surrounding their
maintainence is unclear.  Do you remove a name from the list if the
last line of code the wrote gets replaced?  Etc.  Now all
contributors are publicly acknowledged in the aforementioned repo,
and actual authorship is maintained by Github in a much more
effective and elegant way!

Finally, a few references to "Mycroft AI" were changed to the correct
legal entity name "Mycroft AI Inc."

==== Fixed Issues ====
#403 Update License.md and file headers to Apache 2.0
#400 Update LICENSE.md

====  Documentation Notes ====
Deprecated the ScheduledSkill and ScheduledCRUDSkill classes.
These capabilities have been superceded by the more flexible MycroftSkill
class methods schedule_event(), schedule_repeating_event(), update_event(),
and cancel_event().
2017-10-04 01:28:44 -05:00
Åke b850143824 Merge pull request #1117 from forslund/bugfix/inspect-failure
Add workaround for inspect-decorator problem
2017-10-04 07:08:15 +02:00
Matthew D. Scholefield 32ac6a83da Fix Padatious parameter 2017-10-03 19:31:37 -05:00
Matthew D. Scholefield 403aeb9360 Upgrade Padatious to 0.3.2 which brings in entity support 2017-10-03 12:17:02 -05:00
Jarbas f5806b86c5 fallback start, end, failure messages (#1108)
==== Tech Notes ====
Add mycroft.skill.handler.start and mycroft.skill.handler.complete to fallback handler. handler in data field will be called "fallback" upon completion the used handler will be reported in the "fallback_handler" data entry.

* fix

* pep8

* fallback handler name
2017-09-28 17:53:57 +02:00
Åke Forslund 838e2dd7d8 Remove repeating events from saved schedule
====  Tech Notes ====
Repeating events are not saved to make sure repeating events aren't
stacked over and over.
2017-09-28 02:24:34 -05:00
Åke Forslund 5d9574ea4f Reorder canceling and adding event handling
====  Tech Notes ====
If cancel + add event messages arrive at roughly the same time the add
would be overridden by the cancel. More intuitive to handle cancel first
and add new arrived events after.
2017-09-28 02:24:34 -05:00
Åke Forslund 1d0e65dfb1 Fix update_event and cancel_event methods
====  Tech Notes ====
update_event and cancel_event did not use a name unique to the skill
forcing the user to build it themselves. Now the unique name is
constructed in the method _unique_name() for all event scheduling
methods.
2017-09-28 02:24:34 -05:00
Åke Forslund 68a96b40b0 Add workaround for inspect-decorator problem
====  Tech Notes ====
when using multiple decorators on a method inspect will return incorrect
values despite @wraps. This causes the intent handler to fail to
execute.

@decorator can't really be of help here since it doesn't handle
decorators with arguments (as far as I can understand)

This is a workaround using the fact that the argument count will be zero
on methods with multiple decorators, and basically tries the usual
signatures
2017-09-26 19:11:33 +02:00
Matthew D. Scholefield 5e392f34aa Optimize imports
Remove unused imports and group local vs external alphabetically
2017-09-18 16:07:50 -05:00
Matthew D. Scholefield cfdc405da5 Add new LOG class 2017-09-18 13:56:06 -05:00
Åke Forslund f756673bff Start network check faster
====  Tech Notes ====
The network check is now only delayed until priority skills have been
loaded (this includes the relevant pairing skill)
2017-09-15 06:48:39 -05:00
Åke Forslund a100d2a6dc Refactor priority skill loading
====  Tech Notes ====
- Set pairing as a priority skill by default
- Move priority loading to separate function
2017-09-15 06:48:39 -05:00
Jarbas 82b49c1397 Jarbas work adding priority skill loading 2017-09-15 06:48:39 -05:00
Åke Forslund cf9aafa765 Add data to the information of running skill
==== Tech Notes ====
The handler name (including class if available) is sent along in the
data field. If an exception is raised an exception field in the data is
added with minor information of the problem.
2017-09-14 16:38:54 -05:00
Åke Forslund 1d6da7d37d Add messages for skill handler's starting/stopping
====  Tech Notes ====
Add message bus messages when a skill handler is starting to execute and
a separate message for when skill handler completes. Usable if grouping
speech in certain clients for example. Can also be of use for audio
ducking and similar processes.

==== Protocol Notes ====
Adds the following messages:
mycroft.skill.handler.start
mycroft.skill.handler.complete
2017-09-14 16:38:54 -05:00
Åke Forslund a33c07621b Reduce configuration loading in module scope
====  Tech Notes ====
Autoloading configuration in submodules is bad for testing purposes and
should be reduced. It takes time and adds the possibility of altering
the base conditions for the tests

- mycroft/skills/core: global configuration moved to main.py
- mycroft/messagebus/client/ws.py global config moved to __init__ of
Websocket
- client/speech/mic.py global config moved to ResponsiveRecognizer
__init__() method
- client/enclosure/display_manager.py
 - get_ipc_directory() called in methods where used
2017-09-13 12:51:48 -05:00
Åke Forslund 14f931e046 Fix send pairing utterance before loading skills
====  Tech Notes ====
Add a wait until skills have been loaded once before checking for
internet connection. If not an "I'm sorry I didn't catch that" may be
emitted since the pairing skill isn't loaded.
2017-09-13 12:49:31 -05:00
Åke Forslund 31701fc05d Add more safety around the context manager
====  Tech Notes ====
- Sanity check Message in handle_add_context(), 'word' needs to be a
string before calling into the context manager.
- Sanity check Message in handle_remove_context(), make sure a context
keyword was received before trying to remove.
- Docstrings
- Suppress exceptions while injecting context
2017-09-13 12:44:35 -05:00
Åke Forslund 5ddf1250ab Fix issues discovered by codacity. 2017-09-12 15:07:20 -05:00
Åke Forslund df8fe650c8 Update docstrings after PR feedback 2017-09-12 15:07:20 -05:00
Åke Forslund f1c6912d43 Add event scheduler
====  Tech Notes ====
A single thread handling scheduled events. The skills interact with this
using the self.schedule_event() self.schedule_repeating_event
self.update_event() and self.remove_event().

This is an improvement over scheduledSkill since each skill creates
their own Thread and has to handle storing/restoring scheduled events
between starts.

All pending events are stored in a json file at shutdown for future
sessions.

====  Documentation Notes ====
Needs to be documented

==== Protocol Notes ====
new messagebus event handlers:
- mycroft.scheduler.schedule_event
- mycroft.scheduler.remove_event
- mycroft.scheduler.update_event
2017-09-12 15:07:20 -05:00
Åke Forslund 72a318cd92 make skill id hash of skill directory
====  Tech Notes ====
To ensure that the skills have the same id when loading the id was
replaced with a hash of the skill directory. (as long the skill isn't
 renamed). This is useful for things like the event_scheduler where
skills are referenced using the skill id and has info being persistent
over restarts
2017-09-11 19:43:02 -05:00
Matthew D. Scholefield 9efcc01ce0 Update padatious 2017-09-06 19:22:33 -05:00
Åke 27dba0c786 Merge branch 'dev' into make_message_optional 2017-09-01 21:29:16 +02:00
Åke Forslund c7c25cc01b Fix errors during shutdown
====  Tech Notes ====
Skills weren't cleanly shutdown. This ensures that skills are shutdown more cleanly and that shutdown procedure will not be interrupted by broken shutdown methods.

Shutdown of reload thread fixed

Unused globals removed
2017-09-01 10:53:22 -05:00
Åke Forslund 2881b1842f Setting storage is no longer forced at shutdown
Risk of corruption if the skill service was terminated while settings
were written was determined to be greater than any benefit from this.
2017-09-01 10:45:05 -05:00
Åke Forslund 0782064819 Write settings dict to disk more frequently
====  Tech Notes ====
After an intent has been handled the settings will be stored if any changes are detected.

A force option was added to the .store method of the settings class which always writes the dict to disk even if no changes has been made. This is used during shutdown.
2017-09-01 10:45:05 -05:00
Michael Nguyen 995d67e612 Merge pull request #1018 from forslund/bugfix/issue-1014
Bugfix/issue 1014
2017-08-31 15:59:32 -05:00
Michael Nguyen 2dc6e47bea Merge pull request #1020 from forslund/bugfix/issue-1019
Fix expect response for speak_dialog
2017-08-31 15:58:54 -05:00
Michael Nguyen e7775d26d0 Merge pull request #1026 from forslund/bugfix/issue-1022
Fix failure when using one_of in intents
2017-08-31 15:58:38 -05:00
Michael Nguyen 2dab08f483 Merge pull request #1035 from forslund/bugfix/localization
Bugfix/localization
2017-08-31 15:58:02 -05:00
Åke Forslund 144e9c016c Automatically find skill directory in __init__
====  Tech Notes ====
Previously the _dir parameter was poplated from the skill loader between calling __init__() and initialize(). The skill path can however be gleaned from with in the __init__() of MycroftSkill.

Doing this makes the settings accessable from __init__() as well and will allow a more straight forward usage.
2017-08-31 15:54:46 -05:00
Åke Forslund d746a87e34 Added docstring for update_context
Including note about not working on one_of keywords.
2017-08-31 21:34:30 +02:00
Åke Forslund de8dff6320 defaulting to TimeRulesEnUs now works
====  Tech Notes ====
Wheb a language without time rules were defaulted back to us-english
time rules the class was instanciated prematurely. Now the default
returns a class and not an object.
2017-08-31 00:18:43 +02:00
Åke Forslund 7022239456 Fix failure when using one_of in intents
==== Fixed Issues ====
#1022

====  Tech Notes ====
When a one_of intent is hit the intent returned by adapt doesn't look like normal require/optional intent parameters. This PR adds a check for entities before trying to accessing them when trying to update context.

This is a temporary workaround while it's determined if the adapt behaviour is correct or should be modified to conform to the normal format. (See issue 66 in the adapt repo), but in any case it's a good sanity check
2017-08-29 09:05:29 +02:00
Åke Forslund b44b2914af Fix expect response for speak_dialog
==== Fixed Issues ====
the expect_response pararmeter is now correctly passed along to
self.speak()

====  Tech Notes ====
NONE - explain new algorithms in detail, tool changes, etc.

====  Documentation Notes ====
NONE - description of a new feature or notes on behavior changes

==== Localization Notes ====
NONE - point to new strings, language specific functions, etc.

==== Environment Notes ====
NONE - new package requirements, new files being written to disk, etc.

==== Protocol Notes ====
NONE - message types added or changed, new signals, APIs, etc.
2017-08-25 14:26:33 +02:00
Åke Forslund 34a527b130 Add warning if skill isn't properly removed 2017-08-25 11:15:50 +02:00
Åke Forslund 3be861cee2 Fix trailing references causing memory leak
==== Fixed Issues ====

====  Tech Notes ====
This PR corrects a couple of small issues led to skills being left in memory when.
- Handler for `stop.mycroft` weren't removed from event emitter when
skill shut down. Now is added using `self.add_event()`
- registered intent list `self.events` created a circular reference that
python couldn't resolve a live so this is now deleted at shutdown
- Timers in scheduled skills weren't terminated properly. Now if the
timer is alive it will be joined

====  Documentation Notes ====
Registring event handlers should use `self.add_event` instead of
`self.emitter.on()` To make sure they are cleaned up when skill is
terminated.

==== Localization Notes ====
NONE - point to new strings, language specific functions, etc.

==== Environment Notes ====
NONE - new package requirements, new files being written to disk, etc.

==== Protocol Notes ====
NONE - message types added or changed, new signals, APIs, etc.
2017-08-25 11:15:50 +02:00
ginanjar azie 41c7921bbb make message parameter on intent handler optional 2017-08-24 11:15:25 +07:00
Åke Forslund dea591e9b8 Cleanup imports 2017-08-22 08:45:06 +02:00
Åke Forslund e61b516ea1 Add more docstrings 2017-08-22 07:40:28 +02:00
Åke Forslund 12bf78cd5f Move funcs only used in skill_tester from core.py
====  Tech Notes ====
Some functions have been orphaned in core.py and are only used in the
tests. To clean up these have been moved to where they're used.
2017-08-21 15:59:48 +02:00
Åke Forslund bb0fbb51ed Cleanup skill service main
====  Tech Notes ====
Minor cleanup and comments
2017-08-21 15:59:48 +02:00
Åke Forslund ebcbbd3a60 Fix skill container
==== Fixed Issues ====
#1007

====  Tech Notes ====
The converse system changed the api for the load_skill() function this
since the skill_container wasn't updated accordingly it stopped working.
This PR makes updates the container to use the new interface.
2017-08-21 15:09:51 +02:00