eric6/Plugins/VcsPlugins/vcsPySvn/SvnUtilities.py

changeset 7785
9978016560ec
parent 7780
41420f82c0ac
child 7836
2f0d208b8137
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnUtilities.py	Tue Oct 13 19:02:26 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnUtilities.py	Wed Oct 14 17:50:39 2020 +0200
@@ -78,9 +78,8 @@
     except OSError:
         pass
     try:
-        f = open(config, "w")
-        f.write(DefaultConfig)
-        f.close()
+        with open(config, "w") as f:
+            f.write(DefaultConfig)
     except IOError:
         pass
 
@@ -91,9 +90,8 @@
     """
     config = getConfigPath()
     try:
-        f = open(config, "r")
-        configList = f.read().splitlines()
-        f.close()
+        with open(config, "r") as f:
+            configList = f.read().splitlines()
     except IOError:
         return
     
@@ -129,8 +127,7 @@
     
     if newConfig != configList:
         try:
-            f = open(config, "w")
-            f.write("\n".join(newConfig))
-            f.close()
+            with open(config, "w") as f:
+                f.write("\n".join(newConfig))
         except IOError:
             pass

eric ide

mercurial