@@ -0,0 +1,1376 @@
+import glob%0Aimport io%0A%0Afrom string import Template%0A%0A%0Aclass Templater(object):%0A    %22%22%22%0A    Reponsible for applying fuzz data to template file.%0A%0A    Args:%0A        config: A %60dict%60 containing the configurations.%0A    %22%22%22%0A%0A    def __init__(self, config):%0A        self._data_path = config.get('data_path')%0A        self._template_path = config.get('template_path')%0A        self._data = %5B%5D%0A        self._template = %5B%5D%0A%0A    def scan(self):%0A        %22%22%22%0A        Scan data path and template path for data files and template%0A        files respectively, and then store the file contents to relevant%0A        data store.%0A%0A        The contents are currently loaded eagerly when this method is%0A        invoked. Therefore, a large memory space may be required if%0A        there are numerous data or templates.%0A        %22%22%22%0A        for df in glob.iglob(self._data_path):%0A            with io.open(df, 'rt', encoding='utf-8') as f:%0A                self._data += f.read().splitlines()%0A%0A        for tf in glob.iglob(self._template_path):%0A            with io.open(tf, 'rt', encoding='utf-8') as f:%0A                self._template.append(f.read())%0A%0A    def render(self):%0A        %22%22%22%0A        Render data into templates.%0A%0A        This method is a generator function.%0A        %22%22%22%0A        for t in self._template:%0A            for d in self._data:%0A                yield Template(t).safe_substitute(fuzzdata=d)%0A

Implement templater component