From 2643caadf89366136fb5f7ea78f385f6f6790a5b Mon Sep 17 00:00:00 2001 From: Kris Gesling Date: Tue, 18 Aug 2020 22:56:34 +0930 Subject: [PATCH] remove previously deprecated DialogLoader class --- mycroft/dialog/__init__.py | 3 +-- mycroft/dialog/dialog.py | 22 ---------------------- test/unittests/dialog/test_dialog.py | 8 +++----- 3 files changed, 4 insertions(+), 29 deletions(-) diff --git a/mycroft/dialog/__init__.py b/mycroft/dialog/__init__.py index cd15a83b4f34..460c802e9e13 100644 --- a/mycroft/dialog/__init__.py +++ b/mycroft/dialog/__init__.py @@ -14,5 +14,4 @@ # """Provides utilities for rendering dialogs and populating with custom data.""" -from .dialog import (MustacheDialogRenderer, DialogLoader, - load_dialogs, get) +from .dialog import (MustacheDialogRenderer, load_dialogs, get) diff --git a/mycroft/dialog/dialog.py b/mycroft/dialog/dialog.py index c0332dd662d0..e10925678096 100644 --- a/mycroft/dialog/dialog.py +++ b/mycroft/dialog/dialog.py @@ -120,28 +120,6 @@ def render(self, template_name, context=None, index=None): return line -class DialogLoader: - """Loads a collection of dialog files into a renderer implementation. - - TODO: Remove in 20.02 - """ - - def __init__(self, renderer_factory=MustacheDialogRenderer): - LOG.warning('Deprecated, use load_dialogs() instead.') - self.__renderer = renderer_factory() - - def load(self, dialog_dir): - """Load all dialog files within the specified directory. - - Args: - dialog_dir (str): directory that contains dialog files - - Returns: - a loaded instance of a dialog renderer - """ - return load_dialogs(dialog_dir, self.__renderer) - - def load_dialogs(dialog_dir, renderer=None): """Load all dialog files within the specified directory. diff --git a/test/unittests/dialog/test_dialog.py b/test/unittests/dialog/test_dialog.py index 3a1aa98cf3e1..0c3b11447e5d 100644 --- a/test/unittests/dialog/test_dialog.py +++ b/test/unittests/dialog/test_dialog.py @@ -17,7 +17,7 @@ import pathlib import json -from mycroft.dialog import MustacheDialogRenderer, DialogLoader, get +from mycroft.dialog import MustacheDialogRenderer, load_dialogs, get from mycroft.util import resolve_resource_file @@ -90,15 +90,13 @@ def test_comment_dialog(self): def test_dialog_loader(self): template_path = self.topdir.joinpath('./multiple_dialogs') - loader = DialogLoader() - renderer = loader.load(template_path) + renderer = load_dialogs(template_path) self.assertEqual(renderer.render('one'), 'ONE') self.assertEqual(renderer.render('two'), 'TWO') def test_dialog_loader_missing(self): template_path = self.topdir.joinpath('./missing_dialogs') - loader = DialogLoader() - renderer = loader.load(template_path) + renderer = load_dialogs(template_path) self.assertEqual(renderer.render('test'), 'test') def test_get(self):