Skip to content

Commit f89734f

Browse files
authored
Apply batched suggestions from code review
Co-authored-by: Christian Clauss <cclauss@me.com>
1 parent 0c2863d commit f89734f

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎sorts/topological_sort.py‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
https://en.wikipedia.org/wiki/Topological_sorting
44
https://en.wikipedia.org/wiki/Directed_acyclic_graph
55
6-
Note: topological_sort() sorts a directed acyclic graph so topological_sort(2, 1, 3) should fail.
6+
Note: topological_sort() sorts a directed acyclic graph so topological_sort(2, 1, 3)
7+
should fail.
78
"""
89

910
# a
@@ -33,15 +34,15 @@ def topological_sort(start: str, visited: list[str], sort: list[str]) -> list[st
3334
...
3435
ValueError: visited must be a list"
3536
36-
>>> topological_sort"a", [], "c")
37+
>>> topological_sort("a", [], "c")
3738
Traceback (most recent call last):
3839
...
39-
ValueError: visited must be a list"
40+
ValueError: sort must be a list"
4041
"""
4142
if not isinstance(visited, list):
4243
raise ValueError("visited must be a list")
43-
if not isinstance(current, list):
44-
raise ValueError("current must be a list")
44+
if not isinstance(sort, list):
45+
raise ValueError("sort must be a list")
4546
current = start
4647
# add current to visited
4748
visited.append(current)

0 commit comments

Comments
 (0)