Get rid of unnecessary file.readline() calls.
This commit is contained in:
parent
d71618031d
commit
374b448e51
@ -82,7 +82,7 @@ class ExternalEditor(QObject):
|
||||
encoding = config.get('general', 'editor-encoding')
|
||||
try:
|
||||
with open(self._filename, 'r', encoding=encoding) as f:
|
||||
text = ''.join(f.readlines()) # pragma: no branch
|
||||
text = f.read() # pragma: no branch
|
||||
except OSError as e:
|
||||
# NOTE: Do not replace this with "raise CommandError" as it's
|
||||
# executed async.
|
||||
|
@ -213,9 +213,9 @@ class LineParser(BaseLineParser):
|
||||
"""Read the data from self._configfile."""
|
||||
with self._open('r') as f:
|
||||
if self._binary:
|
||||
self.data = [line.rstrip(b'\n') for line in f.readlines()]
|
||||
self.data = [line.rstrip(b'\n') for line in f]
|
||||
else:
|
||||
self.data = [line.rstrip('\n') for line in f.readlines()]
|
||||
self.data = [line.rstrip('\n') for line in f]
|
||||
|
||||
def save(self):
|
||||
"""Save the config file."""
|
||||
|
@ -112,7 +112,7 @@ def _release_info():
|
||||
for fn in glob.glob("/etc/*-release"):
|
||||
try:
|
||||
with open(fn, 'r', encoding='utf-8') as f:
|
||||
data.append((fn, ''.join(f.readlines()))) # pragma: no branch
|
||||
data.append((fn, f.read())) # pragma: no branch
|
||||
except OSError:
|
||||
log.misc.exception("Error while reading {}.".format(fn))
|
||||
return data
|
||||
|
Loading…
Reference in New Issue
Block a user