@@ -78,7 +78,7 @@ def __init__(
7878 self .validate_labels ()
7979
8080 def __str__ (self ):
81- """Return string version of the matrix class ."""
81+ """Return a string representation of the Matrix ."""
8282 s = f" { self .cols_labels } "
8383
8484 for i , row_label in enumerate (self .rows_labels ):
@@ -87,7 +87,7 @@ def __str__(self):
8787 return f"\n matrix { self .name } \n { s } \n "
8888
8989 def __iter__ (self , ** kargs ):
90- """Help method for the matrix class ."""
90+ """Helper method for the iteration of the Matrix ."""
9191 self .i = - 1
9292 self .j = 0
9393
@@ -99,7 +99,7 @@ def __iter__(self, **kargs):
9999 return self
100100
101101 def __next__ (self ):
102- """Help method for the matrix class ."""
102+ """Helper method for the iteration of the Matrix ."""
103103 if self .i >= len (self .rows_labels ) - 1 and self .j >= len (self .cols_labels ) - 1 :
104104 self .get_labels = True
105105 self .get_indices = False
@@ -126,7 +126,7 @@ def __next__(self):
126126 return nxt
127127
128128 def __copy__ (self ):
129- """Return a copy of Matrix Object ."""
129+ """Return a copy of a Matrix object ."""
130130 return Matrix (self .mat ,
131131 rows_labels = self .rows_labels ,
132132 cols_labels = self .cols_labels ,
@@ -137,7 +137,7 @@ def __copy__(self):
137137 """Validators """
138138
139139 def validate_labels (self ):
140- """Return a copy of Matrix Object ."""
140+ """Sanity function to check the dimensionality of the Matrix ."""
141141 if self .rows_labels :
142142 self .rows_labels = decode_labels (self .rows_labels )
143143 if len (self .rows_labels ) != len (set (self .rows_labels )):
@@ -155,15 +155,15 @@ def validate_labels(self):
155155 raise Exception ('Duplicate column labels in Matrix.' )
156156
157157 def update_ix_mappings (self ):
158- """Return a copy of Matrix Object ."""
158+ """Update the index-label mapping ."""
159159 if hasattr (self , '_rows_labels_ix_mapping' ) and self .rows_labels :
160160 self ._rows_labels_ix_mapping = get_label_ix_mapping (self .rows_labels )
161161
162162 if hasattr (self , '_cols_labels_ix_mapping' ) and hasattr (self , '_cols_labels' ):
163163 self ._cols_labels_ix_mapping = get_label_ix_mapping (self ._cols_labels )
164164
165165 def validate_labels_and_update_ix_mappings (self ):
166- """Return a copy of Matrix Object ."""
166+ """Update function, called when the Matrix mutates, combining the two previous functionalities ."""
167167 self .validate_labels ()
168168 self .update_ix_mappings ()
169169
0 commit comments