예제 #1
0
 def load(self):
     timestamp = None
     try:
         timestamp = resource_timestamp(self.filename)
         self.result = load_dictionary(self.filename)
     except Exception as e:
         log.debug('loading dictionary %s failed', self.filename, exc_info=True)
         self.result = DictionaryLoaderException(self.filename, e)
         self.result.timestamp = timestamp
예제 #2
0
 def load(self):
     timestamp = None
     try:
         timestamp = resource_timestamp(self.filename)
         self.result = load_dictionary(self.filename)
     except Exception as e:
         log.debug('loading dictionary %s failed', self.filename, exc_info=True)
         self.result = DictionaryLoaderException(self.filename, e)
         self.result.timestamp = timestamp
 def test_basic(self):
     d = load_dictionary(
         os.path.join(os.path.dirname(__file__), 'show_stroke.py'))
     self.assertEqual(d.readonly, True)
     self.assertEqual(d.longest_key, 2)
     with self.assertRaises(KeyError):
         d[('STR', )]
     self.assertEqual(d.get(('STR', )), None)
     self.assertEqual(d[('STR*', 'STR')], 'STR')
     self.assertEqual(d.get(('STR*', 'STR')), 'STR')
     self.assertEqual(d.reverse_lookup('STR'), ())
     self.dictionary.set_dicts([d] + self.dictionary.dicts)
     self.dictionary.set(normalize_steno('STR'), u'center')
     for steno in (
             'STR',
             'STR*',
             'STR',
             'STR',
     ):
         stroke = steno_to_stroke(steno)
         self.translator.translate(stroke)
     self.assertEqual(self.output.text, u' center STR center')
예제 #4
0
 def load(self):
     try:
         self.dictionary = load_dictionary(self.filename)
     except DictionaryLoaderException:
         self.exc_info = sys.exc_info()
예제 #5
0
 def load(self):
     try:
         self.dictionary = load_dictionary(self.filename)
         self.dictionary.set_path(self.filename)
     except DictionaryLoaderException as e:
         self.exception = e
예제 #6
0
 def load(self):
     try:
         self.dictionary = load_dictionary(self.filename)
     except DictionaryLoaderException:
         self.exc_info = sys.exc_info()
예제 #7
0
 def wrapper(bb, *args, **kwargs):
     py_dict = load_dictionary(DICTIONARIES_ROOT + '/spanish_mqd.py')
     bb.dictionary.set_dicts(bb.dictionary.dicts + [py_dict])
     fn(bb, *args, **kwargs)
예제 #8
0
 def load(self):
     try:
         self.dictionary = load_dictionary(self.filename)
         self.dictionary.set_path(self.filename)
     except DictionaryLoaderException as e:
         self.exception = e