[Pyrefly][Refactor] Replace dict() calls with literal dict syntax for improved readability#157735
[Pyrefly][Refactor] Replace dict() calls with literal dict syntax for improved readability#157735migeed-z wants to merge 1 commit intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/157735
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 1 PendingAs of commit 7bc7b66 with merge base c2510fc ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
|
4cbafa3 to
7bc7b66
Compare
| ) -> str: | ||
| buffer_size = " * ".join(map(str, size_args)) | ||
| return KernelTemplate._template_from_string(self.ALLOCATE_WEIGHT_BUFFER).render( | ||
| dict( |
There was a problem hiding this comment.
If you really care about this, remove the C4 rule exception in our ruff config that allow this syntax.
There was a problem hiding this comment.
@Skylion007 thanks!
we definitely plan to support this syntax and while using the literal syntax is better, it seems too strict to ban it completely? cc @ndmitchell @ezyang
There was a problem hiding this comment.
I mean, it's mostly the pain of getting the codebase in compliance in the first place. I don't have an objection to the rule, especially since ruff can autofix it.
There was a problem hiding this comment.
Yeah, add noqas to test/ using ruff --add-noqa to keep the inductor tests for the old syntax and seems fine.
There was a problem hiding this comment.
I'm working on just editing them to the right syntax. Will see how it goes :)
|
@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 |
|
@pytorchbot label "topic: not user facing" |
There are 31 places that I spotted which construct literal dictionaries.
This PR refactors dictionary construction by replacing
dict(...)calls withliteral {...}syntax where applicable.cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @kadeng @muchulee8 @amjames @chauhang @aakhundov