[BE]: Apply PERF401 autofixes from ruff#140980
[BE]: Apply PERF401 autofixes from ruff#140980Skylion007 wants to merge 4 commits intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/140980
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit a9eb0f7 with merge base e46af7d ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
793e5ea to
caa168b
Compare
6f9bc48 to
a9eb0f7
Compare
|
@pytorchbot merge |
Merge failedReason: Approvers from one of the following sets are needed:
|
malfet
left a comment
There was a problem hiding this comment.
LGTM, let's try to merge it (and hopefully no land races)
|
@pytorchbot merge |
Merge failedReason: Approvers from one of the following sets are needed:
|
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Summary: * Automatically applies ruff rule 401. Turns loops into equivalent list comprehensions which are faster and do not leak the scope of the loop variables. * list comprehensions not only often have better typing, but are 50+% faster than for loops on overhead. They also preserve length information etc and are better for the interpreter to optimize. * Manually went back and made mypy happy after the change. * Also fixed style lints in files covered by flake8 but not by pyfmt X-link: pytorch/pytorch#140980 Approved by: https://github.com/justinchuby, https://github.com/malfet Reviewed By: izaitsevfb Differential Revision: D66262948 fbshipit-source-id: 4d871761b25633da20bca8d1f37b9842144f2218
* Automatically applies ruff rule 401. Turns loops into equivalent list comprehensions which are faster and do not leak the scope of the loop variables. * list comprehensions not only often have better typing, but are 50+% faster than for loops on overhead. They also preserve length information etc and are better for the interpreter to optimize. * Manually went back and made mypy happy after the change. * Also fixed style lints in files covered by flake8 but not by pyfmt Pull Request resolved: pytorch#140980 Approved by: https://github.com/justinchuby, https://github.com/malfet
cc @H-Huang @awgu @kwen2501 @wanchaol @fegin @fduwjj @wz337 @wconstab @d4l3k @c-p-i-o @EikanWang @jgong5 @wenzhe-nrv @sanchitintel @ezyang @SherlockNoMad @voznesenskym @penguinwu @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @jiayisunx @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @ColinPeppler @amjames @desertfire @chauhang @aakhundov @LucasLLC @MeetVadakkanchery @mhorowitz @pradeepfn @xmfan