Skip to content

Commit 4bbf321

Browse files
committed
Made exception private in matrix_operations.py
1 parent ce315eb commit 4bbf321

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

matrix_operations.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
class MatrixOperations:
8-
class IncompatibleDimensionsError(Exception):
8+
class __IncompatibleDimensionsError(Exception):
99
def __str__(self) -> str:
1010
return "Matrices are not compatible.\n" \
1111
"No. of Columns in Matrix 1 have to be the same as No. of Rows in Matrix 2."
@@ -35,7 +35,7 @@ def addition(matrix_1: matrix, matrix_2: matrix) -> matrix:
3535
compatible_dim: bool
3636
dim_1, dim_2, same_dim, compatible_dim = MatrixOperations.__get_dimensions(matrix_1, matrix_2)
3737
if not same_dim:
38-
raise MatrixOperations.IncompatibleDimensionsError
38+
raise MatrixOperations.__IncompatibleDimensionsError
3939
sum_m: matrix = [[0 for cols in range(dim_1[1])] for rows in range(dim_1[0])]
4040
for i in range(0, dim_1[0]):
4141
for j in range(0, dim_1[1]):
@@ -51,7 +51,7 @@ def subtraction(matrix_1: matrix, matrix_2: matrix) -> matrix:
5151
compatible_dim: bool
5252
dim_1, dim_2, same_dim, compatible_dim = MatrixOperations.__get_dimensions(matrix_1, matrix_2)
5353
if not same_dim:
54-
raise MatrixOperations.IncompatibleDimensionsError
54+
raise MatrixOperations.__IncompatibleDimensionsError
5555
difference_m: matrix = [[0 for cols in range(dim_1[1])] for rows in range(dim_1[0])]
5656
for i in range(0, dim_1[0]):
5757
for j in range(0, dim_1[1]):
@@ -67,7 +67,7 @@ def multiplication(matrix_1: matrix, matrix_2: matrix) -> matrix:
6767
compatible_dim: bool
6868
dim_1, dim_2, same_dim, compatible_dim = MatrixOperations.__get_dimensions(matrix_1, matrix_2)
6969
if not compatible_dim:
70-
raise MatrixOperations.IncompatibleDimensionsError
70+
raise MatrixOperations.__IncompatibleDimensionsError
7171
product_m: matrix = [[0 for cols in range(dim_2[1])] for rows in range(dim_1[0])]
7272
for i in range(0, dim_1[0]):
7373
for j in range(0, dim_2[1]):

0 commit comments

Comments
 (0)