Commit Graph

6 Commits

Author SHA1 Message Date
John Reese
f625bb4bc9 [codemod][usort] apply import merging for fbcode (1 of 11) (#78973)
Summary:
Applies new import merging and sorting from µsort v1.0.

When merging imports, µsort will make a best-effort to move associated
comments to match merged elements, but there are known limitations due to
the diynamic nature of Python and developer tooling. These changes should
not produce any dangerous runtime changes, but may require touch-ups to
satisfy linters and other tooling.

Note that µsort uses case-insensitive, lexicographical sorting, which
results in a different ordering compared to isort. This provides a more
consistent sorting order, matching the case-insensitive order used when
sorting import statements by module name, and ensures that "frog", "FROG",
and "Frog" always sort next to each other.

For details on µsort's sorting and merging semantics, see the user guide:
https://usort.readthedocs.io/en/stable/guide.html#sorting

Test Plan: S271899

Reviewed By: lisroach

Differential Revision: D36402110

Pull Request resolved: https://github.com/pytorch/pytorch/pull/78973
Approved by: https://github.com/osalpekar
2022-06-06 23:44:28 +00:00
Bradley Davis
4568daf55d [torch.package] add utility for determining where bad modules may come from (#74998)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/74998

this is a cleaned-up version of a util that I commonly use to figure out where new transitive (surprise!) dependencies come from when a model breaks, since it can be difficult in large models to tell exactly what code change indirectly added the depdendency. I tried to keep the opinionated bits out of OSS as much as possible.

Reviewed By: PaliC

Differential Revision: D35265017

fbshipit-source-id: e126e03aa113db6ab79d32d86a69bcbba844875e
(cherry picked from commit ffa0f4b0a294cbcf7413b176d0d2fa0a605b3b9e)
2022-03-31 23:46:10 +00:00
CodemodService Bot
4fe66d962d [Codemod][FBSourceBlackLinter] Daily arc lint --take BLACK
Reviewed By: zertosh

Differential Revision: D31192084

fbshipit-source-id: 25d490783b876253ddd1ad0a70832766ebd33f51
2021-09-25 06:42:19 -07:00
Tugsbayasgalan (Tugsuu) Manlaibaatar
146817c9d0 Add all_paths utility function (#65602)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/65602

Test Plan: Imported from OSS

Reviewed By: suo

Differential Revision: D31163681

Pulled By: tugsbayasgalan

fbshipit-source-id: fa0b28b1d3b73efcc7671698a613e695a01cc103
2021-09-25 01:11:20 -07:00
Lily Johnson
b5f0576278 [package] Modify Digraph to track predecessors (#61146)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/61146

Track predecessors of nodes in DiGraph in order to enable cleaner dependency visualization code.

Test Plan: Imported from OSS

Reviewed By: suo

Differential Revision: D29559682

Pulled By: Lilyjjo

fbshipit-source-id: 06f51b1108423aece5bdd72a7b82ab736e5e4f94
2021-07-09 15:27:04 -07:00
Michael Suo
53c21172c0 [package] add simple graph data structure (#57337)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/57337

Add a really simple graph data sturcutre for tracking dependencies. API
based on networkx, but I didn't want to require the dependency.

Differential Revision: D28114186

Test Plan: Imported from OSS

Reviewed By: VitalyFedyunin

Pulled By: suo

fbshipit-source-id: 802fd067017e493a48d6672538080e61d249accd
2021-05-05 17:57:00 -07:00