Use modern "with open() as file"
Saves a LOC and guarantees that the file will be closed Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
parent
de1e03b065
commit
165cf5cb4f
@ -154,9 +154,8 @@ class BaseFolder(object):
|
||||
newval = self.get_uidvalidity()
|
||||
uidfilename = self._getuidfilename()
|
||||
|
||||
file = open(uidfilename + ".tmp", "wt")
|
||||
with open(uidfilename + ".tmp", "wt") as file:
|
||||
file.write("%d\n" % newval)
|
||||
file.close()
|
||||
os.rename(uidfilename + ".tmp", uidfilename)
|
||||
self._base_saved_uidvalidity = newval
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user