コード例 #1
0
 def test_replace_action(self):
     s = Sarcasm()
     a = [
         _Action(text="previous text"),
         _Action(prev_replace="previous text", text="new text")
     ]
     s.process_actions(a)
     self.assertTrue(a[0].text.endswith(a[1].prev_replace))
コード例 #2
0
    def test_retro_sarcasm(self):
        action = _Action(word="fancy", text="fancy")
        retroed = fancytext_retro(FakeContext([action]), "1:sarcasm")

        self.assertEqual(retroed.prev_replace, "fancy")
        self.assertEqual(retroed.text, "fANcY")
        self.assertIsNone(retroed.word)
        self.assertTrue(retroed.prev_attach)
コード例 #3
0
def action(**kwargs):
    # Support using something like `text_and_word='stuff'`
    # as a shortcut for `text='stuff', word='stuff'`.
    for k, v in list(kwargs.items()):
        if '_and_' in k:
            del kwargs[k]
            for k in k.split('_and_'):
                kwargs[k] = v
    return formatting._Action(**kwargs)
コード例 #4
0
ファイル: test_formatting.py プロジェクト: ohAitch/plover
def action(**kwargs):
    # Suport using something like `text_and_word='stuff'`
    # as a shortcut for `text='stuff', word='stuff'`.
    for k, v in list(kwargs.items()):
        if '_and_' in k:
            del kwargs[k]
            for k in k.split('_and_'):
                kwargs[k] = v
    return formatting._Action(**kwargs)
コード例 #5
0
ファイル: engine.py プロジェクト: KarlHegbloom/ibus-plover
 def reset(self, full=False, output=True):
     self._log.debug('reset steno state (full=%s)' % full)
     state = _State()
     state.tail = self._translator.get_state().last()
     if full or state.tail is None:
         state.tail = Translation([Stroke('*')], None)
         state.tail.formatting = [_Action(attach=True)]
     self._translator.set_state(state)
     if output:
         self._output.reset()
コード例 #6
0
ファイル: test_formatting.py プロジェクト: benreynwar/plover
def action(**kwargs):
    return formatting._Action(**kwargs)
コード例 #7
0
 def _get_orthography_thing(self):
     return [
         _Action(text="the", word="the"),
         _Action(text="ing", word="thing", prev_replace="e")
     ]
コード例 #8
0
 def _get_action_return(self, str):
     return [_Action(text=str, word=str), _Action(combo="Return")]