From 9e06a93c19d785c967b0fb215c93ed11a2a15241 Mon Sep 17 00:00:00 2001 From: dymik739 Date: Wed, 28 Jun 2023 12:59:25 +0300 Subject: [PATCH] remove redundant method: BasicRegister.compact_str() --- bitutilities.py | 6 ------ main.py | 8 ++++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/bitutilities.py b/bitutilities.py index 4ee00d2..b74762d 100644 --- a/bitutilities.py +++ b/bitutilities.py @@ -22,9 +22,6 @@ class BasicRegister: def __len__(self) -> int: return len(self.memory) - def compact_str(self) -> str: - return "".join([str(int(value)) for value in self.memory]) - def adjusted_by_size(self, resulting_size: int) -> Self: """ Adjusts a register to a given size. @@ -93,9 +90,6 @@ class Counter: def __len__(self) -> int: return len(self.memory) - def compact_str(self) -> str: - return "".join([str(int(value)) for value in self.memory]) - def decrement(self): self.memory = binary_subtraction(self, BasicRegister([False] * (len(self.memory) - 1) + [True])).memory diff --git a/main.py b/main.py index 83ac969..ab005b9 100644 --- a/main.py +++ b/main.py @@ -19,16 +19,16 @@ def input_handler(first_register: bu.BasicRegister, second_register: bu.BasicReg match input("Choose method to use (1-4):\n>>> "): case "1": result, data_table = bu.binary_multiplication_method_1(first_register, second_register) - print(f"Multiplication:\n{bu.format_device_state_table(data_table)}\nResult: {result.compact_str()}") + print(f"Multiplication:\n{bu.format_device_state_table(data_table)}\nResult: {result}") case "2": result, data_table = bu.binary_multiplication_method_2(first_register, second_register) - print(f"Multiplication:\n{bu.format_device_state_table(data_table)}\nResult: {result.compact_str()}") + print(f"Multiplication:\n{bu.format_device_state_table(data_table)}\nResult: {result}") case "3": result, data_table = bu.binary_multiplication_method_3(first_register, second_register) - print(f"Multiplication:\n{bu.format_device_state_table(data_table)}\nResult: {result.compact_str()}") + print(f"Multiplication:\n{bu.format_device_state_table(data_table)}\nResult: {result}") case "4": result, data_table = bu.binary_multiplication_method_4(first_register, second_register) - print(f"Multiplication:\n{bu.format_device_state_table(data_table)}\nResult: {result.compact_str()}") + print(f"Multiplication:\n{bu.format_device_state_table(data_table)}\nResult: {result}") case _: print("Such method does not exist, try again.") case "d":