Skip to content

Commit 02dbc72

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent c4a8dad commit 02dbc72

6 files changed

Lines changed: 28 additions & 13 deletions

File tree

ciphers/rsa_cipher.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ def main() -> None:
129129
message = input("\nEnter message: ")
130130
pubkey_filename = "rsa_pubkey.txt"
131131
print(f"Encrypting and writing to {filename}...")
132-
encrypted_text = encrypt_and_write_to_file(filename, pubkey_filename, message)
132+
encrypted_text = encrypt_and_write_to_file(
133+
filename, pubkey_filename, message
134+
)
133135

134136
print("\nEncrypted text:")
135137
print(encrypted_text)

computer_vision/mosaic_augmentation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ def update_image_and_anno(
147147
new_anno.append([bbox[0], xmin, ymin, xmax, ymax])
148148
case _: # bottom-right
149149
img = cv2.resize(
150-
img, (output_size[1] - divid_point_x, output_size[0] - divid_point_y)
150+
img,
151+
(output_size[1] - divid_point_x, output_size[0] - divid_point_y),
151152
)
152153
output_img[
153154
divid_point_y : output_size[0], divid_point_x : output_size[1], :

linear_algebra/src/lib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,8 @@ def determinant(self) -> float:
422422
)
423423
case _:
424424
cofactor_prods = [
425-
self.__matrix[0][y] * self.cofactor(0, y) for y in range(self.__width)
425+
self.__matrix[0][y] * self.cofactor(0, y)
426+
for y in range(self.__width)
426427
]
427428
return sum(cofactor_prods)
428429

maths/jaccard_similarity.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ def jaccard_similarity(
8383
return len(intersection) / (len(set_a) + len(set_b))
8484
else:
8585
# Cast set_a to list because tuples cannot be mutated
86-
union = list(set_a) + [element for element in set_b if element not in set_a]
86+
union = list(set_a) + [
87+
element for element in set_b if element not in set_a
88+
]
8789
return len(intersection) / len(union)
8890
raise ValueError(
8991
"Set a and b must either both be sets or be either a list or a tuple."

matrix/inverse_of_matrix.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,15 @@ def inverse_of_matrix(matrix: list[list[float]]) -> list[list[float]]:
8181

8282
# Calculate the inverse of the matrix
8383
return [
84-
[(float(d(n)) / determinant) or 0.0 for n in row] for row in swapped_matrix
84+
[(float(d(n)) / determinant) or 0.0 for n in row]
85+
for row in swapped_matrix
8586
]
86-
case _ if ((
87+
case _ if (
8788
len(matrix) == 3
8889
and len(matrix[0]) == 3
8990
and len(matrix[1]) == 3
9091
and len(matrix[2]) == 3
91-
)):
92+
):
9293
# Calculate the determinant of the matrix using Sarrus rule
9394
determinant = float(
9495
(
@@ -115,25 +116,29 @@ def inverse_of_matrix(matrix: list[list[float]]) -> list[list[float]]:
115116
d(matrix[1][2]) * d(matrix[2][1])
116117
)
117118
cofactor_matrix[0][1] = -(
118-
(d(matrix[1][0]) * d(matrix[2][2])) - (d(matrix[1][2]) * d(matrix[2][0]))
119+
(d(matrix[1][0]) * d(matrix[2][2]))
120+
- (d(matrix[1][2]) * d(matrix[2][0]))
119121
)
120122
cofactor_matrix[0][2] = (d(matrix[1][0]) * d(matrix[2][1])) - (
121123
d(matrix[1][1]) * d(matrix[2][0])
122124
)
123125
cofactor_matrix[1][0] = -(
124-
(d(matrix[0][1]) * d(matrix[2][2])) - (d(matrix[0][2]) * d(matrix[2][1]))
126+
(d(matrix[0][1]) * d(matrix[2][2]))
127+
- (d(matrix[0][2]) * d(matrix[2][1]))
125128
)
126129
cofactor_matrix[1][1] = (d(matrix[0][0]) * d(matrix[2][2])) - (
127130
d(matrix[0][2]) * d(matrix[2][0])
128131
)
129132
cofactor_matrix[1][2] = -(
130-
(d(matrix[0][0]) * d(matrix[2][1])) - (d(matrix[0][1]) * d(matrix[2][0]))
133+
(d(matrix[0][0]) * d(matrix[2][1]))
134+
- (d(matrix[0][1]) * d(matrix[2][0]))
131135
)
132136
cofactor_matrix[2][0] = (d(matrix[0][1]) * d(matrix[1][2])) - (
133137
d(matrix[0][2]) * d(matrix[1][1])
134138
)
135139
cofactor_matrix[2][1] = -(
136-
(d(matrix[0][0]) * d(matrix[1][2])) - (d(matrix[0][2]) * d(matrix[1][0]))
140+
(d(matrix[0][0]) * d(matrix[1][2]))
141+
- (d(matrix[0][2]) * d(matrix[1][0]))
137142
)
138143
cofactor_matrix[2][2] = (d(matrix[0][0]) * d(matrix[1][1])) - (
139144
d(matrix[0][1]) * d(matrix[1][0])

physics/first_law_of_thermodynamics.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,14 @@ def __categorize_system(argument_value: float, argument_name: str) -> None:
7373
elif argument_value > 0:
7474
print("The internal energy of the system is increasing. It heating up.")
7575
elif argument_value < 0:
76-
print("The internal energy of the system is decreasing. It cooling down.")
76+
print(
77+
"The internal energy of the system is decreasing. It cooling down."
78+
)
7779

7880
case _:
79-
raise ValueError("Should be 'work', 'heat', or 'internal_energy_variation'.")
81+
raise ValueError(
82+
"Should be 'work', 'heat', or 'internal_energy_variation'."
83+
)
8084

8185

8286
def work(heat: float, internal_energy_variation: float) -> float:

0 commit comments

Comments
 (0)