def _inject(self, dest_path):
        new_data = ''
        write_it = False

        f = open(dest_path, 'r')
        line_num = 0
        for line in f.readlines():
            line_num = line_num + 1
            # only one injection per line is allowed
            for inj,inj_data in self.config['injections'].items():
                pattern = '(.*)\%sboss.mark\:%s\%s(.*)' % (
                    self.config['start_delimiter'],
                    inj,
                    self.config['end_delimiter'],
                    )
                m = re.match(pattern, line)
                if m:
                    print("Injecting %s into %s at line #%s" % \
                         (inj, dest_path, line_num))
                    line = line + "%s\n" % self._sub(inj_data)
                    write_it = True
                    break

            new_data = new_data + line
        f.close()

        if write_it:
            fs.backup(dest_path, suffix='.boss.bak')
            self._write_file(dest_path, new_data, overwrite=True)
dataset/ETHPy150Open datafolklabs/boss/boss/cli/template.py/TemplateManager._inject/original