simplify (for line in f.readlines() -> for line in f)
This commit is contained in:
parent
6eade15b4e
commit
1549e7eb18
|
@ -35,7 +35,7 @@ class Blacklist(object):
|
||||||
if self.last_mtime is None or current_mtime > self.last_mtime:
|
if self.last_mtime is None or current_mtime > self.last_mtime:
|
||||||
self.entries.clear()
|
self.entries.clear()
|
||||||
with open(self.blacklist_fn, "r") as f:
|
with open(self.blacklist_fn, "r") as f:
|
||||||
for line in f.readlines():
|
for line in f:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if not line or line.startswith("#"):
|
if not line or line.startswith("#"):
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -20,7 +20,7 @@ def get_memory_usage():
|
||||||
stats = {}
|
stats = {}
|
||||||
try:
|
try:
|
||||||
with open("/proc/self/status", "r") as f:
|
with open("/proc/self/status", "r") as f:
|
||||||
for line in f.readlines():
|
for line in f:
|
||||||
name, right = line.split(":",2)
|
name, right = line.split(":",2)
|
||||||
if name in stat_names:
|
if name in stat_names:
|
||||||
assert right.endswith(" kB\n")
|
assert right.endswith(" kB\n")
|
||||||
|
|
|
@ -32,7 +32,7 @@ class AccountFileChecker(object):
|
||||||
self.pubkeys = {}
|
self.pubkeys = {}
|
||||||
self.rootcaps = {}
|
self.rootcaps = {}
|
||||||
with open(abspath_expanduser_unicode(accountfile), "r") as f:
|
with open(abspath_expanduser_unicode(accountfile), "r") as f:
|
||||||
for line in f.readlines():
|
for line in f:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if line.startswith("#") or not line:
|
if line.startswith("#") or not line:
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -139,7 +139,7 @@ def get_aliases(nodedir):
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
with codecs.open(aliasfile, "r", "utf-8") as f:
|
with codecs.open(aliasfile, "r", "utf-8") as f:
|
||||||
for line in f.readlines():
|
for line in f:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if line.startswith("#") or not line:
|
if line.startswith("#") or not line:
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue