File write style

This commit is contained in:
bashrc committed 2020-07-12 20:04:58 +00:00
1 parent e1347efb20
commit fe5e21ee7d
16 files changed
+47 -41

No files matched your search

+3 -3
View File
@@ -67,7 +67,7 @@ def removeGlobalBlock(baseDir: str,
if os.path.isfile(unblockingFilename):
if unblockHandle in open(unblockingFilename).read():
with open(unblockingFilename, 'r') as fp:
with open(unblockingFilename + '.new', 'w') as fpnew:
with open(unblockingFilename + '.new', 'w+') as fpnew:
for line in fp:
handle = line.replace('\n', '').replace('\r', '')
if unblockHandle not in line:
@@ -80,7 +80,7 @@ def removeGlobalBlock(baseDir: str,
if os.path.isfile(unblockingFilename):
if unblockHashtag + '\n' in open(unblockingFilename).read():
with open(unblockingFilename, 'r') as fp:
with open(unblockingFilename + '.new', 'w') as fpnew:
with open(unblockingFilename + '.new', 'w+') as fpnew:
for line in fp:
blockLine = \
line.replace('\n', '').replace('\r', '')
@@ -104,7 +104,7 @@ def removeBlock(baseDir: str, nickname: str, domain: str,
if os.path.isfile(unblockingFilename):
if unblockHandle in open(unblockingFilename).read():
with open(unblockingFilename, 'r') as fp:
with open(unblockingFilename + '.new', 'w') as fpnew:
with open(unblockingFilename + '.new', 'w+') as fpnew:
for line in fp:
handle = line.replace('\n', '').replace('\r', '')
if unblockHandle not in line: