From b8175b8302e03fb4ffc91de19921ed3930ad164d Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 20 Mar 2016 22:50:01 +0000 Subject: [PATCH 1/6] Configurable persona --- client/vocabcompiler.py | 9 +++++++++ static/keyword_phrases | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/vocabcompiler.py b/client/vocabcompiler.py index 0f8a648a5..4e48fa5d0 100644 --- a/client/vocabcompiler.py +++ b/client/vocabcompiler.py @@ -504,6 +504,15 @@ def get_keyword_phrases(): if phrase: phrases.append(phrase) + profile_path = jasperpath.config('profile.yml') + if os.path.exists(profile_path): + with open(profile_path, 'r') as f: + profile = yaml.safe_load(f) + persona = profile.get('persona', 'JASPER').upper() + else: + persona = 'JASPER' + + phrases.append(persona) return phrases diff --git a/static/keyword_phrases b/static/keyword_phrases index d118b13ac..7a66494c3 100644 --- a/static/keyword_phrases +++ b/static/keyword_phrases @@ -6,7 +6,6 @@ FIRST IN IS IT -JASPER NOW OF ON @@ -15,4 +14,4 @@ SAY WHAT WHICH WITH -WORK \ No newline at end of file +WORKs From d8ff31d796b9aaca5c23f456616bfde001661444 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 20 Mar 2016 22:54:29 +0000 Subject: [PATCH 2/6] Silly gedit putting a tab instead of 4 spaces. --- client/vocabcompiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/vocabcompiler.py b/client/vocabcompiler.py index 4e48fa5d0..ec396e0c5 100644 --- a/client/vocabcompiler.py +++ b/client/vocabcompiler.py @@ -507,7 +507,7 @@ def get_keyword_phrases(): profile_path = jasperpath.config('profile.yml') if os.path.exists(profile_path): with open(profile_path, 'r') as f: - profile = yaml.safe_load(f) + profile = yaml.safe_load(f) persona = profile.get('persona', 'JASPER').upper() else: persona = 'JASPER' From 541e7abaae6604f28cbdc437849f01dc97aeaa55 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 20 Mar 2016 22:56:49 +0000 Subject: [PATCH 3/6] This is what I get for not setting gedit to default to spaces instead of tabs. --- client/vocabcompiler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/vocabcompiler.py b/client/vocabcompiler.py index ec396e0c5..866715092 100644 --- a/client/vocabcompiler.py +++ b/client/vocabcompiler.py @@ -507,8 +507,8 @@ def get_keyword_phrases(): profile_path = jasperpath.config('profile.yml') if os.path.exists(profile_path): with open(profile_path, 'r') as f: - profile = yaml.safe_load(f) - persona = profile.get('persona', 'JASPER').upper() + profile = yaml.safe_load(f) + persona = profile.get('persona', 'JASPER').upper() else: persona = 'JASPER' From fda4e70e47bbe84fc7141ea38fd5a54059ed193b Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 20 Mar 2016 23:08:09 +0000 Subject: [PATCH 4/6] Patch unit test --- tests/test_vocabcompiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_vocabcompiler.py b/tests/test_vocabcompiler.py index 2ce977d26..c326c5695 100644 --- a/tests/test_vocabcompiler.py +++ b/tests/test_vocabcompiler.py @@ -23,7 +23,7 @@ def testPhraseExtraction(self): self.assertEqual(expected_phrases, extracted_phrases) def testKeywordPhraseExtraction(self): - expected_phrases = ['MOCK'] + expected_phrases = ['MOCK', 'JASPER']] with tempfile.TemporaryFile() as f: # We can't use mock_open here, because it doesn't seem to work From 3ef1b1e846e8a5e57fb310ce58c57974c0cad7f0 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 20 Mar 2016 23:10:34 +0000 Subject: [PATCH 5/6] Fixing the typo. --- tests/test_vocabcompiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_vocabcompiler.py b/tests/test_vocabcompiler.py index c326c5695..95d85e2d2 100644 --- a/tests/test_vocabcompiler.py +++ b/tests/test_vocabcompiler.py @@ -23,7 +23,7 @@ def testPhraseExtraction(self): self.assertEqual(expected_phrases, extracted_phrases) def testKeywordPhraseExtraction(self): - expected_phrases = ['MOCK', 'JASPER']] + expected_phrases = ['MOCK', 'JASPER'] with tempfile.TemporaryFile() as f: # We can't use mock_open here, because it doesn't seem to work From ec02fbe4a39c8c043284cf40bb4a8873f707aed3 Mon Sep 17 00:00:00 2001 From: "Alfie \"Azelphur\" Day" Date: Sat, 26 Mar 2016 22:01:28 +0000 Subject: [PATCH 6/6] Oops, additional S --- static/keyword_phrases | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/keyword_phrases b/static/keyword_phrases index 7a66494c3..d3d2f3c1a 100644 --- a/static/keyword_phrases +++ b/static/keyword_phrases @@ -14,4 +14,4 @@ SAY WHAT WHICH WITH -WORKs +WORK