simplify (for line in f.readlines() -> for line in f)

This commit is contained in:
meejah 2020-05-06 15:15:19 -06:00
parent 6eade15b4e
commit 1549e7eb18
4 changed files with 4 additions and 4 deletions

View File

@ -35,7 +35,7 @@ class Blacklist(object):
if self.last_mtime is None or current_mtime > self.last_mtime:
self.entries.clear()
with open(self.blacklist_fn, "r") as f:
for line in f.readlines():
for line in f:
line = line.strip()
if not line or line.startswith("#"):
continue

View File

@ -20,7 +20,7 @@ def get_memory_usage():
stats = {}
try:
with open("/proc/self/status", "r") as f:
for line in f.readlines():
for line in f:
name, right = line.split(":",2)
if name in stat_names:
assert right.endswith(" kB\n")

View File

@ -32,7 +32,7 @@ class AccountFileChecker(object):
self.pubkeys = {}
self.rootcaps = {}
with open(abspath_expanduser_unicode(accountfile), "r") as f:
for line in f.readlines():
for line in f:
line = line.strip()
if line.startswith("#") or not line:
continue

View File

@ -139,7 +139,7 @@ def get_aliases(nodedir):
pass
try:
with codecs.open(aliasfile, "r", "utf-8") as f:
for line in f.readlines():
for line in f:
line = line.strip()
if line.startswith("#") or not line:
continue