Coverage for kwai/core/template/template_engine.py: 100%

4 statements  

« prev     ^ index     » next       coverage.py v7.3.0, created at 2023-09-05 17:55 +0000

1"""Module that defines an interface for a template engine.""" 

2from abc import abstractmethod 

3 

4from .template import Template 

5 

6 

7class TemplateNotFoundException(Exception): 

8 """Raised when a template cannot be found.""" 

9 

10 

11class TemplateEngine: 

12 """Interface for a template engine.""" 

13 

14 @abstractmethod 

15 def create(self, template_file_path: str, lang: str = "nl") -> Template: 

16 """Create a template from the given file path. 

17 

18 When the template cannot be found, a TemplateNotFoundException should be raised. 

19 """ 

20 raise NotImplementedError