mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-03-13 18:19:47 +00:00
changed formating to match reqs.
This commit is contained in:
parent
f3bfc4f5a7
commit
0aa8e1912c
@ -48,9 +48,9 @@ def gabor_filter_kernel(
|
||||
_y = -sin_theta * px + cos_theta * py
|
||||
|
||||
# fill kernel
|
||||
gabor[y, x] = np.exp(-(_x**2 + gamma**2 * _y**2) / (2 * sigma**2)) * np.cos(
|
||||
2 * np.pi * _x / lambd + psi
|
||||
)
|
||||
gabor[y, x] = np.exp(
|
||||
-(_x**2 + gamma**2 * _y**2) / (2 * sigma**2)
|
||||
) * np.cos(2 * np.pi * _x / lambd + psi)
|
||||
|
||||
return gabor
|
||||
|
||||
|
@ -545,4 +545,5 @@ class Graph:
|
||||
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
|
||||
doctest.testmod(verbose=True)
|
||||
|
@ -39,10 +39,12 @@ def frac_knapsack(vl, wt, w, n):
|
||||
return (
|
||||
0
|
||||
if k == 0
|
||||
else sum(vl[:k]) + (w - acc[k - 1]) * (vl[k]) / (wt[k])
|
||||
else (
|
||||
sum(vl[:k]) + (w - acc[k - 1]) * (vl[k]) / (wt[k])
|
||||
if k != n
|
||||
else sum(vl[:k])
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -240,7 +240,9 @@ def ascend_tree(leaf_node: TreeNode, prefix_path: list[str]) -> None:
|
||||
ascend_tree(leaf_node.parent, prefix_path)
|
||||
|
||||
|
||||
def find_prefix_path(base_pat: frozenset, tree_node: TreeNode | None) -> dict: # noqa: ARG001
|
||||
def find_prefix_path(
|
||||
base_pat: frozenset, tree_node: TreeNode | None
|
||||
) -> dict: # noqa: ARG001
|
||||
"""
|
||||
Find the conditional pattern base for a given base pattern.
|
||||
|
||||
|
@ -204,9 +204,11 @@ class Matrix:
|
||||
return Matrix(
|
||||
[
|
||||
[
|
||||
(
|
||||
self.minors().rows[row][column]
|
||||
if (row + column) % 2 == 0
|
||||
else self.minors().rows[row][column] * -1
|
||||
)
|
||||
for column in range(self.minors().num_columns)
|
||||
]
|
||||
for row in range(self.minors().num_rows)
|
||||
|
@ -31,7 +31,9 @@ def bead_sort(sequence: list) -> list:
|
||||
if any(not isinstance(x, int) or x < 0 for x in sequence):
|
||||
raise TypeError("Sequence must be list of non-negative integers")
|
||||
for _ in range(len(sequence)):
|
||||
for i, (rod_upper, rod_lower) in enumerate(zip(sequence, sequence[1:])): # noqa: RUF007
|
||||
for i, (rod_upper, rod_lower) in enumerate(
|
||||
zip(sequence, sequence[1:])
|
||||
): # noqa: RUF007
|
||||
if rod_upper > rod_lower:
|
||||
sequence[i] -= rod_upper - rod_lower
|
||||
sequence[i + 1] += rod_upper - rod_lower
|
||||
|
@ -132,7 +132,9 @@ if __name__ == "__main__":
|
||||
elif op[0] == "R":
|
||||
string[i] = op[2]
|
||||
|
||||
file.write("%-16s" % ("Replace %c" % op[1] + " with " + str(op[2]))) # noqa: UP031
|
||||
file.write(
|
||||
"%-16s" % ("Replace %c" % op[1] + " with " + str(op[2]))
|
||||
) # noqa: UP031
|
||||
file.write("\t\t" + "".join(string))
|
||||
file.write("\r\n")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user