Ejemplo n.º 1
0
    def gen_template_moduleCase(self, file_path=None):
        """
        功能:将模板代码内容写入文件
        """
        if not file_path:
            # 初始化默认生成文件的路径
            file_path = self.default_filepath_moduleCase
            validator.check_file_isExist(file_path)

            FileHelper.create_filepath(filepath=file_path)

        with open(file_path, 'a', encoding='utf-8') as f:
            f.write(self._content_module())
Ejemplo n.º 2
0
    def gen_template_scn(self, file_path=None):
        """
        功能:将模板代码内容写入文件
        :param _content: 模板内容
        :param file: 默认路径为($PROJECT_ROOT/output/template/scn_api_device.py)
        :return:
        """
        if not file_path:
            # 初始化默认生成文件的路径
            file_path = self.default_filepath_scn
            FileHelper.delete_file(filepath=file_path)
            FileHelper.create_filepath(filepath=file_path)

        with open(file_path, 'a', encoding='utf-8') as f:
            f.write(self._content_scn())
Ejemplo n.º 3
0
    def gen_template_csv(self, file_path=None):
        """
        功能:将模板代码内容写入文件
        :param _content: 模板内容
        :param file: 默认路径为($PROJECT_ROOT/output/template/scn_api_device.py)
        :return:
        """
        if not file_path:
            # 初始化默认生成文件的路径
            file_path = self.default_filepath_csv
            validator.check_file_isExist(file_path)
            # TODO: 如果csv内容多于1行, 则不能随意删除

            FileHelper.create_filepath(filepath=file_path)

        with open(file_path, 'a', encoding='utf-8') as f:
            f.write(self._content_csv())