mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[Codemod][FBSourceBlackLinter] Daily arc lint --take BLACK
Reviewed By: zertosh Differential Revision: D31192084 fbshipit-source-id: 25d490783b876253ddd1ad0a70832766ebd33f51
This commit is contained in:

committed by
Facebook GitHub Bot
parent
146817c9d0
commit
4fe66d962d
@ -99,10 +99,8 @@ class TestDiGraph(PackageTestCase):
|
||||
g.add_edge("2", "3")
|
||||
g.add_edge("5", "4")
|
||||
g.add_edge("4", "3")
|
||||
self.assertTrue(g.forward_transitive_closure("1") ==
|
||||
set(["1", "2", "3"]))
|
||||
self.assertTrue(g.forward_transitive_closure("4") ==
|
||||
set(["4", "3"]))
|
||||
self.assertTrue(g.forward_transitive_closure("1") == set(["1", "2", "3"]))
|
||||
self.assertTrue(g.forward_transitive_closure("4") == set(["4", "3"]))
|
||||
|
||||
def test_all_paths(self):
|
||||
g = DiGraph()
|
||||
@ -117,9 +115,15 @@ class TestDiGraph(PackageTestCase):
|
||||
result = g.all_paths("1", "3")
|
||||
# to get rid of indeterminism
|
||||
actual = set([i.strip("\n") for i in result.split(";")[2:-1]])
|
||||
expected = {'"2" -> "3"', '"1" -> "7"', '"7" -> "8"',
|
||||
'"1" -> "2"', '"8" -> "3"'}
|
||||
expected = {
|
||||
'"2" -> "3"',
|
||||
'"1" -> "7"',
|
||||
'"7" -> "8"',
|
||||
'"1" -> "2"',
|
||||
'"8" -> "3"',
|
||||
}
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_tests()
|
||||
|
@ -1,6 +1,7 @@
|
||||
from collections import deque
|
||||
from typing import Set
|
||||
|
||||
|
||||
class DiGraph:
|
||||
"""Really simple unweighted directed graph data structure to track dependencies.
|
||||
|
||||
|
@ -1036,7 +1036,6 @@ class PackageExporter:
|
||||
return self.dependency_graph.all_paths(src, dst)
|
||||
|
||||
|
||||
|
||||
# even though these are in the standard library, we do not allow them to be
|
||||
# automatically externed since they offer a lot of system level access
|
||||
_DISALLOWED_MODULES = ["sys", "io"]
|
||||
|
Reference in New Issue
Block a user