ruff: Fix FURB129 iterate over file object directly.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-06-30 14:30:50 -04:00 committed by Tim Abbott
parent 5af8dfda3e
commit 7b69c93c50
1 changed files with 1 additions and 1 deletions

View File

@ -98,7 +98,7 @@ def setup_shell_profile(shell_profile: str) -> None:
def write_command(command: str) -> None: def write_command(command: str) -> None:
if os.path.exists(shell_profile_path): if os.path.exists(shell_profile_path):
with open(shell_profile_path) as shell_profile_file: with open(shell_profile_path) as shell_profile_file:
lines = [line.strip() for line in shell_profile_file.readlines()] lines = [line.strip() for line in shell_profile_file]
if command not in lines: if command not in lines:
with open(shell_profile_path, "a+") as shell_profile_file: with open(shell_profile_path, "a+") as shell_profile_file:
shell_profile_file.writelines(command + "\n") shell_profile_file.writelines(command + "\n")