def _get_view_file_path(self, plugin_path): plugin_path = get_parent_dir(get_dir_of_file(plugin_path)) view_files = get_files_in_dir(os.path.join(plugin_path, 'view')) if len(view_files) < 1: logging.debug('{}: No view available! Generic view will be used.'.format(self.NAME)) return None elif len(view_files) > 1: logging.warning('{}: Plug-in provides more than one view! \'{}\' is used!'.format(self.NAME, view_files[0])) return view_files[0]
def test_get_parent_dir(self): self.assertEqual(get_parent_dir('/foo/bar/test'), '/foo/bar', 'parent directory')
def load_word_list(): word_list_file = os.path.join( get_parent_dir(get_dir_of_file(__file__)), 'internal/optimized_word_list.txt') return get_string_list_from_file(word_list_file)