{"action":"created","comment":{"url":"https://api.github.com/repos/MycroftAI/mycroft-core/pulls/comments/68468134","id":68468134,"diff_hunk":"@@ -0,0 +1,99 @@\n+import unittest\n+from os.path import join, dirname\n+\n+from mycroft.skills.core import load_regex_from_file, load_regex\n+from mycroft.util.log import getLogger\n+\n+__author__ = 'eward'\n+logger = getLogger(__name__)\n+\n+\n+class MockEmitter(object):\n+    def __init__(self):\n+        self.types = []\n+        self.results = []\n+\n+    def emit(self, message):\n+        self.types.append(message.message_type)\n+        self.results.append(message.metadata['regex'])\n+\n+    def get_types(self):\n+        return self.types\n+\n+    def get_results(self):\n+        return self.results\n+\n+    def reset(self):\n+        self.types = []\n+        self.results = []\n+\n+\n+class MycroftSkillTest(unittest.TestCase):\n+    emitter = MockEmitter()\n+\n+    def check_load_from_file(self, path, emitter, regex_list):\n+        load_regex_from_file(path, emitter)\n+        self.check_emitter(emitter, regex_list)\n+\n+    def check_load(self, path, emitter, regex_list):\n+        load_regex(path, emitter)\n+        self.check_emitter(emitter, regex_list)\n+\n+    def check_emitter(self, emitter, regex_list):\n+        for type in emitter.get_types():\n+            self.assertEquals(type, 'register_vocab')\n+        if not regex_list:\n+            self.assertEquals(emitter.get_results(), regex_list)\n+        for value in regex_list:\n+            self.assertTrue(value in emitter.get_results())\n+        self.emitter.reset()\n+\n+    def test_load_regex_from_file_single(self):\n+        self.check_load_from_file(join(dirname(__file__),","path":"test/skills/core.py","position":52,"original_position":52,"commit_id":"e5a7d80623cc8e5ea298f9bd246038627a45fb33","original_commit_id":"e5a7d80623cc8e5ea298f9bd246038627a45fb33","user":{"login":"jdorleans","id":1254399,"avatar_url":"https://avatars.githubusercontent.com/u/1254399?v=3","gravatar_id":"","url":"https://api.github.com/users/jdorleans","html_url":"https://github.com/jdorleans","followers_url":"https://api.github.com/users/jdorleans/followers","following_url":"https://api.github.com/users/jdorleans/following{/other_user}","gists_url":"https://api.github.com/users/jdorleans/gists{/gist_id}","starred_url":"https://api.github.com/users/jdorleans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdorleans/subscriptions","organizations_url":"https://api.github.com/users/jdorleans/orgs","repos_url":"https://api.github.com/users/jdorleans/repos","events_url":"https://api.github.com/users/jdorleans/events{/privacy}","received_events_url":"https://api.github.com/users/jdorleans/received_events","type":"User","site_admin":false},"body":"Create a new constant on your class level to represent your file path just like you did for emitter:\r\n`path = join(dirname(__file__)`, then replace all `join(dirname(__file__)` to the variable.","created_at":"2016-06-24T21:49:35Z","updated_at":"2016-06-24T21:49:35Z","html_url":"https://github.com/MycroftAI/mycroft-core/pull/222#discussion_r68468134","pull_request_url":"https://api.github.com/repos/MycroftAI/mycroft-core/pulls/222","_links":{"self":{"href":"https://api.github.com/repos/MycroftAI/mycroft-core/pulls/comments/68468134"},"html":{"href":"https://github.com/MycroftAI/mycroft-core/pull/222#discussion_r68468134"},"pull_request":{"href":"https://api.github.com/repos/MycroftAI/mycroft-core/pulls/222"}}},"pull_request":{"url":"https://api.github.com/repos/MycroftAI/mycroft-core/pulls/222","id":74858869,"html_url":"https://github.com/MycroftAI/mycroft-core/pull/222","diff_url":"https://github.com/MycroftAI/mycroft-core/pull/222.diff","patch_url":"https://github.com/MycroftAI/mycroft-core/pull/222.patch","issue_url":"https://api.github.com/repos/MycroftAI/mycroft-core/issues/222","number":222,"state":"open","locked":false,"title":"Issues 108 - Change regex to be localized","user":{"login":"ethanaward","id":17013620,"avatar_url":"https://avatars.githubusercontent.com/u/17013620?v=3","gravatar_id":"","url":"https://api.github.com/users/ethanaward","html_url":"https://github.com/ethanaward","followers_url":"https://api.github.com/users/ethanaward/followers","following_url":"https://api.github.com/users/ethanaward/following{/other_user}","gists_url":"https://api.github.com/users/ethanaward/gists{/gist_id}","starred_url":"https://api.github.com/users/ethanaward/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethanaward/subscriptions","organizations_url":"https://api.github.com/users/ethanaward/orgs","repos_url":"https://api.github.com/users/ethanaward/repos","events_url":"https://api.github.com/users/ethanaward/events{/privacy}","received_events_url":"https://api.github.com/users/ethanaward/received_events","type":"User","site_admin":false},"body":"This adds a new `load_regex_files` method in `MycroftSkill`, as well as supporting functions. It registers regex from files like `load_vocab_files` does for vocab. It is currently not in `load_data_files`, as the majority of skills do not use regex.\r\n\r\nIt also refactors all of the skills that use the old `register_regex` syntax to use the new localized syntax, with the exception of the `ScheduledCRUDSkill` base class that @jdorleans made.","created_at":"2016-06-22T21:15:53Z","updated_at":"2016-06-24T21:49:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d6abc338dd0c7555704ef90df7507d213c13a077","assignee":{"login":"jdorleans","id":1254399,"avatar_url":"https://avatars.githubusercontent.com/u/1254399?v=3","gravatar_id":"","url":"https://api.github.com/users/jdorleans","html_url":"https://github.com/jdorleans","followers_url":"https://api.github.com/users/jdorleans/followers","following_url":"https://api.github.com/users/jdorleans/following{/other_user}","gists_url":"https://api.github.com/users/jdorleans/gists{/gist_id}","starred_url":"https://api.github.com/users/jdorleans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdorleans/subscriptions","organizations_url":"https://api.github.com/users/jdorleans/orgs","repos_url":"https://api.github.com/users/jdorleans/repos","events_url":"https://api.github.com/users/jdorleans/events{/privacy}","received_events_url":"https://api.github.com/users/jdorleans/received_events","type":"User","site_admin":false},"assignees":[{"login":"jdorleans","id":1254399,"avatar_url":"https://avatars.githubusercontent.com/u/1254399?v=3","gravatar_id":"","url":"https://api.github.com/users/jdorleans","html_url":"https://github.com/jdorleans","followers_url":"https://api.github.com/users/jdorleans/followers","following_url":"https://api.github.com/users/jdorleans/following{/other_user}","gists_url":"https://api.github.com/users/jdorleans/gists{/gist_id}","starred_url":"https://api.github.com/users/jdorleans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdorleans/subscriptions","organizations_url":"https://api.github.com/users/jdorleans/orgs","repos_url":"https://api.github.com/users/jdorleans/repos","events_url":"https://api.github.com/users/jdorleans/events{/privacy}","received_events_url":"https://api.github.com/users/jdorleans/received_events","type":"User","site_admin":false},{"login":"clusterfudge","id":1755317,"avatar_url":"https://avatars.githubusercontent.com/u/1755317?v=3","gravatar_id":"","url":"https://api.github.com/users/clusterfudge","html_url":"https://github.com/clusterfudge","followers_url":"https://api.github.com/users/clusterfudge/followers","following_url":"https://api.github.com/users/clusterfudge/following{/other_user}","gists_url":"https://api.github.com/users/clusterfudge/gists{/gist_id}","starred_url":"https://api.github.com/users/clusterfudge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clusterfudge/subscriptions","organizations_url":"https://api.github.com/users/clusterfudge/orgs","repos_url":"https://api.github.com/users/clusterfudge/repos","events_url":"https://api.github.com/users/clusterfudge/events{/privacy}","received_events_url":"https://api.github.com/users/clusterfudge/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/MycroftAI/mycroft-core/pulls/222/commits","review_comments_url":"https://api.github.com/repos/MycroftAI/mycroft-core/pulls/222/comments","review_comment_url":"https://api.github.com/repos/MycroftAI/mycroft-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MycroftAI/mycroft-core/issues/222/comments","statuses_url":"https://api.github.com/repos/MycroftAI/mycroft-core/statuses/e5a7d80623cc8e5ea298f9bd246038627a45fb33","head":{"label":"ethanaward:feature/issues-108","ref":"feature/issues-108","sha":"e5a7d80623cc8e5ea298f9bd246038627a45fb33","user":{"login":"ethanaward","id":17013620,"avatar_url":"https://avatars.githubusercontent.com/u/17013620?v=3","gravatar_id":"","url":"https://api.github.com/users/ethanaward","html_url":"https://github.com/ethanaward","followers_url":"https://api.github.com/users/ethanaward/followers","following_url":"https://api.github.com/users/ethanaward/following{/other_user}","gists_url":"https://api.github.com/users/ethanaward/gists{/gist_id}","starred_url":"https://api.github.com/users/ethanaward/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethanaward/subscriptions","organizations_url":"https://api.github.com/users/ethanaward/orgs","repos_url":"https://api.github.com/users/ethanaward/repos","events_url":"https://api.github.com/users/ethanaward/events{/privacy}","received_events_url":"https://api.github.com/users/ethanaward/received_events","type":"User","site_admin":false},"repo":{"id":60125588,"name":"mycroft-core","full_name":"ethanaward/mycroft-core","owner":{"login":"ethanaward","id":17013620,"avatar_url":"https://avatars.githubusercontent.com/u/17013620?v=3","gravatar_id":"","url":"https://api.github.com/users/ethanaward","html_url":"https://github.com/ethanaward","followers_url":"https://api.github.com/users/ethanaward/followers","following_url":"https://api.github.com/users/ethanaward/following{/other_user}","gists_url":"https://api.github.com/users/ethanaward/gists{/gist_id}","starred_url":"https://api.github.com/users/ethanaward/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethanaward/subscriptions","organizations_url":"https://api.github.com/users/ethanaward/orgs","repos_url":"https://api.github.com/users/ethanaward/repos","events_url":"https://api.github.com/users/ethanaward/events{/privacy}","received_events_url":"https://api.github.com/users/ethanaward/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ethanaward/mycroft-core","description":"Mycroft Core, the Mycroft Artificial Intelligence platform.","fork":true,"url":"https://api.github.com/repos/ethanaward/mycroft-core","forks_url":"https://api.github.com/repos/ethanaward/mycroft-core/forks","keys_url":"https://api.github.com/repos/ethanaward/mycroft-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ethanaward/mycroft-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ethanaward/mycroft-core/teams","hooks_url":"https://api.github.com/repos/ethanaward/mycroft-core/hooks","issue_events_url":"https://api.github.com/repos/ethanaward/mycroft-core/issues/events{/number}","events_url":"https://api.github.com/repos/ethanaward/mycroft-core/events","assignees_url":"https://api.github.com/repos/ethanaward/mycroft-core/assignees{/user}","branches_url":"https://api.github.com/repos/ethanaward/mycroft-core/branches{/branch}","tags_url":"https://api.github.com/repos/ethanaward/mycroft-core/tags","blobs_url":"https://api.github.com/repos/ethanaward/mycroft-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ethanaward/mycroft-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ethanaward/mycroft-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/ethanaward/mycroft-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ethanaward/mycroft-core/statuses/{sha}","languages_url":"https://api.github.com/repos/ethanaward/mycroft-core/languages","stargazers_url":"https://api.github.com/repos/ethanaward/mycroft-core/stargazers","contributors_url":"https://api.github.com/repos/ethanaward/mycroft-core/contributors","subscribers_url":"https://api.github.com/repos/ethanaward/mycroft-core/subscribers","subscription_url":"https://api.github.com/repos/ethanaward/mycroft-core/subscription","commits_url":"https://api.github.com/repos/ethanaward/mycroft-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/ethanaward/mycroft-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/ethanaward/mycroft-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/ethanaward/mycroft-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/ethanaward/mycroft-core/contents/{+path}","compare_url":"https://api.github.com/repos/ethanaward/mycroft-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ethanaward/mycroft-core/merges","archive_url":"https://api.github.com/repos/ethanaward/mycroft-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ethanaward/mycroft-core/downloads","issues_url":"https://api.github.com/repos/ethanaward/mycroft-core/issues{/number}","pulls_url":"https://api.github.com/repos/ethanaward/mycroft-core/pulls{/number}","milestones_url":"https://api.github.com/repos/ethanaward/mycroft-core/milestones{/number}","notifications_url":"https://api.github.com/repos/ethanaward/mycroft-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ethanaward/mycroft-core/labels{/name}","releases_url":"https://api.github.com/repos/ethanaward/mycroft-core/releases{/id}","deployments_url":"https://api.github.com/repos/ethanaward/mycroft-core/deployments","created_at":"2016-05-31T21:41:49Z","updated_at":"2016-05-31T21:41:50Z","pushed_at":"2016-06-24T19:57:04Z","git_url":"git://github.com/ethanaward/mycroft-core.git","ssh_url":"git@github.com:ethanaward/mycroft-core.git","clone_url":"https://github.com/ethanaward/mycroft-core.git","svn_url":"https://github.com/ethanaward/mycroft-core","homepage":"https://mycroft.ai","size":75577,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"MycroftAI:master","ref":"master","sha":"dee4e72b2a1e888efe5554f9142e3342f004f8a8","user":{"login":"MycroftAI","id":14171097,"avatar_url":"https://avatars.githubusercontent.com/u/14171097?v=3","gravatar_id":"","url":"https://api.github.com/users/MycroftAI","html_url":"https://github.com/MycroftAI","followers_url":"https://api.github.com/users/MycroftAI/followers","following_url":"https://api.github.com/users/MycroftAI/following{/other_user}","gists_url":"https://api.github.com/users/MycroftAI/gists{/gist_id}","starred_url":"https://api.github.com/users/MycroftAI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MycroftAI/subscriptions","organizations_url":"https://api.github.com/users/MycroftAI/orgs","repos_url":"https://api.github.com/users/MycroftAI/repos","events_url":"https://api.github.com/users/MycroftAI/events{/privacy}","received_events_url":"https://api.github.com/users/MycroftAI/received_events","type":"Organization","site_admin":false},"repo":{"id":59299524,"name":"mycroft-core","full_name":"MycroftAI/mycroft-core","owner":{"login":"MycroftAI","id":14171097,"avatar_url":"https://avatars.githubusercontent.com/u/14171097?v=3","gravatar_id":"","url":"https://api.github.com/users/MycroftAI","html_url":"https://github.com/MycroftAI","followers_url":"https://api.github.com/users/MycroftAI/followers","following_url":"https://api.github.com/users/MycroftAI/following{/other_user}","gists_url":"https://api.github.com/users/MycroftAI/gists{/gist_id}","starred_url":"https://api.github.com/users/MycroftAI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MycroftAI/subscriptions","organizations_url":"https://api.github.com/users/MycroftAI/orgs","repos_url":"https://api.github.com/users/MycroftAI/repos","events_url":"https://api.github.com/users/MycroftAI/events{/privacy}","received_events_url":"https://api.github.com/users/MycroftAI/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MycroftAI/mycroft-core","description":"Mycroft Core, the Mycroft Artificial Intelligence platform.","fork":false,"url":"https://api.github.com/repos/MycroftAI/mycroft-core","forks_url":"https://api.github.com/repos/MycroftAI/mycroft-core/forks","keys_url":"https://api.github.com/repos/MycroftAI/mycroft-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MycroftAI/mycroft-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MycroftAI/mycroft-core/teams","hooks_url":"https://api.github.com/repos/MycroftAI/mycroft-core/hooks","issue_events_url":"https://api.github.com/repos/MycroftAI/mycroft-core/issues/events{/number}","events_url":"https://api.github.com/repos/MycroftAI/mycroft-core/events","assignees_url":"https://api.github.com/repos/MycroftAI/mycroft-core/assignees{/user}","branches_url":"https://api.github.com/repos/MycroftAI/mycroft-core/branches{/branch}","tags_url":"https://api.github.com/repos/MycroftAI/mycroft-core/tags","blobs_url":"https://api.github.com/repos/MycroftAI/mycroft-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MycroftAI/mycroft-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MycroftAI/mycroft-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/MycroftAI/mycroft-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MycroftAI/mycroft-core/statuses/{sha}","languages_url":"https://api.github.com/repos/MycroftAI/mycroft-core/languages","stargazers_url":"https://api.github.com/repos/MycroftAI/mycroft-core/stargazers","contributors_url":"https://api.github.com/repos/MycroftAI/mycroft-core/contributors","subscribers_url":"https://api.github.com/repos/MycroftAI/mycroft-core/subscribers","subscription_url":"https://api.github.com/repos/MycroftAI/mycroft-core/subscription","commits_url":"https://api.github.com/repos/MycroftAI/mycroft-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/MycroftAI/mycroft-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/MycroftAI/mycroft-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/MycroftAI/mycroft-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/MycroftAI/mycroft-core/contents/{+path}","compare_url":"https://api.github.com/repos/MycroftAI/mycroft-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MycroftAI/mycroft-core/merges","archive_url":"https://api.github.com/repos/MycroftAI/mycroft-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MycroftAI/mycroft-core/downloads","issues_url":"https://api.github.com/repos/MycroftAI/mycroft-core/issues{/number}","pulls_url":"https://api.github.com/repos/MycroftAI/mycroft-core/pulls{/number}","milestones_url":"https://api.github.com/repos/MycroftAI/mycroft-core/milestones{/number}","notifications_url":"https://api.github.com/repos/MycroftAI/mycroft-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MycroftAI/mycroft-core/labels{/name}","releases_url":"https://api.github.com/repos/MycroftAI/mycroft-core/releases{/id}","deployments_url":"https://api.github.com/repos/MycroftAI/mycroft-core/deployments","created_at":"2016-05-20T14:11:07Z","updated_at":"2016-06-24T15:52:47Z","pushed_at":"2016-06-24T21:20:09Z","git_url":"git://github.com/MycroftAI/mycroft-core.git","ssh_url":"git@github.com:MycroftAI/mycroft-core.git","clone_url":"https://github.com/MycroftAI/mycroft-core.git","svn_url":"https://github.com/MycroftAI/mycroft-core","homepage":"https://mycroft.ai","size":75934,"stargazers_count":232,"watchers_count":232,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":48,"mirror_url":null,"open_issues_count":40,"forks":48,"open_issues":40,"watchers":232,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MycroftAI/mycroft-core/pulls/222"},"html":{"href":"https://github.com/MycroftAI/mycroft-core/pull/222"},"issue":{"href":"https://api.github.com/repos/MycroftAI/mycroft-core/issues/222"},"comments":{"href":"https://api.github.com/repos/MycroftAI/mycroft-core/issues/222/comments"},"review_comments":{"href":"https://api.github.com/repos/MycroftAI/mycroft-core/pulls/222/comments"},"review_comment":{"href":"https://api.github.com/repos/MycroftAI/mycroft-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MycroftAI/mycroft-core/pulls/222/commits"},"statuses":{"href":"https://api.github.com/repos/MycroftAI/mycroft-core/statuses/e5a7d80623cc8e5ea298f9bd246038627a45fb33"}}}}
{"actor":{"display_login":"jdorleans"}}