mirror of
https://github.com/ansible/ansible.git
synced 2026-05-28 04:32:20 -04:00
Iterate over the file object
Since the file is being iterated over already, calling readlines() is unnecessary. It also increases memory usage by reading the file into memory and then iterating over that.
This commit is contained in:
parent
994652924f
commit
1d80283efa
1 changed files with 1 additions and 1 deletions
|
|
@ -3140,7 +3140,7 @@ class BusyBox(User):
|
|||
with open("/etc/shells", "r") as f:
|
||||
shells = [
|
||||
shell
|
||||
for shell in (line.strip() for line in f.readlines())
|
||||
for shell in (line.strip() for line in f)
|
||||
if shell
|
||||
and not shell.startswith("#")
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in a new issue