1
+ from typing import Dict
2
+
1
3
from pybars import Compiler
2
4
from moban .externals import file_system
3
5
@@ -6,28 +8,28 @@ class EngineHandlebars(object):
6
8
ACTION_IN_PRESENT_CONTINUOUS_TENSE = "Handlebars-ing"
7
9
ACTION_IN_PAST_TENSE = "Handlebarsed"
8
10
9
- def __init__ (self , template_fs , options = None ):
11
+ def __init__ (self , template_fs , options : Dict = None ):
10
12
"""
11
13
template_fs is a multfs instance and gives you the power to load
12
14
a template from equiped template directories.
13
15
14
- :param fs.multifs.MultiFS template_fs: a MultiFS instance or a FS instance
16
+ :param fs.multifs.MultiFS template_fs: a MultiFS/ FS instance
15
17
:param options: a dictionary of potential parameters.
16
18
not used yet.
17
19
"""
18
20
self .template_fs = template_fs
19
21
20
- def get_template (self , template_file ):
22
+ def get_template (self , template_file : str ):
21
23
template_file = file_system .to_unicode (template_file )
22
24
content = self .template_fs .readtext (template_file )
23
25
hbr_template = Compiler ().compile (content )
24
26
return hbr_template
25
27
26
- def get_template_from_string (self , string ):
28
+ def get_template_from_string (self , string : str ):
27
29
string = file_system .to_unicode (string )
28
30
return Compiler ().compile (string )
29
31
30
- def apply_template (self , template , data , _ ):
32
+ def apply_template (self , template , data : Dict , _ ):
31
33
rendered_content = "" .join (template (data ))
32
34
rendered_content = rendered_content
33
35
return rendered_content
0 commit comments