From 77028d98e12155e938e23d766305374f67882b0a Mon Sep 17 00:00:00 2001 From: Caohongtao Date: Fri, 2 Aug 2024 06:17:58 +0000 Subject: [PATCH] =?UTF-8?q?delete=20file.close()=20if=20used=20with=20open?= =?UTF-8?q?(=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Caohongtao --- uos-sysmig/sysmig_agent/short_task.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/uos-sysmig/sysmig_agent/short_task.py b/uos-sysmig/sysmig_agent/short_task.py index 8d1e089..dff5ae6 100644 --- a/uos-sysmig/sysmig_agent/short_task.py +++ b/uos-sysmig/sysmig_agent/short_task.py @@ -148,8 +148,6 @@ def init_remove_oldrepo(): content = fsrc.read() with open(path_file + '.disabled', 'w') as fdst: fdst.write(backup_comment + content) - fdst.close() - fsrc.close() os.remove(path_file) @@ -197,7 +195,6 @@ def initRepoFile(baseurl): repofile = os.path.join(reposdir, 'switch-to-uos.repo') with open(repofile, 'w') as f_repo: f_repo.write(repostr_uos) - f_repo.close() # 检测repo文件创建缓存 @@ -317,7 +314,6 @@ def initRepoFile_add(filename, baseurl): '\n') + '''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n''' with open(os.path.join(AGENT_DIR, filename+'.repo'), 'a') as frepo: frepo.write(repostr_uos) - frepo.close() class RepoFileAdd(object): -- Gitee