From 5ac2606f32bc17cd3d7e87183ce3f6325351eafb Mon Sep 17 00:00:00 2001 From: Rohan Anand <96521078+rohan472000@users.noreply.github.com> Date: Sat, 22 Apr 2023 20:48:35 +0530 Subject: [PATCH 01/15] Update rsa_cipher.py by replacing %s with {} --- ciphers/rsa_cipher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ciphers/rsa_cipher.py b/ciphers/rsa_cipher.py index de26992f5eeb..0e3df87cb891 100644 --- a/ciphers/rsa_cipher.py +++ b/ciphers/rsa_cipher.py @@ -76,7 +76,7 @@ def encrypt_and_write_to_file( key_size, n, e = read_key_file(key_filename) if key_size < block_size * 8: sys.exit( - "ERROR: Block size is %s bits and key size is %s bits. The RSA cipher " + "ERROR: Block size is {} bits and key size is {} bits. The RSA cipher " "requires the block size to be equal to or greater than the key size. " "Either decrease the block size or use different keys." % (block_size * 8, key_size) @@ -101,7 +101,7 @@ def read_from_file_and_decrypt(message_filename: str, key_filename: str) -> str: if key_size < block_size * 8: sys.exit( - "ERROR: Block size is %s bits and key size is %s bits. The RSA cipher " + "ERROR: Block size is {} bits and key size is {} bits. The RSA cipher " "requires the block size to be equal to or greater than the key size. " "Did you specify the correct key file and encrypted file?" % (block_size * 8, key_size) From de1e7bb7fc7512704e9b5ef68942d374be758b8e Mon Sep 17 00:00:00 2001 From: Rohan Anand <96521078+rohan472000@users.noreply.github.com> Date: Sat, 22 Apr 2023 20:51:27 +0530 Subject: [PATCH 02/15] Update rsa_cipher.py --- ciphers/rsa_cipher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ciphers/rsa_cipher.py b/ciphers/rsa_cipher.py index 0e3df87cb891..aa59630b5645 100644 --- a/ciphers/rsa_cipher.py +++ b/ciphers/rsa_cipher.py @@ -79,7 +79,7 @@ def encrypt_and_write_to_file( "ERROR: Block size is {} bits and key size is {} bits. The RSA cipher " "requires the block size to be equal to or greater than the key size. " "Either decrease the block size or use different keys." - % (block_size * 8, key_size) + .format(block_size * 8, key_size) ) encrypted_blocks = [str(i) for i in encrypt_message(message, (n, e), block_size)] @@ -104,7 +104,7 @@ def read_from_file_and_decrypt(message_filename: str, key_filename: str) -> str: "ERROR: Block size is {} bits and key size is {} bits. The RSA cipher " "requires the block size to be equal to or greater than the key size. " "Did you specify the correct key file and encrypted file?" - % (block_size * 8, key_size) + .format(block_size * 8, key_size) ) encrypted_blocks = [] From 6e7e14846ba741cc79dfbc1b915abb308a0bd8c9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 22 Apr 2023 15:21:57 +0000 Subject: [PATCH 03/15] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- ciphers/rsa_cipher.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ciphers/rsa_cipher.py b/ciphers/rsa_cipher.py index aa59630b5645..9c41cdc5d472 100644 --- a/ciphers/rsa_cipher.py +++ b/ciphers/rsa_cipher.py @@ -78,8 +78,9 @@ def encrypt_and_write_to_file( sys.exit( "ERROR: Block size is {} bits and key size is {} bits. The RSA cipher " "requires the block size to be equal to or greater than the key size. " - "Either decrease the block size or use different keys." - .format(block_size * 8, key_size) + "Either decrease the block size or use different keys.".format( + block_size * 8, key_size + ) ) encrypted_blocks = [str(i) for i in encrypt_message(message, (n, e), block_size)] @@ -103,8 +104,9 @@ def read_from_file_and_decrypt(message_filename: str, key_filename: str) -> str: sys.exit( "ERROR: Block size is {} bits and key size is {} bits. The RSA cipher " "requires the block size to be equal to or greater than the key size. " - "Did you specify the correct key file and encrypted file?" - .format(block_size * 8, key_size) + "Did you specify the correct key file and encrypted file?".format( + block_size * 8, key_size + ) ) encrypted_blocks = [] From f95b4565d66827d82f6cd3ca7547a6cda4a0bd4c Mon Sep 17 00:00:00 2001 From: Rohan Anand <96521078+rohan472000@users.noreply.github.com> Date: Sat, 22 Apr 2023 20:58:07 +0530 Subject: [PATCH 04/15] Update linear_discriminant_analysis.py --- machine_learning/linear_discriminant_analysis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/machine_learning/linear_discriminant_analysis.py b/machine_learning/linear_discriminant_analysis.py index f4fb5ba76b64..1a5d15dca284 100644 --- a/machine_learning/linear_discriminant_analysis.py +++ b/machine_learning/linear_discriminant_analysis.py @@ -399,7 +399,7 @@ def main(): if input("Press any key to restart or 'q' for quit: ").strip().lower() == "q": print("\n" + "GoodBye!".center(100, "-") + "\n") break - system("cls" if name == "nt" else "clear") + system('clear' if os.name == 'posix' else 'cls') if __name__ == "__main__": From 9285fdfe9407d7becf64899b77216a6c247757d5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 22 Apr 2023 15:29:43 +0000 Subject: [PATCH 05/15] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- machine_learning/linear_discriminant_analysis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/machine_learning/linear_discriminant_analysis.py b/machine_learning/linear_discriminant_analysis.py index 1a5d15dca284..45da556701a3 100644 --- a/machine_learning/linear_discriminant_analysis.py +++ b/machine_learning/linear_discriminant_analysis.py @@ -399,7 +399,7 @@ def main(): if input("Press any key to restart or 'q' for quit: ").strip().lower() == "q": print("\n" + "GoodBye!".center(100, "-") + "\n") break - system('clear' if os.name == 'posix' else 'cls') + system("clear" if os.name == "posix" else "cls") if __name__ == "__main__": From 7c7c10c45f7fcfb36837a97f87d53d9a483cfa4b Mon Sep 17 00:00:00 2001 From: Rohan Anand <96521078+rohan472000@users.noreply.github.com> Date: Sat, 22 Apr 2023 21:00:37 +0530 Subject: [PATCH 06/15] Update linear_discriminant_analysis.py --- machine_learning/linear_discriminant_analysis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/machine_learning/linear_discriminant_analysis.py b/machine_learning/linear_discriminant_analysis.py index 45da556701a3..4d65f1aa5336 100644 --- a/machine_learning/linear_discriminant_analysis.py +++ b/machine_learning/linear_discriminant_analysis.py @@ -399,7 +399,7 @@ def main(): if input("Press any key to restart or 'q' for quit: ").strip().lower() == "q": print("\n" + "GoodBye!".center(100, "-") + "\n") break - system("clear" if os.name == "posix" else "cls") + system("clear" if name == "posix" else "cls") if __name__ == "__main__": From 61cb12d5ca57e2556a57e7307505c3681cc5d44a Mon Sep 17 00:00:00 2001 From: Rohan Anand <96521078+rohan472000@users.noreply.github.com> Date: Sat, 22 Apr 2023 23:41:28 +0530 Subject: [PATCH 07/15] Update linear_discriminant_analysis.py --- machine_learning/linear_discriminant_analysis.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/machine_learning/linear_discriminant_analysis.py b/machine_learning/linear_discriminant_analysis.py index 4d65f1aa5336..5a0c9a7423bd 100644 --- a/machine_learning/linear_discriminant_analysis.py +++ b/machine_learning/linear_discriminant_analysis.py @@ -47,6 +47,7 @@ from os import name, system from random import gauss, seed from typing import TypeVar +import subprocess # Make a training dataset drawn from a gaussian distribution @@ -399,7 +400,11 @@ def main(): if input("Press any key to restart or 'q' for quit: ").strip().lower() == "q": print("\n" + "GoodBye!".center(100, "-") + "\n") break - system("clear" if name == "posix" else "cls") + if name == "nt": + subprocess.call("cls") + else: + subprocess.call("clear") + if __name__ == "__main__": From e5f50e47bf6a7ed9da54eb399277b3edeab3dce2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 22 Apr 2023 18:11:57 +0000 Subject: [PATCH 08/15] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- machine_learning/linear_discriminant_analysis.py | 1 - 1 file changed, 1 deletion(-) diff --git a/machine_learning/linear_discriminant_analysis.py b/machine_learning/linear_discriminant_analysis.py index 5a0c9a7423bd..b36c7982541b 100644 --- a/machine_learning/linear_discriminant_analysis.py +++ b/machine_learning/linear_discriminant_analysis.py @@ -406,6 +406,5 @@ def main(): subprocess.call("clear") - if __name__ == "__main__": main() From e40f99b4e35d351be114192e1200505775d3c750 Mon Sep 17 00:00:00 2001 From: Rohan Anand <96521078+rohan472000@users.noreply.github.com> Date: Sat, 22 Apr 2023 23:46:27 +0530 Subject: [PATCH 09/15] Update linear_discriminant_analysis.py --- machine_learning/linear_discriminant_analysis.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/machine_learning/linear_discriminant_analysis.py b/machine_learning/linear_discriminant_analysis.py index b36c7982541b..4d65f1aa5336 100644 --- a/machine_learning/linear_discriminant_analysis.py +++ b/machine_learning/linear_discriminant_analysis.py @@ -47,7 +47,6 @@ from os import name, system from random import gauss, seed from typing import TypeVar -import subprocess # Make a training dataset drawn from a gaussian distribution @@ -400,10 +399,7 @@ def main(): if input("Press any key to restart or 'q' for quit: ").strip().lower() == "q": print("\n" + "GoodBye!".center(100, "-") + "\n") break - if name == "nt": - subprocess.call("cls") - else: - subprocess.call("clear") + system("clear" if name == "posix" else "cls") if __name__ == "__main__": From 46a83c1f4759c8a0c59de90846b7c348e74e6513 Mon Sep 17 00:00:00 2001 From: Rohan Anand <96521078+rohan472000@users.noreply.github.com> Date: Sun, 23 Apr 2023 23:28:41 +0530 Subject: [PATCH 10/15] Update linear_discriminant_analysis.py --- machine_learning/linear_discriminant_analysis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/machine_learning/linear_discriminant_analysis.py b/machine_learning/linear_discriminant_analysis.py index 4d65f1aa5336..b5b813457cee 100644 --- a/machine_learning/linear_discriminant_analysis.py +++ b/machine_learning/linear_discriminant_analysis.py @@ -399,7 +399,7 @@ def main(): if input("Press any key to restart or 'q' for quit: ").strip().lower() == "q": print("\n" + "GoodBye!".center(100, "-") + "\n") break - system("clear" if name == "posix" else "cls") + #system("clear" if name == "posix" else "cls") if __name__ == "__main__": From 059456d27e1f613d7196dacae7fe9a4a8b37223c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 23 Apr 2023 17:59:12 +0000 Subject: [PATCH 11/15] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- machine_learning/linear_discriminant_analysis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/machine_learning/linear_discriminant_analysis.py b/machine_learning/linear_discriminant_analysis.py index b5b813457cee..ce0b2ea28a8b 100644 --- a/machine_learning/linear_discriminant_analysis.py +++ b/machine_learning/linear_discriminant_analysis.py @@ -399,7 +399,7 @@ def main(): if input("Press any key to restart or 'q' for quit: ").strip().lower() == "q": print("\n" + "GoodBye!".center(100, "-") + "\n") break - #system("clear" if name == "posix" else "cls") + # system("clear" if name == "posix" else "cls") if __name__ == "__main__": From 566735c3e2faeef5461959a1805cc4a9e71d1df4 Mon Sep 17 00:00:00 2001 From: Rohan Anand <96521078+rohan472000@users.noreply.github.com> Date: Sun, 23 Apr 2023 23:30:12 +0530 Subject: [PATCH 12/15] Update linear_discriminant_analysis.py --- machine_learning/linear_discriminant_analysis.py | 1 - 1 file changed, 1 deletion(-) diff --git a/machine_learning/linear_discriminant_analysis.py b/machine_learning/linear_discriminant_analysis.py index ce0b2ea28a8b..b0ece521ecb9 100644 --- a/machine_learning/linear_discriminant_analysis.py +++ b/machine_learning/linear_discriminant_analysis.py @@ -44,7 +44,6 @@ """ from collections.abc import Callable from math import log -from os import name, system from random import gauss, seed from typing import TypeVar From 5f17c857def13ec043d330d21a9df6010b7cd0d4 Mon Sep 17 00:00:00 2001 From: Rohan Anand <96521078+rohan472000@users.noreply.github.com> Date: Mon, 24 Apr 2023 10:42:04 +0530 Subject: [PATCH 13/15] Update machine_learning/linear_discriminant_analysis.py Co-authored-by: Christian Clauss --- machine_learning/linear_discriminant_analysis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/machine_learning/linear_discriminant_analysis.py b/machine_learning/linear_discriminant_analysis.py index b0ece521ecb9..5469c6decc9d 100644 --- a/machine_learning/linear_discriminant_analysis.py +++ b/machine_learning/linear_discriminant_analysis.py @@ -398,7 +398,7 @@ def main(): if input("Press any key to restart or 'q' for quit: ").strip().lower() == "q": print("\n" + "GoodBye!".center(100, "-") + "\n") break - # system("clear" if name == "posix" else "cls") + system("clear" if name == "posix" else "cls") # noqa: S605 if __name__ == "__main__": From 23dd5673a6edfd55b79f65cc68051cf065e66eee Mon Sep 17 00:00:00 2001 From: Rohan Anand <96521078+rohan472000@users.noreply.github.com> Date: Mon, 24 Apr 2023 10:43:52 +0530 Subject: [PATCH 14/15] Update linear_discriminant_analysis.py --- machine_learning/linear_discriminant_analysis.py | 1 + 1 file changed, 1 insertion(+) diff --git a/machine_learning/linear_discriminant_analysis.py b/machine_learning/linear_discriminant_analysis.py index 5469c6decc9d..89d0403f5a4a 100644 --- a/machine_learning/linear_discriminant_analysis.py +++ b/machine_learning/linear_discriminant_analysis.py @@ -46,6 +46,7 @@ from math import log from random import gauss, seed from typing import TypeVar +from os import name, system # Make a training dataset drawn from a gaussian distribution From 751b19a4804332c1e3577129c044ea977865d339 Mon Sep 17 00:00:00 2001 From: rohan472000 Date: Mon, 24 Apr 2023 10:47:55 +0530 Subject: [PATCH 15/15] updated --- machine_learning/linear_discriminant_analysis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/machine_learning/linear_discriminant_analysis.py b/machine_learning/linear_discriminant_analysis.py index 89d0403f5a4a..c0a477be10c7 100644 --- a/machine_learning/linear_discriminant_analysis.py +++ b/machine_learning/linear_discriminant_analysis.py @@ -44,9 +44,9 @@ """ from collections.abc import Callable from math import log +from os import name, system from random import gauss, seed from typing import TypeVar -from os import name, system # Make a training dataset drawn from a gaussian distribution