Skip to content

Commit 9bba42e

Browse files
authored
refactor: Indent ... for visual purposes (TheAlgorithms#7744)
1 parent e891509 commit 9bba42e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+134
-134
lines changed

arithmetic_analysis/bisection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ def bisection(function: Callable[[float], float], a: float, b: float) -> float:
88
1.0000000149011612
99
>>> bisection(lambda x: x ** 3 - 1, 2, 1000)
1010
Traceback (most recent call last):
11-
...
11+
...
1212
ValueError: could not find root in given interval.
1313
>>> bisection(lambda x: x ** 2 - 4 * x + 3, 0, 2)
1414
1.0
1515
>>> bisection(lambda x: x ** 2 - 4 * x + 3, 2, 4)
1616
3.0
1717
>>> bisection(lambda x: x ** 2 - 4 * x + 3, 4, 1000)
1818
Traceback (most recent call last):
19-
...
19+
...
2020
ValueError: could not find root in given interval.
2121
"""
2222
start: float = a

arithmetic_analysis/intersection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def intersection(function: Callable[[float], float], x0: float, x1: float) -> fl
1010
0.9999999999954654
1111
>>> intersection(lambda x: x ** 3 - 1, 5, 5)
1212
Traceback (most recent call last):
13-
...
13+
...
1414
ZeroDivisionError: float division by zero, could not find root
1515
>>> intersection(lambda x: x ** 3 - 1, 100, 200)
1616
1.0000000000003888
@@ -24,7 +24,7 @@ def intersection(function: Callable[[float], float], x0: float, x1: float) -> fl
2424
0.0
2525
>>> intersection(math.cos, -math.pi, math.pi)
2626
Traceback (most recent call last):
27-
...
27+
...
2828
ZeroDivisionError: float division by zero, could not find root
2929
"""
3030
x_n: float = x0

arithmetic_analysis/jacobi_iteration_method.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def jacobi_iteration_method(
4242
>>> iterations = 3
4343
>>> jacobi_iteration_method(coefficient, constant, init_val, iterations)
4444
Traceback (most recent call last):
45-
...
45+
...
4646
ValueError: Coefficient matrix dimensions must be nxn but received 2x3
4747
4848
>>> coefficient = np.array([[4, 1, 1], [1, 5, 2], [1, 2, 4]])
@@ -51,7 +51,7 @@ def jacobi_iteration_method(
5151
>>> iterations = 3
5252
>>> jacobi_iteration_method(coefficient, constant, init_val, iterations)
5353
Traceback (most recent call last):
54-
...
54+
...
5555
ValueError: Coefficient and constant matrices dimensions must be nxn and nx1 but
5656
received 3x3 and 2x1
5757
@@ -61,7 +61,7 @@ def jacobi_iteration_method(
6161
>>> iterations = 3
6262
>>> jacobi_iteration_method(coefficient, constant, init_val, iterations)
6363
Traceback (most recent call last):
64-
...
64+
...
6565
ValueError: Number of initial values must be equal to number of rows in coefficient
6666
matrix but received 2 and 3
6767
@@ -71,7 +71,7 @@ def jacobi_iteration_method(
7171
>>> iterations = 0
7272
>>> jacobi_iteration_method(coefficient, constant, init_val, iterations)
7373
Traceback (most recent call last):
74-
...
74+
...
7575
ValueError: Iterations must be at least 1
7676
"""
7777

@@ -138,7 +138,7 @@ def strictly_diagonally_dominant(table: NDArray[float64]) -> bool:
138138
>>> table = np.array([[4, 1, 1, 2], [1, 5, 2, -6], [1, 2, 3, -4]])
139139
>>> strictly_diagonally_dominant(table)
140140
Traceback (most recent call last):
141-
...
141+
...
142142
ValueError: Coefficient matrix is not strictly diagonally dominant
143143
"""
144144

arithmetic_analysis/lu_decomposition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def lower_upper_decomposition(
3131
>>> matrix = np.array([[2, -2, 1], [0, 1, 2]])
3232
>>> lower_upper_decomposition(matrix)
3333
Traceback (most recent call last):
34-
...
34+
...
3535
ValueError: 'table' has to be of square shaped array but got a 2x3 array:
3636
[[ 2 -2 1]
3737
[ 0 1 2]]

arithmetic_analysis/newton_method.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def newton(
2828
1.5707963267948966
2929
>>> newton(math.cos, lambda x: -math.sin(x), 0)
3030
Traceback (most recent call last):
31-
...
31+
...
3232
ZeroDivisionError: Could not find root
3333
"""
3434
prev_guess = float(starting_int)

arithmetic_analysis/newton_raphson_new.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def newton_raphson(
3232
1.2186556186174883e-10
3333
>>> newton_raphson('cos(x)', 0)
3434
Traceback (most recent call last):
35-
...
35+
...
3636
ZeroDivisionError: Could not find root
3737
"""
3838

backtracking/knight_tour.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def open_knight_tour(n: int) -> list[list[int]]:
7878
7979
>>> open_knight_tour(2)
8080
Traceback (most recent call last):
81-
...
81+
...
8282
ValueError: Open Kight Tour cannot be performed on a board of size 2
8383
"""
8484

conversions/binary_to_decimal.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ def bin_to_decimal(bin_string: str) -> int:
1212
0
1313
>>> bin_to_decimal("a")
1414
Traceback (most recent call last):
15-
...
15+
...
1616
ValueError: Non-binary value was passed to the function
1717
>>> bin_to_decimal("")
1818
Traceback (most recent call last):
19-
...
19+
...
2020
ValueError: Empty string was passed to the function
2121
>>> bin_to_decimal("39")
2222
Traceback (most recent call last):
23-
...
23+
...
2424
ValueError: Non-binary value was passed to the function
2525
"""
2626
bin_string = str(bin_string).strip()

conversions/binary_to_hexadecimal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ def bin_to_hexadecimal(binary_str: str) -> str:
3030
'-0x1d'
3131
>>> bin_to_hexadecimal('a')
3232
Traceback (most recent call last):
33-
...
33+
...
3434
ValueError: Non-binary value was passed to the function
3535
>>> bin_to_hexadecimal('')
3636
Traceback (most recent call last):
37-
...
37+
...
3838
ValueError: Empty string was passed to the function
3939
"""
4040
# Sanitising parameter

conversions/binary_to_octal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
1010
>>> bin_to_octal("")
1111
Traceback (most recent call last):
12-
...
12+
...
1313
ValueError: Empty string was passed to the function
1414
>>> bin_to_octal("a-1")
1515
Traceback (most recent call last):
16-
...
16+
...
1717
ValueError: Non-binary value was passed to the function
1818
"""
1919

0 commit comments

Comments
 (0)