[BE][Ez]: FURB129: remove unneeded readlines() (#119796)

Applies a refurb rule to remove any readlines() in a for loop iteration as it just creates a temporary list in memory.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/119796
Approved by: https://github.com/ezyang
This commit is contained in:
Aaron Gokaslan
2024-02-13 21:21:17 +00:00
committed by PyTorch MergeBot
parent 3319dbcd23
commit f9200c8608
8 changed files with 12 additions and 12 deletions

View File

@ -39,7 +39,7 @@ Tried the following paths, but none existed:
def repair_depfile(depfile: TextIO, include_dirs: List[Path]) -> None:
changes_made = False
out = ""
for line in depfile.readlines():
for line in depfile:
if ":" in line:
colon_pos = line.rfind(":")
out += line[: colon_pos + 1]