Skip to content

Commit 2d3d660

Browse files
itsvinayakgithub-actions
and
github-actions
authored
black fixes and Travis CI fixes (TheAlgorithms#2160)
* black format * updating DIRECTORY.md * fixes * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
1 parent c534e77 commit 2d3d660

File tree

7 files changed

+13
-45
lines changed

7 files changed

+13
-45
lines changed

DIRECTORY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@
205205
* [Max Non Adjacent Sum](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/max_non_adjacent_sum.py)
206206
* [Max Sub Array](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/max_sub_array.py)
207207
* [Max Sum Contiguous Subsequence](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/max_sum_contiguous_subsequence.py)
208+
* [Minimum Cost Path](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/minimum_cost_path.py)
208209
* [Minimum Partition](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/minimum_partition.py)
209210
* [Optimal Binary Search Tree](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/optimal_binary_search_tree.py)
210211
* [Rod Cutting](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/rod_cutting.py)
@@ -230,11 +231,11 @@
230231
* [Articulation Points](https://github.com/TheAlgorithms/Python/blob/master/graphs/articulation_points.py)
231232
* [Basic Graphs](https://github.com/TheAlgorithms/Python/blob/master/graphs/basic_graphs.py)
232233
* [Bellman Ford](https://github.com/TheAlgorithms/Python/blob/master/graphs/bellman_ford.py)
233-
* [Bfs](https://github.com/TheAlgorithms/Python/blob/master/graphs/bfs.py)
234234
* [Bfs Shortest Path](https://github.com/TheAlgorithms/Python/blob/master/graphs/bfs_shortest_path.py)
235235
* [Bidirectional A Star](https://github.com/TheAlgorithms/Python/blob/master/graphs/bidirectional_a_star.py)
236236
* [Bidirectional Breadth First Search](https://github.com/TheAlgorithms/Python/blob/master/graphs/bidirectional_breadth_first_search.py)
237237
* [Breadth First Search](https://github.com/TheAlgorithms/Python/blob/master/graphs/breadth_first_search.py)
238+
* [Breadth First Search 2](https://github.com/TheAlgorithms/Python/blob/master/graphs/breadth_first_search_2.py)
238239
* [Breadth First Search Shortest Path](https://github.com/TheAlgorithms/Python/blob/master/graphs/breadth_first_search_shortest_path.py)
239240
* [Check Bipartite Graph Bfs](https://github.com/TheAlgorithms/Python/blob/master/graphs/check_bipartite_graph_bfs.py)
240241
* [Check Bipartite Graph Dfs](https://github.com/TheAlgorithms/Python/blob/master/graphs/check_bipartite_graph_dfs.py)

ciphers/affine_cipher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,4 @@ def get_random_key():
102102
import doctest
103103

104104
doctest.testmod()
105-
main()
105+
# main()

dynamic_programming/minimum_cost_path.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
def minimum_cost_path(matrix: List[List[int]]) -> int:
7-
'''
7+
"""
88
Find the minimum cost traced by all possible paths from top left to bottom right in
99
a given matrix
1010
@@ -13,7 +13,7 @@ def minimum_cost_path(matrix: List[List[int]]) -> int:
1313
1414
>>> minimum_cost_path([[2, 1, 4], [2, 1, 3], [3, 2, 1]])
1515
7
16-
'''
16+
"""
1717

1818
# preprocessing the first row
1919
for i in range(1, len(matrix[0])):

graphs/connected_components.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,9 @@
55
66
"""
77

8-
test_graph_1 = {
9-
0: [1, 2],
10-
1: [0, 3],
11-
2: [0],
12-
3: [1],
13-
4: [5, 6],
14-
5: [4, 6],
15-
6: [4, 5],
16-
}
17-
18-
test_graph_2 = {
19-
0: [1, 2, 3],
20-
1: [0, 3],
21-
2: [0],
22-
3: [0, 1],
23-
4: [],
24-
5: [],
25-
}
8+
test_graph_1 = {0: [1, 2], 1: [0, 3], 2: [0], 3: [1], 4: [5, 6], 5: [4, 6], 6: [4, 5]}
9+
10+
test_graph_2 = {0: [1, 2, 3], 1: [0, 3], 2: [0], 3: [0, 1], 4: [], 5: []}
2611

2712

2813
def dfs(graph: dict, vert: int, visited: list) -> list:

graphs/strongly_connected_components.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,9 @@
55
66
"""
77

8-
test_graph_1 = {
9-
0: [2, 3],
10-
1: [0],
11-
2: [1],
12-
3: [4],
13-
4: [],
14-
}
15-
16-
test_graph_2 = {
17-
0: [1, 2, 3],
18-
1: [2],
19-
2: [0],
20-
3: [4],
21-
4: [5],
22-
5: [3],
23-
}
8+
test_graph_1 = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []}
9+
10+
test_graph_2 = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]}
2411

2512

2613
def topology_sort(graph: dict, vert: int, visited: list) -> list:

greedy_method/test_knapsack.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ def test_negative_profit_value(self):
3535
# profit = [10, -20, 30, 40, 50, 60]
3636
# weight = [2, 4, 6, 8, 10, 12]
3737
# max_weight = 15
38-
self.assertRaisesRegex(
39-
ValueError, "Weight can not be negative.",
40-
)
38+
self.assertRaisesRegex(ValueError, "Weight can not be negative.")
4139

4240
def test_negative_weight_value(self):
4341
"""

machine_learning/word_frequency_functions.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,7 @@ def document_frequency(term: str, corpus: str) -> int:
8080
) # strip all punctuation and replace it with ''
8181
docs = corpus_without_punctuation.split("\n")
8282
term = term.lower()
83-
return (
84-
len([doc for doc in docs if term in doc]),
85-
len(docs),
86-
)
83+
return (len([doc for doc in docs if term in doc]), len(docs))
8784

8885

8986
def inverse_document_frequency(df: int, N: int) -> float:

0 commit comments

Comments
 (0)